Hi Erisa,
one solution, using your notation, could eg be
* aPowerSeries
^ PowerSeries on:
[ :generator |
|a b|
a:=OrderedCollection new.
b:=OrderedCollection new.
[ a add: self next.
b add: aPowerSeries nex
Hi,
> will the recursion in the definition of * blow up rapidly
Wouldn't memoization wrapper help (in case of re-evaluation) ?
--
View this message in context:
http://forum.world.st/Is-lazy-evaluation-of-infinite-series-possible-tp4897956p4898731.html
Sent from the Pharo Smalltalk Users maili
Multiplication of power series looks tricky as for the term k of the
resulting power series you need to access terms where sum index value to
k. (ps1 next: i) and (ps2 next: k - i). Somehow the bloc of code
defining the multiplicated serie needs to know about its current rank k.
You should not nee
I have no idea of the solution… but what I just read brought to me «
Continuation » . I wonder if it may help here.
My 0.2 cents,
Cédrik
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
Did you take a look at Nicolai suggestion regarding the Generator class.
There is a fibonacci example in its test case.
fibo := GeneratorTest new fibonacciSequence
then to access the sequence term:
fibo next.
Hilaire
--
Dr. Geo
http://drgeo.eu
Hello,
Other people are probably better qualified to weigh in on the best ways to
manage packages in a Pharo image, but this is what I do:
1) Left click on the "desktop" to bring up the "world menu" and select
"Monticello Browser."
2) Click the "+Repository" button and select "smalltalkhub.com" f
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
Hello 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 o
Hello,
I know infinite series are mentioned in the numerical methods book, although
I haven't worked with those classes specifically.
http://files.pharo.org/books/numerical-methods/2016-04-NumericalMethods.pdf
You could also use a LazyList, depending on what you were doing, from
http://smalltalk
2016-05-28 20:57 GMT+02:00 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
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 (
12 matches
Mail list logo