Falling Baseball with Euler-Lagrange discretization

The script calculates the path of a thrown mass, in the single vertical dimension. The true path of an object minimizes the Action integral S.

Action

The Lagrangian L is given by L=T-V. Discretization of the Lagrangian gives

Action

Which gives the discrete Action

Action

Varying the path leads to different Actions, and varying w.r.t each node on the grid, gives an explicit linear system of equations.

Svary

The problem can also be formulated as an unconstrained optimization problem. For 5 varying points, with 2 constrained end points, we can define

Svary

The transposed jacobian is

Svary

The Hessian is

Svary

The solution can then be found by e.g Newton-Conjugate-Gradient algorithm
Home