Numerical Analysis I

MATH 345 : Fall 2023

Department of Mathematics - SUNY Geneseo
⇐ Back

Homework 1 - Taylor's Theorem and Errors

Due Date: September 8, 2023

Upload

Problems

  1. Find the third-order Taylor polynomial $P_3(x)$ of the function \(f(x) =(x-1)\ln(x)\) at \(x_0=1\). Use \(P_3(0.5)\) to approximate \(f(0.5)\). Find an upper bound for the error \(|f(0.5)-P_3(0.5)|\) using the remainder term \(R_3(0.5)\) and compare the error to the actual error.
  2. Find the fourth-order Taylor polynomial $P_4(x)$ of the function $f(x) = xe^{x^2}$ at $x_0=0$. Use $P_4(-0.1)$ to approximate $f(-0.1)$. Find an upper bound for the error $|f(-0.1)-P_4(-0.1)|$ using the remainder term $R_4(-0.1)$ and compare the error to the actual error.
  3. The number $e=2.7182818284590451\ldots$ can be defined as $e=\sum_{k=0}^\infty \frac{1}{k!}$. Let $P_n = \sum_{k=0}^n \frac{1}{k!}$. Use Python's math module to obtain the "true" value to the constant $e$.
    1. Compute the absolute and relative error in approximating $e$ with $P_5$.
    2. Compute the absolute and relative error in approximating $e$ with $P_{10}$.
    3. Write pseudocode for an algorithm that outputs the minimum positive integer $N$ such that $|e-P_N|< \varepsilon$ for a given $\varepsilon>0$.
    4. Write a Python script to find $N$ if $\varepsilon=1\times 10^{-2}$. What is $N$ and what is your approximation $P_N$? Print your Python script and include it with your assignment.
  4. Let $f(x) = \cos(x)$ and let $P_n(x)$ be the $n$th order Taylor approximation of $f$ centered at $x_0=0$.
    1. Write pseudocode for an algorithm that outputs the minimum positive integer $N$ such that $|f(z) - P_N(z)|<\varepsilon$ for some given $\varepsilon>0$ and $z$. Your pseudocode should contain explicit steps on how the approximation $P_N(z)$ is computed, and thus you will need to know the general form of $P_n(x)$.
    2. Write a Python script to determine $N$ when $z=9.4248$ and $\varepsilon = 1\times 10^{-4}$. What is $N$? What is your approximation? Print your algorithm and include it with your assignment. Note that $z\approx 3\pi$.
    3. Repeat with $z=15.7080$ and $\varepsilon=1\times 10^{-4}$. Note that $z\approx 5\pi$.