Scheme Mechanics, also known
as SCMUTILS
, has been used in two books, Structure and Interpretation of Classical Mechanics (), and Functional Differential Geometry (, ).
We derive the Lagrange equations for the following system. A particle of mass m moves in a two-dimensional potential V(x,y)=(x2+y2)/2+x2y−y3/3, where x and y are rectangular coordinates of the particle. A Lagrangian is L(t;x,y;vx,vy)=(1/2)m(v2x+v2y)−V(x,y).
xxxxxxxxxx
(define (Lagrange-eq L q)
(- (D (compose ((partial 2) L) (Gamma q)))
(compose ((partial 1) L) (Gamma q))))
(define (V x y)
(+ (/ (+ (square x) (square y)) 2)
(* (square x) y)
(- (/ (cube y) 3))))
(define ((L m) local)
(let ((vx (ref (velocity local) 0))
(vy (ref (velocity local) 1))
( x (ref (coordinate local) 0))
( y (ref (coordinate local) 1)))
(- (/ (* m (+ (square vx) (square vy))) 2)
(V x y))))
(define (q t)
(up
((literal-function 'x) t)
((literal-function 'y) t)))
(print-expression
((Lagrange-eq (L 'm) q) 't))
)