rmz
unread,Dec 2, 2010, 7:21:40 PM12/2/10Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Structure and Interpretation of Classical Mechanics
Hi guys
I'm looking at this excellent book and considering if I should spend
som serious time with it. However, of I am going to that I should have
some confidence that the scheme code is reasonably stable. I want to
learn mechanics, not debug scmutils exiting as that may be. So to
check things out I try to work through the examples in the book to see
if they work as advertised, but unfortunately I'm finding that they
are not. Below are my notes. I've tried to be very accurate when
copying from the book, but of course mistakes can have been made. I
haven't spotted any though. Anyone haveany ideas?
(Rmz)
;;;
;;; This file is a file that I use for scheme notes when
;;; reading "The Structure and Interpretation of
;; Classical Mechanics" (sicm). (Rmz)
;;;
(define ((L-free-particle mass) local)
(let ((v (velocity local)))
(* 1/2 mass (dot-product v v))))
(define q
(up (literal-function 'x)
(literal-function 'y)
(literal-function 'z)))
;; use (component i) to get components out
;; time = (coordinate 0)
;; coordinate = (component 1)
;; velocity = (component 2)
;; Some examples from p. 18o
(print-expression ((D q) 't))
(print-expression ((Gamma q) 't))
(print-expression
((compose (L-free-particle 'm) (Gamma q)) 't))
(show-expression
((compose (L-free-particle 'm) (Gamma q)) 't))
(show-expression
((compose (L-free-particle 3) (Gamma q)) 't))
;; This defines action based on the Lagrangeian:
;; The integral along from t1 to t2 of the Lagrangeian,
;; the action principle is that the real action will be along the
;; minimum action path.
(define (test-path t)
(up (+ (* 4 t) 7)
(+ (* 3 t) 5)
(+ (* 2 t) 1)))
(define (Lagrangian-action L q t1 t2)
(definite-integral (compose L (Gamma q)) t1 t2))
;; Now page 20 in SICM states that evaluating:
;; (Lagrangian-action (L-free-particle 3.0) test-path 0.0 10.0)
;; should yield ther result 435, but that isn't what i'm getting.
;; I'm getting
;The object (*number* (expression (* 1.5 (+ (* ((derivative z) 2.5)
((derivative z) 2.5)) (* ((derivative y) 2.5) ((derivative y) 2.5)) (*
((derivative x) 2.5) ((derivative x) 2.5)))))), passed as the first
argument to integer->flonum, is not the correct type.
;; and this callstack(from the debugger):
; S0 (integer->flonum (quote (*number* (expression (* 1.5 (+ (*
((derivativ ...
; S1 (f i)
; S2 (sigma-flo fx 0 (minus-fixnum n 1))
; S3 (f (head s))
; S4 (map-stream (second-euler-maclaurin f a b) *new-bs-steps*)
; >S5 (integrate-open-finite f a b *integrate-n* eps)
;; At this point I'm wondering if the definite-integral method is
broken
;; so I run a simple test, but that seems to be working fine.
(define (identity x) x)
(definite-integral identity 1 19) ; works fine
;; In all that wasn't so encuraging. Any ideas about what might be
wrong?
;; I'm running on OSX with mit-scheme from macport
; Image saved on Thursday November 25, 2010 at 10:37:15 AM
; Release 9.0.1 || Microcode 15.1 || Runtime 15.7 || SF 4.41 || LIAR/
C 4.118 || Edwin 3.116
; Scmutils compled locally and dumped to a band.