Details for Wednesday Afternoon
Afternoon Lecture
A series:
-- a number: a Sigma(i=0..N)(f i),
now: sum of all squares, sum of2^i/i!, ...
;; sum-x-square : natural-number[n] -> number
;; result: sum(i=0)(i=n)(f i)
(define (sum-f N)
(cond
((zero? N) (f 0))
(else (+ (f N) (sum-f (- N 1))))))
;; i
(define (f i) i)
;; i^2
(define (f i) (* i i))
;; e^2 @ i : 2^i/i!
(define (f i) (/ (expt 2 i) (! i)))
(define (! n) (if (= n 0) 1 (* n (! (- n 1)))))
---------------------------------------------------------------------------------
Structs in lists
-- list of balls: extract list of positions
-- list of personnel records: extract list of names+salaries
Afternoon Lab:
RECAP: nat nums : natnum -> list-of "series of e^i for i = 0, ..., 10"
ASSIGNMENTS: choose teams, let them choose:
- Section 13.3: series of rectangles [well-suited for graphical
illustration of geometric series on TAAS]
or
- Section 12.2: protect the wall [fun, more realistic]
EVALUATION