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).
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.
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.
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.
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.
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.
One place to look might be the Wikipedia category of Computer Algebra Systems.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With