Hello,
I'm a relatively new sympy user, and am experiencing some confusion
regarding the distinction between symbols and functions, especially in
situations where I want to take derivatives. Some context: Let's say I'm
trying to get the equations of motion for a system from its Lagrangian. As
a simple example, consider the Lagrangian for the simple pendulum $$L = 1/2
m l^2 \dot\theta^2 - mg(1-\cos\theta)$$, where the dot represents a time
derivative. The equation of motion is given by $$ {\partial \over \partial
t}\left({\partial L \over \partial \dot\theta}\right) - {\partial L \over
\partial\theta} = 0. $$
Now, my problem. If I declare theta as a symbol, when I try to
differentiate with respect to time, I get zero (which makes sense, I guess;
it doesn't have explicit time dependence). If, however, I declare it as a
function, I run into trouble trying to differentiate L with respect to
theta. Additionally, I don't have any idea how to represent the fact that
\dot\theta is the same as theta.diff(t), though if I could get around the
first issue, I could just stick theta.diff(t) in wherever I need it.
Can anyone offer some insight about what I'm doing wrong?
Thanks,
Cavendish
--
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 http://groups.google.com/group/sympy.
For more options, visit https://groups.google.com/groups/opt_out.