StreamRecurrenceTool CΒΆ
strec.spad line 54 [edit on github]
C: Join(SemiRng, AbelianMonoid)
StreamRecurrenceTool helps with the generation of streams from a recurrence.
- twoTermRecurrentStream: (C, C, C, C) -> Stream C
twoTermRecurrentStream(c1,c2,i1,i2)
returns a streams
such thats
.1=i1s
.2=i2 are the two initial stream elements and any further element is computed by the recurrence c1*s(n
)+c2*s(n+1
)=s
(n+2
). The Fibonacci sequence would be computed by twoTermRecurrentStream(1,1,1,1).