Inverse Powers¶
Let’s consider the inverse powers mathematical sequence of a given number \(n\) which is defined as:
\[p_i = \frac{1}{n^i}, i \geq 0\]
Implement the following Python function in the invpow module (file invpow.py):
For exemple:
>>> round(invpow(1.1, 1e-2), 4) 9.9847 >>> round(invpow(1.1, 1e-4), 4) 10.9895 >>> round(invpow(2, 1e-1), 4) 1.875 >>> round(invpow(2, 1e-3), 4) 1.998 >>> round(invpow(3.3, 1e-2), 4) 1.4311 >>> round(invpow(3.3, 1e-10), 4) 1.4348
Doctests are available at the invpow-test.txt file.