【SICP练习】129 练习3.60

练习3-60

原文

Exercise 3.60. With power series represented as streams of coefficients as in exercise 3.59, adding series is implemented by add-streams. Complete the definition of the following procedure for multiplying series:

(define (mul-series s1 s2)  
   (cons-stream <??> (add-streams <??> <??>)))

You can test your procedure by verifying that sin2 x + cos2 x = 1, using the series from exercise 3.59.

代码

(define (mul-series s1 s2)
  (cons-stream (* (stream-car s1)
                  (stream-car s2))
               (add-streams (mul-streams (stream-cdr s1)
                                         (stream-cdr s2))
                            (mul-series s1 s2))))



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


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


版权声明:本文为 NoMasp柯于旺 原创文章,如需转载请联系本人。

posted @ 2015-03-28 22:52  nomasp  阅读(172)  评论(0编辑  收藏  举报