Hello,
I am having some doubts on how to use subs() in sympy. My aim is to do
lagrangian mechanics which involves differentiation.The code below is a
cooked up one but I guess it would serve the purpose.
Please look at the code below
from sympy.physics.mechanics import *
import cvxpy
q1, q2 = dynamicsymbols('q1 q2')
q1d, q2d = dynamicsymbols('q1 q2', 1)
L = q1*q1d + q2*q2d
print L.subs(q1, 2).subs(q2, 1).subs(q1d, 3).subs(q2d, 7)
# EXPECTED ANSWER: L = 2*3 + 1*7 = 13
# ACTUAL ANSWER: L = Derivative(1, t) + 2*Derivative(2, t)
Please let me know how to modify the code to get the expected answer
Thanks
Ash
--
You received this message because you are subscribed to the Google Groups
"sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sympy.
To view this discussion on the web visit
https://groups.google.com/d/msgid/sympy/935d0daa-9dc6-4174-990d-d0d7172612ae%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.