maths.series.p_series¶
This is a pure Python implementation of the P-Series algorithm https://en.wikipedia.org/wiki/Harmonic_series_(mathematics)#P-series For doctests run following command: python -m doctest -v p_series.py or python3 -m doctest -v p_series.py For manual testing run: python3 p_series.py
Attributes¶
Functions¶
|
Pure Python implementation of P-Series algorithm |
Module Contents¶
- maths.series.p_series.p_series(nth_term: float | str, power: float | str) list[str] ¶
Pure Python implementation of P-Series algorithm :return: The P-Series starting from 1 to last (nth) term Examples: >>> p_series(5, 2) [‘1’, ‘1 / 4’, ‘1 / 9’, ‘1 / 16’, ‘1 / 25’] >>> p_series(-5, 2) [] >>> p_series(5, -2) [‘1’, ‘1 / 0.25’, ‘1 / 0.1111111111111111’, ‘1 / 0.0625’, ‘1 / 0.04’] >>> p_series(“”, 1000) [‘’] >>> p_series(0, 0) [] >>> p_series(1, 1) [‘1’]
- maths.series.p_series.nth_term¶