# Plotting the difference between an exponential and its Taylor expansion as a function of number of terms?

I'm terribly green, please forgive me. I need to plot the difference between a chosen calculated Taylor expansion

$$e^x=1+x+\frac {x^2}{2!}+\frac {x^3}{3!}+\frac {x^4}{4!}+\frac {x^5}{5!}$$...

and the true value of $$e^x$$ as a function of the number of terms included. I'm excited to work through this but am unsure how to beyond choosing $$e^{-3x}≈1-3x+\frac {9x^2}{2}-\frac {9x^3}{2}+\frac {27x^4}{8}-\frac {81x^5}{40}$$ and knowing that I need to plot the difference between this and $$e^{-3x}$$ as a function of 6. I'd like to have a higher number of terms. I'm going to begin by figuring out how to plot functions in general. Any help would be appreciated, particularly with plotting differences of functions.

• I suggest you first try to plot $\exp(\alpha x)$ vs. x; and in the same graph plot the partial sums, $f_0(x)=1$, $f_1(x)=1+\alpha x$ etc. There you will see at what $x$ each partial sum starts deviating from the exponential. – Maxim Umansky Jun 12 '20 at 21:48