Problem in my Lagrange's Equation program

40 views
Skip to first unread message

rpfant

unread,
Aug 29, 2006, 1:53:49 AM8/29/06
to Structure and Interpretation of Classical Mechanics
Dear all,

I am doing "Exercise 1.19. A two-bar linkage".

When I used scheme to find the Lagrange's equations, I got the
following result:

(down (??? x) (??? x))


Does it mean that the result is too big and cannot be display?

Or there are bugs in my code?

Best Regards,
rpfant

rpfant

unread,
Aug 29, 2006, 2:07:01 AM8/29/06
to Structure and Interpretation of Classical Mechanics
My source code may help:

(define ((T-twobar m1 m2 m3 l1 l2 g x1 y1) local)
(let ((t (time local))
(q (coordinate local))
(qdot (velocity local))
)
(let ((vx1 (D x1))
(vy1 (D y1))
(theta1 (ref q 0)) (theta2 (ref q 1))
(thetadot1 (ref qdot 0)) (thetadot2 (ref qdot 1))
)
(+ (* 1/2 m1 (square vx1)) (* 1/2 m1 (square vy1))
(* 1/2 m2 (square (- vx1 (* l1 thetadot1 (sin theta1)))))
(* 1/2 m2 (square (+ vy1 (* l1 thetadot1 (cos theta1)))))
(* 1/2 m3 (square (- vx1 (* l1 thetadot1 (sin theta1))
(* l2 thetadot2 (sin theta1)))))
(* 1/2 m3 (square (+ vy1 (* l1 thetadot1 (cos theta1))
(* l2 thetadot2 (cos theta2))))
))
)))

(define ((V-twobar m1 m2 m3 l1 l2 g x1 y1) local)
(let ((t (time local))
(theta (coordinate local)))
(let ((theta1 (ref q 0)) (theta2 (ref q 1))
)
(+ (* m1 g y1)
(* m2 g (+ y1 (* l1 (sin theta1))))
(* m3 g (+ y1 (* l1 (sin theta1))
(* l2 (sin theta2))))
))
))

(define L-twobar (- T-twobar V-twobar))

(show-expression
(((Lagrange-equations
(L-twobar 'm_1 'm_2 'm_3 'l_1 'l_2 'g (literal-function 'x_1)
(literal-function 'y_1)))
(up (literal-function 'theta_1) (literal-function 'theta_2) ) )
't))

Reply all
Reply to author
Forward
0 new messages