Regression Analysis Usi
Overview:
we will use Maple
here for several purposes:
1) to graph data and to graph
curves
2) to perform computations
generati
3) to gain an understandi
Part One Plotti
By "data" we mean
isolated points as opposed to continuous curves. For example, we wish to plot the followi
{
(0,1), (1,2), (2,5), (3,10), (5,26) }
We will be worki
>x_val:=[0
, 1, 2, 3, 5 ];
note the use of [ ] s
>y_val:=[1
, 2, 5, 10, 26];
to plot them, we will
build a two dimensional array C as follows:
>> n:=5;
>> for i from 1 to n do C[i]:=[x_val[i],y_val[i]];od;
We next generate a
plot but do not yet display it on the screen. We store this plot in a structure
which we call our_data_plot as follows:
> our_data_plot:=plot([seq(C[i],i=1..n)],style=point):
Note the colon, :, at the end, as
opposed to a semicolon. This suppresses output.
We can now easily see what this looks like on the screen by
usi
>display(our_data_plot);
You should see a
parabolic looki
Next let’s plot a
regular parabola for comparison, say, y = x2+2. This is much easier because it’s a continuous
graph, vs discrete in the earlier case. For reasons that will be clear shortly, we
will do this in two steps:
>parab_graph:=plot(x^2 + 2, x=0..5,color=green,thickness=2 ): note colon
again
> display(parab_graph);
You should see a
nice, smooth parabola drawn in green, fairly thick.
Finally, lets superimpose the two
graphs:
> display( { parab_graph, our_data_plot } ); note
the curly braces {
} which are needed anytime
you plot more than one thi