Infinite series in Julia

What is the standard approach for computing an infinite series in Julia?

Define the sequence of partial sums: s_{N} \equiv \sum_{j=1}^{N} f(j)
In Julia this is: s(N) = sum(f, 1:N)

The only way I know is to either compute s(N) for a large N and to observe whether the sequence of partial sums is converging to the limit.

  1. Is there a better way to do this? (exploit different types of convergence tests etc…)
  2. Will Symbolics.jl be useful here?
1 Like

I think Richardson.jl might do what you want, you can use it to try and find the value of the sum numerically. Using sympy is also a fine option.

2 Likes

Thanks, so:

  1. Richardson.jl is one pkg that computes limits in general, and numerical sums equal the limit of the sequence of partial sums…
    Are there other good pkgs for numerical limits, or is this the main one? (I never used it)
  2. for symbolic limits, we can use our favorite symbolic pkg …

I wonder if this is worth integrating w/ InfiniteArrays.jl so we can write sum(f, 1.0:1.0:+∞) etc?

Calculating the sum directly without any series acceleration techniques probably wont be the best thing. In my experience Richardson.jl is the package that is normally recommended for calculating limits numerically. See this this thread for example.

1 Like

Note that Richardson.jl only implements one particular algorithm (which tends to work well for sums of rational functions) for series extrapolation.

There are many other possibilities (a few are listed here under “Methods”). It would be nice to have more implemented in Julia.

4 Likes

Taking a look I found this GitHub - MikaelSlevinsky/SequenceTransformations.jl: Julia package for manipulating sequences and series .It has some other algorithms but I have never used it.

Thanks for the reference.
Would it be best for these alternative algorithms to go into different packages, or the rename Richardson.jl into something more general and include these alternative algorithms together?