maths.series.harmonic_series

This is a pure Python implementation of the Harmonic Series algorithm https://en.wikipedia.org/wiki/Harmonic_series_(mathematics)

For doctests run following command: python -m doctest -v harmonic_series.py or python3 -m doctest -v harmonic_series.py

For manual testing run: python3 harmonic_series.py

Attributes

nth_term

Functions

harmonic_series(→ list)

Pure Python implementation of Harmonic Series algorithm

Module Contents

maths.series.harmonic_series.harmonic_series(n_term: str) list

Pure Python implementation of Harmonic Series algorithm

Parameters:

n_term – The last (nth) term of Harmonic Series

Returns:

The Harmonic Series starting from 1 to last (nth) term

Examples: >>> harmonic_series(5) [‘1’, ‘1/2’, ‘1/3’, ‘1/4’, ‘1/5’] >>> harmonic_series(5.0) [‘1’, ‘1/2’, ‘1/3’, ‘1/4’, ‘1/5’] >>> harmonic_series(5.1) [‘1’, ‘1/2’, ‘1/3’, ‘1/4’, ‘1/5’] >>> harmonic_series(-5) [] >>> harmonic_series(0) [] >>> harmonic_series(1) [‘1’]

maths.series.harmonic_series.nth_term