Implement till 3.80
This commit is contained in:
@@ -108,13 +108,6 @@
|
|||||||
|
|
||||||
(display "\nex-3.78 - solve-2nd\n")
|
(display "\nex-3.78 - solve-2nd\n")
|
||||||
|
|
||||||
; The output stream, modeling y, is generated by a network that contains a loop.
|
|
||||||
; This is because the value of d2y/dt2 depends upon the values of y and dy/dt and
|
|
||||||
; both of these are determined by integrating d2y/dt2. The diagram we would like
|
|
||||||
; to encode is shown in figure 3.35. Write a procedure solve-2nd that takes as
|
|
||||||
; arguments the constants a, b, and dt and the initial values y0 and dy0 for y
|
|
||||||
; and dy/dt and generates the stream of successive values of y.
|
|
||||||
|
|
||||||
(define (solve-2nd a b dt y0 dy0)
|
(define (solve-2nd a b dt y0 dy0)
|
||||||
(define y (integral (delay dy) y0 dt))
|
(define y (integral (delay dy) y0 dt))
|
||||||
(define dy (integral (delay ddy) dy0 dt))
|
(define dy (integral (delay ddy) dy0 dt))
|
||||||
@@ -130,9 +123,32 @@
|
|||||||
0.5000141490501059) ; sin pi/6 = 0.5
|
0.5000141490501059) ; sin pi/6 = 0.5
|
||||||
|
|
||||||
(display "\nex-3.79 - solve-2nd-general\n")
|
(display "\nex-3.79 - solve-2nd-general\n")
|
||||||
|
(display "[ok]\n")
|
||||||
|
|
||||||
(define (solve-2nd-general a b) '())
|
(define (solve-2nd-general f y0 dy0 dt)
|
||||||
|
(define y (integral (delay dy) y0 dt))
|
||||||
|
(define dy (integral (delay ddy) dy0 dt))
|
||||||
|
(define ddy (stream-map f dy y))
|
||||||
|
y)
|
||||||
|
|
||||||
|
(display "\nex-3.80 - RLC\n")
|
||||||
|
|
||||||
|
(define (RLC R L C dt)
|
||||||
|
(define (rlc-proc vC0 iL0)
|
||||||
|
(define vC (integral (delay dvC) vC0 dt))
|
||||||
|
(define iL (integral (delay diL) iL0 dt))
|
||||||
|
(define dvC (scale-stream il (/ -1 C)))
|
||||||
|
(define diL
|
||||||
|
(add-streams
|
||||||
|
(scale-stream iL (/ (- R) L))
|
||||||
|
(scale-stream vC (/ 1 L))))
|
||||||
|
(cons vC iL))
|
||||||
|
rlc-proc)
|
||||||
|
|
||||||
|
(define RLC1 (RLC 1 1 0.2 0.1))
|
||||||
|
(display "[ok]\n")
|
||||||
|
|
||||||
|
(display "\nex-3.81\n")
|
||||||
|
|
||||||
|
(display "\nex-3.82\n")
|
||||||
|
|
||||||
;(display "\nex-3.80\n")
|
|
||||||
;(display "\nex-3.81\n")
|
|
||||||
;(display "\nex-3.82\n")
|
|
||||||
|
|||||||
Reference in New Issue
Block a user