# Plotting partial sums of Taylor Function

I need to plot the partial function:

$T_f(x)=\log 2+\sum_{k=1}^{\infty}\frac{(-1)^{k+1}}{2^kk}(x-2)^k$

for $n=2$,$n=4$ and $n=6$ on the same plot over the interval $[-\frac{1}{2},4]$ and also the maximum difference between $f$ and these partial sums of $T_f$ in the same interval

And i have no idea how to do it...

• So, you have looked at Table[], Sum[], and Plot[]? – J. M. will be back soon May 19 '15 at 15:30

Log[2] + Sum[(-1)^(k + 1) (x - 2)^k/(k 2^k), {k, 1, Infinity}]


Log[x]

Since Log is complex or unbounded for non-positive argument, the maximum difference is undefined for x <= 0

Log /@ {0, -1/4} // InputForm


{-Infinity, I*Pi - Log[4]}

The maximum difference will be arbitrarily large as x gets arbitrarily close to 0+.

Clear[f]

f[x_, n_] := Log[2] + Sum[(-1)^(k + 1) (x - 2)^k/(k 2^k), {k, 1, n}]

f[x, Infinity]


Log[x]

Plot[Evaluate[Table[f[x, n], {n, {2, 4, 6, Infinity}}]], {x, -1/2, 4},
PlotLegends -> {2, 4, 6, Infinity}] // Quiet