Search code examples
pythonmathprogramming-languagesfunctional-programmingseries

Which programming language or a library can process Infinite Series?


Which programming language or a library is able to process infinite series (like geometric or harmonic)? It perhaps must have a database of some well-known series and automatically give proper values in case of convergence, and maybe generate an exception in case of divergence.

For example, in Python it could look like:

sum  = 0
sign = -1.0
for i in range(1,Infinity,2):
     sign = -sign
     sum += sign / i

then, sum must be math.pi/4 without doing any computations in the loop (because it's a well-known sum).


Solution

  • You need something that can do a symbolic computation like Mathematica. You can also consider quering wolframaplha: sum((-1)^i*1/i, i, 1 , inf)