# E001: Taylor Error Landscapes ```{figure} ../_static/experiments/e001_hero.png :width: 80% :alt: Preview figure for E001 ``` ```{figure} ../_static/experiments/e001_hero_0.png :width: 80% :alt: Preview figure for E001 ``` ```{figure} ../_static/experiments/e001_hero_1.png :width: 80% :alt: Preview figure for E001 ``` ```{figure} ../_static/experiments/e001_hero_2.png :width: 80% :alt: Preview figure for E001 ``` **Tags:** `analysis`, `quantitative-exploration`, `visualization`, `numerics`, `taylor` See: {doc}`../tags`. ## Goal Build intuition for Taylor truncation error by visualizing the absolute error landscape $|\sin(x) - T_n(x; x_0)|$ over a domain while varying: - the polynomial degree $n$, - the expansion center $x_0$. ## Background (quick refresher) If you want a short mathematical recap first, read: {doc}`../background/taylor-series`. ## Research question How does the approximation error of Taylor polynomials for $\sin(x)$ depend on the polynomial degree $n$ and the expansion center $x_0$, over a fixed domain of $x$? Concretely: for a chosen grid of $(n, x_0)$, what does the error landscape $E_{n,x_0}(x)=|\sin(x)-T_n(x;x_0)|$ look like, and where do numerical artifacts start to dominate the truncation error? ## Why this qualifies as a mathematical experiment This page is not just a worked example or a derivation — it is an *experiment* in the sense of **experimental mathematics**: a finite, reproducible procedure that produces **evidence** about how a mathematical object behaves. For E001, the object is the family of Taylor polynomials $T_n(x; x_0)$ for $\sin(x)$, and the observable is the error function $E_{n,x_0}(x) = |\sin(x) - T_n(x; x_0)|$. The experiment qualifies because it: - **Explores a parameter space:** it varies degree $n$ and center $x_0$ and inspects how the entire error landscape changes. - **Generates testable conjectures:** e.g. “there is a widening low-error region around $x_0$ as $n$ increases” and “improvement is not uniform across a fixed interval”. - **Searches for failure modes / edge cases:** large $|x-x_0|$, high degrees, and wide domains can expose numerical artifacts that *look* like truncation error but are actually floating-point limitations. - **Produces artifacts that can be checked independently:** plots and parameter snapshots make it easy to compare runs, reproduce the same conditions, and verify that an observed pattern is not accidental. The goal is to turn “Taylor series should be good near $x_0$” into *structured evidence* about **where** and **how** the approximation is good (or bad), which then informs what one would try to prove or bound formally. - How does the truncation error $|\sin(x) - T_n(x; x_0)|$ behave as we move away from the center $x_0$? - How many terms are needed to achieve a specific precision (e.g., $10^{-6}$) over a fixed interval? - Does increasing the degree $n$ always improve the result everywhere in the domain? ## Experiment design - **Target function:** $\sin(x)$ - **Evaluation:** $x \in [-2\pi, 2\pi]$ (default) - **Parameters:** - `degrees`: $\{1, 3, 5, 7, 9\}$ - `centers`: $\{0, \pi/2, \pi\}$ - **Outputs:** - Plot of $f(x)$ vs. $T_n(x)$ - Semi-log plot of $|f(x) - T_n(x)|$ ## How to run ```bash make run EXP=e001 ARGS="--seed 1" ``` Artifacts are written under `out/e001/` (figures, parameters, and a short `report.md`). ## What to expect Qualitatively (and this is what the plots should confirm): - near $x_0$, the higher degree reduces the error quickly, - away from $x_0$, the approximation can degrade even for higher degrees, - changing $x_0$ shifts the “low-error region”. ## Results After running the experiment, include (or regenerate) the figures in the documentation. The canonical output location is `out/e001/`. For publishing, copy one representative “hero” image into `docs/_static/experiments/` (see “Gallery images” below). ## Notes / pitfalls - Use **log-scale** for absolute error plots to see the full dynamic range. - Be careful interpreting relative error near zeros of $\sin(x)$. - Huge domains and high degrees can expose floating-point artifacts that are not truncation error. ## Extensions - **Alternative functions:** Repeat the experiment for $exp(x)$ or $1/(1-x)$. - **Relative error:** Plot $|(f-T_n)/f|$ instead of absolute error. - **Automatic degree selection:** Find the minimal $n$ such that error $< \epsilon$ on a given interval. ## Gallery images (recommended) To keep the experiment gallery attractive and stable: 1. run the experiment locally, 2. pick one representative output figure, 3. copy it into the repo under: `docs/_static/experiments/e001_hero.png` This allows the docs to show thumbnails without depending on generated `out/` artifacts. ## Published run snapshot If this experiment is included in the docs gallery, include the published snapshot (report + params). ```{include} ../reports/e001.md :start-after: "" :end-before: "" ``` ::: {dropdown} params.json (snapshot) :open: ```{literalinclude} ../params/e001.json :language: json ``` ::: ## References See {doc}`../references`. {cite:p}`BaileyBorwein2005ExperimentalMathematics,Borwein2005ExperimentalMathematician,BorweinBailey2008MathematicsByExperiment` ## Related experiments - {doc}`e082` (E082: Zeta(s) series convergence) - {doc}`e083` (E083: Series vs. Euler product (ζ)) - {doc}`e084` (E084: |ζ(1/2+it)| growth snapshots) - {doc}`e085` (E085: Dirichlet eta acceleration for ζ(s)) - {doc}`e086` (E086: Hardy Z(t) near zeros)