Series

In this notebook we'll plot some of the series approximations to functions that you've derived in the lectures and the homework.

sin(x)

The Taylor expansion of $sin (x)$ about $x = 0$ can be written as $$ \sin (x) = \sum_{n=0}^N \frac{(-1)^n}{(2n + 1)!} x^{2n + 1} .$$ Below we plot this for different upper limits of the sum, $N$. We can see that as we include more terms, the approximation becomes better and better even for $x$ values much larger than $0$.

Geometric Series

Next, we look at the geometric series $$\frac{1}{1-x} = \sum_{n=0}^N x^n .$$ If $|x| < 1$ then each term in the series is smaller than the last and this will converge, but the expansion breaks down quickly for $|x| > 1$ (try it out!).

Binomial Series

Finally, we consider the binomial series. Scipy has a built in method for computing the binomial coefficients, making the plotting very easy. $$(1+x)^\alpha = \sum_{n=0}^{\infty} \begin{pmatrix} \alpha \\ n \end{pmatrix} x^n .$$ Once again, this only converges for $|x| < 1$. Try changing $\alpha$ and see how well the approximation works for different powers.