# Exercici 08.7

kill(all)$

## Apartat a)

f(x):=exp(-2*x^2);

taylor(f(x), x, 0, 4);

T4(x):=1-2*x^2+2*x^4$

taylor(f(x), x, 0, 6);

T6(x):=1-2*x^2+2*x^4-(4*x^6)/3$

taylor(f(x), x, 0, 8);

T8(x):=1-2*x^2+2*x^4-(4*x^6)/3+(2*x^8)/3$

taylor(f(x), x, 0, 10);

T10(x):=1-2*x^2+2*x^4-(4*x^6)/3+(2*x^8)/3-(4*x^10)/15$

wxplot2d([f(x), T4(x), T6(x)], [x,-1, 1], [y, -2, 2], 
 [gnuplot_preamble, "set grid;"])$

wxplot2d([f(x), T8(x), T10(x)], [x,-1, 1], [y, -2, 2], 
 [gnuplot_preamble, "set grid;"])$

## Apartat b)

kill(all)$

f(x):=log(1+x^2);

taylor(f(x), x, 0, 4);

T4(x):=x^2-x^4/2$

taylor(f(x), x, 0, 6);

T6(x):=x^2-x^4/2+x^6/3$

taylor(f(x), x, 0, 8);

T8(x):=x^2-x^4/2+x^6/3-x^8/4$

taylor(f(x), x, 0, 10);

T10(x):=x^2-x^4/2+x^6/3-x^8/4+x^10/5$

wxplot2d([f(x), T4(x), T6(x)], [x,-1.5, 1.5], [y, -2, 2], 
 [gnuplot_preamble, "set grid;"])$

wxplot2d([f(x), T8(x), T10(x)], [x,-1.5, 1.5], [y, -2, 2], 
 [gnuplot_preamble, "set grid;"])$

## Apartat c)

kill(all)$

f(x):=1/(1+x^2);

taylor(f(x), x, 0, 4);

T4(x):=1-x^2+x^4$

taylor(f(x), x, 0, 6);

T6(x):=1-x^2+x^4-x^6$

taylor(f(x), x, 0, 8);

T8(x):=1-x^2+x^4-x^6+x^8$

taylor(f(x), x, 0, 10);

T10(x):=1-x^2+x^4-x^6+x^8-x^10$

wxplot2d([f(x), T4(x), T6(x)], [x,-1, 1], [y, -2, 2], 
 [gnuplot_preamble, "set grid;"])$

wxplot2d([f(x), T8(x), T10(x)], [x,-1, 1], [y, -2, 2], 
 [gnuplot_preamble, "set grid;"])$