SICP Exercise 3.78 solve-2nd

Exercise 3.78.  

Figure 3.35:  Signal-flow diagram for the solution to a second-order linear differential equation.
Consider the problem of designing a signal-processing system to study the homogeneous second-order linear differential equation

The output stream, modeling y, is generated by a network that contains a loop. This is because the value of d2y/dt2depends 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 ab, and dtand the initial values y0 and dy0 for y and dy/dt and generates the stream of successive values of y.

SOLUTION

The code and tests are here.

The plots are pasted below and also available here


Comments

Popular posts from this blog

SICP Exercise 2.56 differentiation rule

SICP Exercise 1.28 (Miller-Rabin Test)

SICP Exercise 4.18 a alternative strategy for interpreting internal definitions