Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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).

like image 423
psihodelia Avatar asked Mar 31 '10 10:03

psihodelia


People also ask

What is the example of infinite series?

Examples of infinite sequences are N = (0, 1, 2, 3, ...) and S = (1, 1/2, 1/4, 1/8, ..., 1/2 n , ...). The fact that a sequence is infinite is indicated by three dots following the last listed member. An infinite series is the sum of the values in an infinite sequence of numbers.

What is infinity programming?

The purpose of the Infinity language is to provide a programming language whose syntax and semantics can be extended on the fly to meet the requirements of the programmer.

How do you express an infinite series?

You can use sigma notation to represent an infinite series. For example, ∞∑n=110(12)n−1 is an infinite series. The infinity symbol that placed above the sigma notation indicates that the series is infinite.

What is infinite series used for?

Infinite series have applications in engineering, physics, computer science, finance, and mathematics. In engineering, they are used for analysis of current flow and sound waves. In physics, infinite series can be used to find the time it takes a bouncing ball to come to rest or the swing of a pendulum to stop.


2 Answers

Most functional languages which evaluate lazily can simulate the processing of infinite series. Of course, on a finite computer it is not possible to process infinite series, as I am sure you are aware. Off the top of my head, I guess Mathematica can do most of what you might want, I suspect that Maple can too, maybe Sage and other computer-algebra systems and I'd be surprised if you can't find a Haskell implementation that suits you.

EDIT to clarify for OP: I do not propose generating infinite loops. Lazy evaluation allows you to write programs (or functions) which simulate infinite series, programs which themselves are finite in time and space. With such languages you can determine many of the properties, such as convergence, of the simulated infinite series with considerable accuracy and some degree of certainty. Try Mathematica or, if you don't have access to it, try Wolfram Alpha to see what one system can do for you.

like image 65
High Performance Mark Avatar answered Sep 22 '22 11:09

High Performance Mark


One place to look might be the Wikipedia category of Computer Algebra Systems.

like image 29
John Avatar answered Sep 23 '22 11:09

John