SICP Exercise 3.62 div-series

Exercise 3.62.  Use the results of exercises 3.60 and 3.61 to define a procedure div-series that divides two power series. Div-series should work for any two series, provided that the denominator series begins with a nonzero constant term. (If the denominator has a zero constant term, then div-series should signal an error.) Show how to use div-series together with the result of exercise 3.59 to generate the power series for tangent.

SOLUTION

Note that the power series for tan(x) is:

tan(x) = 1 * (x/1!) + 2 * ((x^3)/3!) + 16 * ((x^5)/5!) + 272 * ((x^7)/7!) + 7936 * ((x^9)/9!) + ...

The code and tests are 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