by Tim Northover <tim@[EMAIL PROTECTED]
>
Feb 23, 2008 at 03:08 PM
Xcriber51 wrote:
> Let's say I want to be able to sum these (separately). And let's say I
> want the output to be expressed as a fraction. (e.g. "a" would be 10/9.)
>
> How do I achieve this?
With great difficulty in general. Both the series you gave were geometric:
they had the form
a + ar + ar*r + ...
for some a and r. There's a simple formula for the sum of such series --
the
sum is a/(1-r). You could implement this trivially in Haskell.
But if the sequences aren't guaranteed to be geometric, the problem is in
general unsolvable. There's not even a general algorithm to determine if a
series *has* a sum, let alone find it.
> (The purpose of this is not to calculate these sums -- which can be done
> with pen and paper -- but to figure out how Haskell expresses it the way
I
> want.)
I suspect you'd head towards a general computer algebra system if you
tried
to do something more general than a specific type of series. That's going
to be rather a complicated beast.
Tim.