From: Alex on
So I am trying to find the equation of motion for a system, using Lagrangian mechanics.

MUPAD has solved it for me, but when I ask it to differentiate something, with respect to t (time), it makes all my constants functions of time, and therefore doesnt set them to 0 if they are constants

F:= 2r
differentiated using diff becomes

2*d/dt[r(t)]

can I not get it to know that constants are constants and they differentiate to 0?

Secondly, once i have this equation I want to solve it using ODE45 in matlab. Is there a way I can transport it to MATLAB? I know that matlab doesnt understand MUPAD code, such as differentials etc, but there must be some way to use it in matlab.

Lastly if i tell MUPAD that x2=f(x(t)) (and it knows the whole function)
then can it actually do the differential of that rather than writing the result and d/dx[x2] or whatever.