{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Task 02\n", "\n", "**deadline: 07/03/2021 23:59 CET**" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "**[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} $,\n", "\n", "$$\n", "\\sum_{k = 0}^{n} \\frac{(-1)^k}{(2 k + 1)!} x^{2k + 1}\n", "$$\n", "\n", "in the form of [`numpy.poly1d`](https://numpy.org/doc/stable/reference/generated/numpy.poly1d.html) (in order to evaluate the factorial, you may use the function [`scipy.special.factorial`](https://docs.scipy.org/doc/scipy/reference/generated/scipy.special.factorial.html)).\n", "\n", "**[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.\n", "\n", "**[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." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "\n", "# add your code here\n" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.8.5" } }, "nbformat": 4, "nbformat_minor": 4 }