Home > Archive > Scheme > November 2005 > How to multiply power series represented as streams?
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
How to multiply power series represented as streams?
|
|
|
| Hi, I've been working my way through SICP and I've been stuck for a few
days now on Excercise 3.60
Full problem:
http://mitpress.mit.edu/sicp/full-t...ml#%25_thm_3.60
Basically,
given the stream of coefficients of two power series representing two
functions f1 and f2, compute the stream of coefficients of the power
series of f1 * f2.
I've gotten as far as realizing the zero'th coef of the resulting
stream should be the product of first two items in the input streams.
result(0) = s1(0) * s2(0)
The n'th coef should have the form
result(n) = s1(n) * s2(0) + s1(n-1) * s2(1) + s1(n-2) * s2(2) + ... +
s1(2) * s2(n-2) + s1(1) * s2(n-1) + s1(0) * s2(n)
What I haven't figured out is how to forumate result(n) in terms of the
addition of two steams as the problem calls for the solution to be of
the form:
(defineÂ_(mul-seriesÂ_s1Â_s2)
Â_Â_(cons-streamÂ_<??>Â_(add-streamsÂ_<??>Â_<??> )))
Any clues for the clueless?
| |
| Brian Harvey 2005-11-29, 3:58 am |
| Billy <droid@zoo-crew.org> writes:
>Hi, I've been working my way through SICP and I've been stuck for a few
>days now on Excercise 3.60
> [...]
>Any clues for the clueless?
Yeah, look at the PAIRS procedure they define to compute the stream of
pairs of integers, and the discussion of that procedure in exercise 3.68,
and see if that helps.
|
|
|
|
|