Task 02

Task 02ΒΆ

deadline: 07/03/2021 23:59 CET

[0.5 points]: Write a function that takes \( n \in \mathbb{N}_0 \) as an argument and returns the first \( n \) terms of the Maclaurin series of the function \( \sin{x} \),

\[ \sum_{k = 0}^{n} \frac{(-1)^k}{(2 k + 1)!} x^{2k + 1} \]

in the form of numpy.poly1d (in order to evaluate the factorial, you may use the function scipy.special.factorial).

[0.25 points]: Write a function that calculates the relative error of the function above for arbitrary point \( x \in \mathbb{R} \) and \( n \in \mathbb{N}_0 \). Print the relative error for \( x = \pi \, / \, 2 \) and \( n = 2\) on 16 decimal places.

[0.25 points]: Find \( n \) for which the relative error at \( x = \pi \, / \, 2 \) is less than \( 200 \, \varepsilon \), where \( \varepsilon \) is the machine epsilon of the 64-bit representation of IEEE floating point numbers. Print that number.

# add your code here