Alternate Geometric Series ========================== A `Geometric Series `_ is a series summing the terms of an infinite *geometric sequence* in which the *ratio* of consecutive terms is constant. Thus, the *geometric sequence* is an infinite sequence that starts at an *initial term* and each following term is the result of multiplying the previous one by a fixed ratio. For example, if the initial term is :math:`1.0` and the ratio is :math:`2.0`, the resulting gometric sequence is :math:`1.0, 2.0, 4.0, 8.0, 16.0, ...` and the corresponding *geometric series* is the sum of all these terms is infinite. When the ratio belongs to the :math:`(-1.0, 0.0)` interval, the terms have alternate signs and converge to :math:`0.0`. For example, if the initial term is :math:`1.0` and the ratio is :math:`-0.5`, the resulting gometric sequence is :math:`1.0, -0.5, 0.25, -0.125, ...` Our purpose is to compute the sum of the positive terms and the sum of negative ones separately. This must be done up to point when the **difference between the absolute values of two consecutive terms** becomes **neglectible** according to a given tolerance value. That difference is considered neglectible if its absolute value is smaller than the given tolerance. To that goal please implement the following Python function in the :mod:`gseries_alt` module (:file:`gseries_alt.py` file): .. py:function:: gseries_alt(t0, r, eps) such that **given** - ``t0`` :class:`float` such that ``t0 != 0.0`` - ``r`` :class:`float` such that ``-1.0 < r < 0.0`` - ``eps`` :class:`int` such that ``0.0 < eps < 1.0`` **returns** two :class:`float`: the sum of the positive terms and the sum of the negative ones (both rounded to :math:`4` decimals) of the geometric series starting at ``t0`` with ratio ``r`` and a tolerance ``eps``. For example: .. literalinclude:: gseries_alt.test :language: python3 :start-after: --ini :end-before: --fi They are available at the :download:`gseries_alt.test ` file. .. note:: - Using the ``while`` statement is recommended. - The given doctests are not exhaustive.