> | with(CurveFitting); |
(1) |
> | with(plots): |
> | seq( [x, x/2], x=0..4); |
(2) |
> | stuff:=[ seq( [x, x/2], x=0..4), [5,3], seq( [x, x/2], x=6..10)] ; |
(3) |
> | plot(stuff, x=0..10, style=point,symbolsize=18, scaling=constrained); |
> | polly:=PolynomialInterpolation(stuff, x); |
(4) |
> | display(
plot(stuff, x=0..10, style=point,symbolsize=18, scaling=constrained), plot(polly, x=0..10, color=blue)); |
> | ?piecewise |
> | cracker:=piecewise( 4<x and x<5, x-2, 5 <= x and x < 6, 3, x/2); |
(5) |
> | display(
plot(stuff, x=0..10, style=point,symbolsize=18, scaling=constrained), plot(polly, x=0..10, color=yellow), plot(cracker, x=0..10, color=black)); |
> | pirate:=Spline(stuff, x, degree=1); |
(6) |
> | plot([cracker, pirate],x=0..10); |
> | swashbuckler:=Spline(stuff, x); |
(7) |
> | plot([cracker,swashbuckler],x=0..10,color=[red,blue]); |
> | display( [seq(
plot(Spline( stuff, x, degree=i), x=-1..11), i=1..5)]); |
> | plot( [seq(Spline( stuff, x, degree=i), i=1..10)], x=-1..11,thickness=2); |
> |
> |