Exercise 1.8

54 views
Skip to first unread message

georg

unread,
Sep 12, 2005, 3:32:31 PM9/12/05
to Structure and Interpretation of Classical Mechanics
Hi, I have been staring at Exercise 1.8 for quite some time now but
can't seem to come up with a solution. I suspect that (1.22) should
hold the key, so I tried the following:

(define ((((delta eta) f) q) t)
(let ((g (f (+ q (* epsilon eta)))))
(((D g) 0) t)))
;Value: delta

but this contains the unbound variable epsilon and invariably leads to
trouble when I do the following:

(define eta (literal-function 'eta))
;Value: eta

(define q (literal-function 'q))
;Value: q

(print-expression ((((delta eta) F) q) 't))
;Unbound variable: epsilon

Any help would be greatly appreciated

Cheers

Georg

Tobin Fricke

unread,
Sep 13, 2005, 2:06:06 PM9/13/05
to Structure and Interpretation of Classical Mechanics
On Mon, 12 Sep 2005, georg wrote:

> Hi, I have been staring at Exercise 1.8 for quite some time now but
> can't seem to come up with a solution. I suspect that (1.22) should
> hold the key, so I tried the following:
>
> (define ((((delta eta) f) q) t)
> (let ((g (f (+ q (* epsilon eta)))))
> (((D g) 0) t)))
> ;Value: delta

Very close! The problem here is that, in the let clause, scheme tries to
evaluate the expression (f (+ q (* epsilon eta))) in order to get a value
for g. You don't want to assign a particular numerical value to g at this
point; instead you want to define the function g(epsilon) = f +
q[epsilon*eta], which you can do using a lambda clause:

(define (((delta eta) f) q)
(let ((g (lambda (epsilon) (f (+ q (* epsilon eta))))))
((D g) 0)))
;Value: delta

> (print-expression ((((delta eta) F) q) 't))
> ;Unbound variable: epsilon

I am not sure how F is defined.. following the text you'd do something
like:

; Gamma maps a vector in coordinate space into a local tuple.
; F is a function of the local tuple

(define (f q)
(compose
(literal-function 'F (-> (UP Real Real Real) Real))
(Gamma q)))

(print-expression ((((delta eta) f) q) 't))
(+ (* (((partial 2) F) (up t (x t) ((D x) t))) ((D eta) t)) (* (((partial
1) F) (up t (x t) ((D x) t))) (eta t)))

Hope this helps,
Tobin

georg

unread,
Sep 14, 2005, 2:11:10 PM9/14/05
to Structure and Interpretation of Classical Mechanics
The premature evaluation of g was the problem. Thanks a lot

Reply all
Reply to author
Forward
0 new messages