Exercício 4.29

> Digits:=10:

> f:=t->exp(cos(t));
plot(f(t),t=0..2*Pi,axes=boxed,color=blue);
fplot:=%:

[Maple Math]

[Maple Plot]

> n:=2:
tj:=vector(2*n+1,j->evalf(2*(j-1)*Pi/(2*n+1)));
ftj:=vector(2*n+1,j->f(tj[j]));

[Maple Math]

[Maple Math]

> with(plots):
A:=pointplot({seq([tj[i],ftj[i]],i=1..2*n+1)},axes=BOXED,symbol=circle):
display(A);

[Maple Plot]

> a[0]:=evalf(2/(2*n+1)*sum(ftj[i+1],i=0..2*n));

[Maple Math]

> for k from 1 to n do
a[k]:=evalf(2/(2*n+1)*sum(ftj[i+1]*cos(k*tj[i+1]),i=0..2*n));
b[k]:=evalf(2/(2*n+1)*sum(ftj[i+1]*sin(k*tj[i+1]),i=0..2*n));
od;

[Maple Math]

[Maple Math]

[Maple Math]

[Maple Math]

> k:='k':
p2:=a[0]/2+sum(a[k]*cos(k*t)+b[k]*sin(k*t),k=1..n);

[Maple Math]
[Maple Math]

> with(student):

> p2t:=makeproc(p2,t);
plot(p2t(t),t=0..2*Pi,title="Polinómio trigonométrico de 2º grau");
pplot:=plot(p2t(t),t=0..2*Pi):

[Maple Math]
[Maple Math]

[Maple Plot]

> display(A,pplot,fplot);

[Maple Plot]