Skip to content
Advertisement

Geometric series: calculate quotient and number of elements from sum and first & last element

Creating evenly spaced numbers on a log scale (a geometric progression) can easily be done for a given base and number of elements if the starting and final values of the sequence are known, e.g., with numpy.logspace and numpy.geomspace. Now assume I want to define the geometric progression the other way around, i.e., based on the properties of the resulting geometric series. If I know the sum of the series as well as the first and last element of the progression, can I compute the quotient and number of elements?

For instance, assume the first and last elements of the progression are a0 and an and the sum of the series should be equal to sn. I know from trial and error that it works out for n=9 and r≈1.404, but how could these values be computed?

Advertisement

Answer

You have to solve the following two equations for r and n:

a:= An / Ao = r^(n - 1)

and

s:= Sn / Ao = (r^n - 1) / (r - 1)

You can eliminate n by

s = (r a - 1) / (r - 1)

and solve for r. Then n follows by log(a) / log(r) + 1.


In your case, from s = 50 and a = 15, we obtain r = 7/5 = 1.4 and n = 9.048...

It makes sense to round n to 9, but then r^8 = 15 (r ~ 1.40285) and r = 1.4 are not quite compatible.

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement