sin x を多項式で近似する

Clear[f]

f[x_] = Sin[x]

D[f[x], {x, 3}] /. x -> 0

Clear[c]

c[k_, a_] = D[f[x], {x, k}]/k! /. x -> a

c[2, 3]

Clear[P]

P[x_, n_, a_] = Sum[c[k, a] (x - a)^k, {k, 0, n}]

P[x, 5, Pi]

Clear[K]

\(K[n_, a_, m_] := 
      Plot[{f[x], P[x, n, a]}, {x, a - m, a + m}, 
        PlotStyle -> {Hue[0.0], 
			Hue[0.7]}, 
        PlotRange -> {\(-3\), 3}]\)

K[7, 0, 2*Pi]

Do[K[i, 0, 3*Pi], {i, 1, 20, 2}]

Do[K[i, Pi, 2*Pi], {i, 1, 20, 2}]