Re: [Pharo-users] Is lazy evaluation of infinite series possible?

2016-05-30 Thread Erisa
The fibonacciSequence example was really helpful. I made a new class PowerSeries, a subclass of Generator. Then I defined a binary operation + as follows: + aPowerSeries ^ PowerSeries on: [ :ps | | a b | [ a := self next. b := aPowerSeries next. ps yield: (a + b) ] rep

Re: [Pharo-users] Is lazy evaluation of infinite series possible?

2016-05-29 Thread Erisa
I took a look at the numerical methods book, but it seems oriented to actually evaluating an infinite series up to a certain accuracy. With formal power series all we want are the coefficients. For example, consider the series S = 1 + x + x^2 + x^3 + ... The coefficients are an infinite list [1

[Pharo-users] Is lazy evaluation of infinite series possible?

2016-05-28 Thread Erisa
I am just learning Pharo (taking the MOOC actually!) and am wondering whether it is possible to model formal power series. I have done this in Haskell quite easily and efficiently, but struggled to do it in Python without real success. It requires one to perform operations on an infinite stream (