Ex 1.22 Driven pendulum, 3.2
Structure and Interpretation of Classical Mechanics
.
Find the tension in an undriven planar pendulum.
~~~
[guess]
(define ((q->r x_s y_s l) local)
(let* ((q (coordinate local))
(t (time local))
(theta (ref q 0))
(c (ref q 1))
(F (ref q 2)))
(up (+ (x_s t) (* c (sin theta)))
(- (y_s t) (* c (cos theta)))
F)))
(let* ((xs (literal-function 'x_s))
(ys (literal-function 'y_s))
(q (up (literal-function 'theta)
(literal-function 'c)
(literal-function 'F))))
(show-expression ((compose (q->r xs ys 'l) (Gamma q)) 't)))

(define (L-theta m l x_s y_s U)
(compose
(L-driven-free m l x_s y_s U) (F->C (q->r x_s y_s l))))
(let* ((U (U-gravity 'g 'm))
(xs (literal-function 'x_s))
(ys (literal-function 'y_s))
(q (up (literal-function 'theta)
(literal-function 'c)
(literal-function 'F)))
(L (L-theta 'm 'l xs ys U)))
(show-expression (L ((Gamma q) 't))))
(/
(+ (* l m ((D x_s) t) (c t) ((D theta) t) (cos (theta t)))
(* 1/2 l m (expt (c t) 2) (expt ((D theta) t) 2))
(* l m (c t) ((D theta) t) (sin (theta t)) ((D y_s) t))
(* g l m (c t) (cos (theta t)))
(* l m ((D x_s) t) ((D c) t) (sin (theta t)))
(* -1 l m ((D c) t) (cos (theta t)) ((D y_s) t))
(* -1 g l m (y_s t))
(* 1/2 l m (expt ((D x_s) t) 2))
(* 1/2 l m (expt ((D c) t) 2))
(* 1/2 l m (expt ((D y_s) t) 2))
(* 1/2 (expt l 2) (F t))
(* -1/2 (expt (c t) 2) (F t)))
l)
(let* ((U (U-gravity 'g 'm))
(xs (literal-function 'x_s))
(ys (literal-function 'y_s))
(q (up (literal-function 'theta)
(literal-function 'c)
(literal-function 'F)))
(L (L-theta 'm 'l xs ys U)))
(show-expression (((Lagrange-equations L) q) 't)))

.
(let* ((U (U-gravity 'g 'm))
(xs (lambda (t) 0))
(ys (lambda (t) 'l))
(q (up (literal-function 'theta)
(lambda (t) 'l)
(literal-function 'F)))
(L (L-theta 'm 'l xs ys U)))
(show-expression (((Lagrange-equations L) q) 't)))

.
.
[guess]
— Me@2022-04-05 04:16:51 PM
.
.
2022.04.05 Tuesday (c) All rights reserved by ACHK
You must be logged in to post a comment.