With SymPy we can set assumptions on variables:
from sympy import *
x = Symbol('x', real=True)
x, re(x), im(x)
the result is :
(x,x,0)
as expected. But if we try to do the same for a function:
from sympy import *
x = Symbol('x', real=True)
f = Function('f', real=True)(x)
f, re(f), im(f)
the result is :
(f(x),re(f(x)),im(f(x)))
but I expected something as
(f(x),f(x),0)
The question is then: Is there a way to make python assume the range of the function to be real, i.e.
In this previous question it is partially answered, but if the we take the derivative we get again the same problem:
from sympy import *
x = Symbol('x', real=True)
class f(Function):
is_positive = True
df = f(x).diff(x)
df, re(df), im(df)
with result:
(f(x).diff(x),re(f(x).diff(x)),im(f(x).diff(x)))
wanting it to be like
(f(x).diff(x),f(x).diff(x),0)
is there a way?