Strange behavior of functionalDerivative()
1 view (last 30 days)
Show older comments
Hey all,
I've encountered the issue where functionalDerivative() gives a wrong result:
clear
syms x(t)
f = diff(x, t)^2 * x^2
functionalDerivative(f,x)
results in
- 2*x(t)*diff(x(t), t)^2 - 2*x(t)^2*diff(x(t), t, t)
while it should be (at least if my knowledge of partial derivates is still correct)
2*x(t)*diff(x(t), t)^2
How can this be?
If encountered this while trying to get the dynamics equation of a system using the Lagrangian approach.
Interestingly this error leads to -dL/dx = 0 producing the correct end result, while usually the equation d/dt( dL/ddiff(x,t) ) - dL/dx = 0 should produce this result. (with L=T-V, T being the kinetic and V the potential Energy of the system)
0 Comments
Answers (0)
See Also
Categories
Find more on Calculus in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!