Exercício 4.2

> X:=vector(2,[2.4,2.6]);
fX:= vector(2,[0.510423,0.481345]);
p1x:=Lagrange(X,fX);
p1:=x->p1x:
plot(p1(x),x=2.4..2.6,title="Polinómio interpolador de Lagrange de grau 1");
LagrangePt(2.5,X,fX);

[Maple Math]

[Maple Math]

[Maple Math]

[Maple Plot]

[Maple Math]

> X:=vector(3,[2.2,2.4,2.6]);
fX:= vector(3,[0.520789,0.510423,0.481345]);
p2x:=Lagrange(X,fX);
p2:=x->p2x:
plot(p2(x),x=2.2..2.6,title="Polinómio interpolador de Lagrange de grau 2");
LagrangePt(2.5,X,fX);

[Maple Math]

[Maple Math]

[Maple Math]

[Maple Plot]

[Maple Math]

> X:=vector(4,[2.2,2.4,2.6,2.8]);
fX:= vector(4,[0.520789,0.510423,0.481345,0.435912]);
Lagrange(X,fX);
p3x:=Lagrange(X,fX):
p3:=x->p3x:
plot(p3(x),x=2.2..2.8,title="Polinómio interpolador de Lagrange de grau 3");
LagrangePt(2.5,X,fX);

[Maple Math]

[Maple Math]

[Maple Math]

[Maple Plot]

[Maple Math]

> X:=vector(5,[2,2.2,2.4,2.6,2.8]);
fX:= vector(5,[0.510373,0.520789,0.510423,0.481345,0.435912]);
p4x:=Lagrange(X,fX);
p4:=x->p4x:
plot(p4(x),x=2..2.8,title="Polinómio interpolador de Lagrange de grau 4");
LagrangePt(2.5,X,fX);

[Maple Math]

[Maple Math]

[Maple Math]
[Maple Math]

[Maple Plot]

[Maple Math]

> plot([p1(x),p2(x),p3(x),p4(x)],x=2..2.8,color=[red,black,blue,green]);

[Maple Plot]

> plot([p1(x),p2(x),p3(x),p4(x)],x=2.4..2.6,color=[red,black,blue,green]);

[Maple Plot]

> plot([p1(x),p2(x),p3(x),p4(x)],x=2.49..2.51,color=[red,black,blue,green]);

[Maple Plot]