piecewise linear approximation

This is the simplest form of piecewise polynomial interpolation. In each of the subintervals [Maple Math] one construct the line segment between ( [Maple Math] ) and ( [Maple Math] ). For example:

[Maple Plot]

Which is generated by the MapleV commands:

> f:=x->3-x^2*x^2-x^3:

> x[0]:=-1:x[1]:=-0.5:x[2]:=0:x[3]:=0.2:x[4]:=0.4:x[5]:=0.6:x[6]:=0.8:x[7]:=1:

> pl0:=plot(f(x),x=-1..1):

> with(plots):y[0]:=f(x[0]): for i from 1 to 7 do y[i]:=f(x[i]); flin[i]:=xx->y[i-1]+(xx-x[i-1])*(y[i]-y[i-1])/(x[i]-x[i-1]): pl.i:=plot(fl[i](xx),xx=x[i-1]..x[i],color=black): od:

> ll:=[]:for i from 0 to 7 do ll:=[op(ll),[x[i],y[i]]]: od:

> ### WARNING: the definition of the type `symbol` has changed'; see help page for details
pl8:=plot(ll,style=point,symbol=diamond,color=blue):

> display({pl.(0..8)});

With a proper choice of data points, and a sufficient number of them, very good approximations can be obtained.

However, as you can see in the example, the linear piecewise polynomial approximation is not a smooth function, and is not necessarily differentiable at the data points. This is often required from the physics of the data.