I am currently trying to solve a very complex integral, firstly symbolically, and then by evaluating at different limits for optimisation.
For context, my derivative is the following:
dFx = 0.5 * row * Vapr * c *(Cl*cos(theta) + Cd*sin(theta))
Fx = sp.integrate(dFx, r)
Where, within dFx, the variables Vapr, c & theta are all functions of r. When I pprint the function dFx it is larger than the console.
Subsequent to integrating dFx for Fx, when I use:
Fx.subs(r,0.85)
This does not output a numerical answer, but rather then pprint(Fx) I find that the function Fx still has symbols of r in it.
Is there a function, which can tell me what the independent variables of Fx are? Because the equation is so long, I cannot see it all in the console to check that only r remains. i.e. something like
Fx.independants >> r, a, y
Then I would be aware that in fact, Fx is still a function of r, a & y
(For further context, I am trying to solve the Blade Element Momentum Theory equations)
You are looking for the free_symbols
property:
from sympy import symbols
from sympy.abc import x, y
z = x**2 + y
eq = sqrt(x) * y / z
eq.free_symbols # returns {x, y}