# Plotting a Taylor series of Partial sum

Hi people,

I want to plot the partial sum from n=0 to n =6 with the given function f about the point a=0 (just the maclaurin series). Unfortunately, I am unable to make sense of the issue M'tica is highlighting. Could someone give me a leg-up?

Edit:

After nth tries:

Does this output looks sensible?

• In your sum function, $k$ should range from $0$ to $n$ in order to include the $f(0)$ term in your expansion. You can also directly compare what you obtain with the results of Series[f[x], {x, 0, n}] to figure out if you are doing things correctly. You may also be interested in the SeriesCoefficient function. – MarcoB Sep 13 '15 at 14:25
• Best to paste the Mathematica code to make it easy for members to answer. Your answer is fine but the derivative needs to be evaluated at x = 0. So use D[f[x], {x, k}] /. x -> 0 in your expression. – Jack LaVigne Sep 13 '15 at 14:35

it's such a long time ago, I learned Taylor and so on. If my memory serves me right:

s = Sum[D[f[x0], {x0, k}]/k! (x - x0)^k, {k, 0, n}];
ps = Table[s /. x0 -> 0, {n, 1, 4}] // Simplify

{3 π x, 3 π x, 3 π x - (9 π^3 x^3)/2, 3 π x - (9 π^3 x^3)/2}


With Mathematicas Series we get

Series[f[x], {x, 0, #}] & /@ Range[1, 4] // Normal

{3 π x, 3 π x, 3 π x - (9 π^3 x^3)/2, 3 π x - (9 π^3 x^3)/2}

Plot[Evaluate@ps /. x0 -> 0, {x, -1, 1}]


• @belisarius Danke! Thanks. – user31001 Sep 13 '15 at 14:43