weimalearnstoprogram.blogspot.com
weima learns to program: Index
http://weimalearnstoprogram.blogspot.com/2008/07/index.html
Weima learns to program. My attempt to do the exercises in sicp. Saturday, July 5, 2008. Find your way through this blog Chapter 1 01.01. Labels: sicp exercise solutions. Subscribe to: Post Comments (Atom). Structure and Interpretation of Computer Programs. View my complete profile. Subscribe To My Blog. Index to sicp exercise. Sicp exercise 2.72. Sicp exercise 2.71. Sicp exercise 2.70. Sicp exercise 2.69. Sicp exercise 2.68. Sicp exercise 2.67. Sicp exercise 2.66. Sicp exercise 2.65. Sicp exercise 2....
weimalearnstoprogram.blogspot.com
weima learns to program: sicp exercise 3.73
http://weimalearnstoprogram.blogspot.com/2011/01/sicp-exercise-373.html
Weima learns to program. My attempt to do the exercises in sicp. Sunday, January 2, 2011. Sicp exercise 3.73. V = v0 (1/C)0ti dt R i. Figure 3.33: An RC circuit and the associated signal-flow diagram. Define (scale-stream stream factor). Stream-map (lambda (x) (* x factor) stream). Define (integral integrand initial-value dt). Add-streams (scale-stream integrand dt). Define (RC R C dt). Add-stream (scale-stream i R). Integral (scale-stream i (/ 1 C) v0 dt) ). Define RC1 (RC 5 1 0.5). Subscribe To My Blog.
weimalearnstoprogram.blogspot.com
weima learns to program: sicp exercise 3.70
http://weimalearnstoprogram.blogspot.com/2011/01/sicp-exercise-370_8130.html
Weima learns to program. My attempt to do the exercises in sicp. Sunday, January 2, 2011. Sicp exercise 3.70. A the stream of all pairs of positive integers (i,j) with i j ordered according to the sum i j. B the stream of all pairs of positive integers (i,j) with i j, where neither i nor j is divisible by 2, 3, or 5, and the pairs are ordered according to the sum 2 i 3 j 5 i j. Define (display-stream str num). If ( index num) 'printed. Display-line (stream-ref str index). Internal ( 1 index) ) ). Weima i...
weimalearnstoprogram.blogspot.com
weima learns to program: sicp exercise 3.79
http://weimalearnstoprogram.blogspot.com/2011/01/sicp-exercise-379.html
Weima learns to program. My attempt to do the exercises in sicp. Tuesday, January 4, 2011. Sicp exercise 3.79. Exercise 3.79. Generalize the solve-2nd procedure of exercise 3.78 so that it can be used to solve general second-order differential equations d2 y/dt2 = f(dy/dt, y). Define (integral delayed-integrand initial-value dt). Let ( integrand (force delayed-integrand) ). Add-streams (scale-stream integrand dt). Define (solve f y0 dy0 dt). Define y (integral (delay dy) y0 dt). View my complete profile.
weimalearnstoprogram.blogspot.com
weima learns to program: sicp exercise 3.82
http://weimalearnstoprogram.blogspot.com/2011/01/sicp-exercise-382.html
Weima learns to program. My attempt to do the exercises in sicp. Thursday, January 6, 2011. Sicp exercise 3.82. Exercise 3.82. Redo exercise 3.5 on Monte Carlo integration in terms of streams. The stream version of estimate-integral will not have an argument telling how many trials to perform. Instead, it will produce a stream of estimates based on successively more trials. Get-random-stream is a procedure which generates a stream of random pairs of (x,y) which lie within x1 y1 x2 y2. If (integral x y).
weimalearnstoprogram.blogspot.com
weima learns to program: sicp exercise 3.80
http://weimalearnstoprogram.blogspot.com/2011/01/sicp-exercise-380_04.html
Weima learns to program. My attempt to do the exercises in sicp. Tuesday, January 4, 2011. Sicp exercise 3.80. Exercise 3.80. A series RLC circuit consists of a resistor, a capacitor, and an inductor connected in series, as shown in figure 3.36. If R, L, and C are the resistance, inductance, and capacitance, then the relations between voltage (v) and current (i) for the three components are described by the equations. And the circuit connections dictate the relations. Figure 3.36: A series RLC circuit.
weimalearnstoprogram.blogspot.com
weima learns to program: sicp exercise 3.77
http://weimalearnstoprogram.blogspot.com/2011/01/sicp-exercise-377.html
Weima learns to program. My attempt to do the exercises in sicp. Tuesday, January 4, 2011. Sicp exercise 3.77. Exercise 3.77. The integral procedure used above was analogous to the ` implicit' definition of the infinite stream of integers in section 3.5.2. Alternatively, we can give a definition of integral that is more like integers-starting-from (also in section 3.5.2):. Define (integral integrand initial-value dt). Define (add-streams s1 s2). Define (scale-stream stream factor). Define (solve f y0 dt).
weimalearnstoprogram.blogspot.com
weima learns to program: December 2010
http://weimalearnstoprogram.blogspot.com/2010_12_01_archive.html
Weima learns to program. My attempt to do the exercises in sicp. Monday, December 27, 2010. Sicp exercise 3.68. Exercise 3.68. Louis Reasoner thinks that building a stream of pairs from three parts is unnecessarily complicated. Instead of separating the pair (S0,T0) from the rest of the pairs in the first row, he proposes to work with the whole first row, as follows:. Define (pairs s t). Stream-map (lambda (x) (list (stream-car s) x). Pairs (stream-cdr s) (stream-cdr t) ). Maximum recursion depth exceeded.
weimalearnstoprogram.blogspot.com
weima learns to program: sicp exercise 3.71
http://weimalearnstoprogram.blogspot.com/2011/01/sicp-exercise-371.html
Weima learns to program. My attempt to do the exercises in sicp. Sunday, January 2, 2011. Sicp exercise 3.71. Define (display-stream str num). If ( index num) 'printed. Display-line (stream-ref str index). Internal ( 1 index) ) ). Cons-stream n (integers-from-n ( 1 n) ). Define integers (integers-from-n 1). Define (merge-weighted s1 s2 weight). Let ( s1car (stream-car s1). S2car (stream-car s2) ). Cond ( (weight s1car) (weight s2car). Cons-stream s1car (merge-weighted (stream-cdr s1) s2 weight) ). Struct...
weimalearnstoprogram.blogspot.com
weima learns to program: January 2011
http://weimalearnstoprogram.blogspot.com/2011_01_01_archive.html
Weima learns to program. My attempt to do the exercises in sicp. Thursday, January 6, 2011. Sicp exercise 3.82. Exercise 3.82. Redo exercise 3.5 on Monte Carlo integration in terms of streams. The stream version of estimate-integral will not have an argument telling how many trials to perform. Instead, it will produce a stream of estimates based on successively more trials. Get-random-stream is a procedure which generates a stream of random pairs of (x,y) which lie within x1 y1 x2 y2. If (integral x y).