Search This Blog

26 April 2009

SeriesCF


While working on my ContinuedFractions library today, it occured to me that our current representation of pi could be simplified by just specifying the numerators and denominators as series...


I went ahead and changed the implementation to use a new SeriesCF class instead of the default ContinuedFraction class and I think the new approach is much cleaner.


2 comments:

Malachi de AElfweald said...

Ok, well... it is QUITE a bit slower this way.... but the code looks much cleaner and it doesn't have to maintain state... I dunno - have to think about it some more.

Malachi de AElfweald said...

Actually, I have changed all the code so that the base ContinuedFraction assumes that everything is a series of some sort (ie: removed the SeriesCF extension). This also forced me to reconsider how certain ones were being done (like e) and come up with equations for them as well.