Talk About Network



Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Functional > Re: Summing ser...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 2 of 2 Topic 2779 of 2842
Post > Topic >>

Re: Summing series in Haskell

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.




 2 Posts in Topic:
Summing series in Haskell
"Xcriber51" <  2008-02-23 08:03:46 
Re: Summing series in Haskell
Tim Northover <tim@[EM  2008-02-23 15:08:40 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Sat May 17 7:57:22 CDT 2008.