Taylor expansion and approximation with Taylor polynomials of functions, including a cubic function (y=(x+1)*(x-1)^2=x^3-x^2-x+1), sine, cosine, as well as their relative error.
For more on the small-angle approximation, please see the “Taylor expansion” tag . For more on the pendulums, please see the “pendulum” tag.
Edit and compile if you like:
% Author: Izaak Neutelings (November 2020)\documentclass[border=3pt,tikz]{standalone}\usepackage{amsmath} % for \dfrac\usepackage{physics,siunitx}\usepackage{tikz,pgfplots}\usepackage[outline]{contour} % glow around text\contourlength{1.0pt}\usetikzlibrary{angles,quotes} % for pic (angle labels)\usetikzlibrary{arrows.meta}\usetikzlibrary{decorations.markings}\tikzset{>=latex} % for LaTeX arrow head\usepackage{xcolor}\colorlet{xcol}{blue!60!black}\colorlet{myred}{red!85!black}\colorlet{myblue}{blue!80!black}\colorlet{mycyan}{cyan!80!black}\colorlet{mygreen}{green!70!black}\colorlet{myorange}{orange!90!black!80}\colorlet{mypurple}{red!50!blue!90!black!80}\colorlet{mydarkred}{myred!80!black}\colorlet{mydarkblue}{myblue!80!black}\tikzstyle{xline}=[xcol,thick]\tikzstyle{Tline}=[line width=0.6]\tikzstyle{width}=[{Latex[length=5,width=3]}-{Latex[length=5,width=3]},thick]\def\tick#1#2{\draw[thick] (#1)++(#2:0.12) --++ (#2-180:0.24)}\def\N{100} % number of samples\begin{document}% POLYNOMIAL% y = (x+1)*(x-1)^2% = x^3-x^2-x+1\begin{tikzpicture}\message{^^JPolynomial}\def\a{(0.5*\xmax)} % root\def\A{(0.67*\ymax)} % amplitude\def\xmax{2.8} % max x axis\def\ymax{1.7} % max y axis
Click to download: taylor_expansion.tex • taylor_expansion.pdf
Open in Overleaf: taylor_expansion.tex