Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

习题3.62 #20

Open
Perry961002 opened this issue Dec 28, 2018 · 1 comment
Open

习题3.62 #20

Perry961002 opened this issue Dec 28, 2018 · 1 comment

Comments

@Perry961002
Copy link

div-series应该求任何两个级数,您的代码只能求分母的常数项是1的情况。
我的代码:
; 假设X= S1 / S2
; X = S1 * (1 / (S2 / c)) * (1 / c) (c是S2的常数项)

(define (div-series s1 s2)
(let ((c (stream-car s2)))
(if (= c 0)
(error "The series in the denominator has 0! constant terms")
(scale-stream (mul-series s1
(reciprocal-series (scale-stream s2 (/ 1 c))))
(/ 1 c)))))

(define tan-series (div-series sine-series cosine-series))
;(display-top10 tan-series)
;0 1 0 1/3 0 2/15 0 17/315 0

@INotWant
Copy link

楼上正解

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants