【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


目录
相关文章
|
网络架构
【SICP练习】145 练习4.1
版权声明:转载请联系本人,感谢配合!本站地址:http://blog.csdn.net/nomasp https://blog.csdn.net/NoMasp/article/details/44728049 练习4-1 原文 Exercise 4.
922 0
|
Go
【SICP练习】146 练习4.2
版权声明:转载请联系本人,感谢配合!本站地址:http://blog.csdn.net/nomasp https://blog.csdn.net/NoMasp/article/details/44729521 练习4-2 原文 Exercise 4.
673 0