【SICP练习】131 练习3.62

练习3-62

原文

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.

代码

(define (div-series s1 s2) (let ((c (stream-car s2))) (if (= c 0) (error "constant term of s2 can't be 0!") (scale-stream (mul-series s1 (reciprocal-series (scale-stream s2 (/ 1 c)))) (/ 1 c)))))

(define tane-series (div-series sine-series cosine-series))

感谢访问,希望对您有所帮助。 欢迎关注或收藏、评论或点赞。

为使本文得到斧正和提问,转载请注明出处:
http://blog.csdn.net/nomasp

你可能感兴趣的:(div,for,power,define,series)