Dear list,

I use the sympify function to return an symbolic expression of the string 
and then call the jacobian function. However, I need to extract the 
variables that were created when the string was processed by sympify?

For example, the Jacobian of a quadratic equation is,

import sympy
equation = sympy.sympify( " a * x**2 + b * x + c ")
X = sympy.Matrix([equation])
Y = sympy.Matrix([a,b,c])  # here, not general because must be manually 
specified
jacobian = X.jacobian(Y)

Everything is general apart from the  Y = sympy.Matrix([a,b,c]) line.

Is there a away to extract the variables added (a, b, c) to the namespace 
by the sympify function? If so this code an be used to calculate the 
Jacobian of any function.

Best wishes,

Dan


-- 
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/sympy/-/GD8TJ1nDeSsJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sympy?hl=en.

Reply via email to