MAT 331, Fall 1997
Project 1: Least-Squares Fitting
Due October 20/21
In this project, you should write a paper explaining and illustrating the very common method of fitting a curve to experimental data known as least-squares. Your paper should outline the basic theory, and give several examples (as suggested below, although you are free to add other ones). It should be complete and self-contained, going over all the necessary background material. In going over the examples, you should include the corresponding work from maple sessions. Please pay attention to organization, sentence structure, and so on. You will be graded on both the quality of your mathematical exposition and on the correctness of your computer work.
Recall that in least squares fitting, you have a collection of data points
which are believed to approximate some functional
relationship. In this project, you may stick to points in the plane,
although the process works the same for points in
.
In the most common situation, this functional relation is linear, that is,
of the form , where m and b are constants to be
determined, and the
are assumed to be known exactly while the
have some (unknown) amount of error.
In your paper, you should review the theory for this setup, giving an
explicit example. Use the function line_pts()
from the file
/home/mat331/lsq_data to
generate your data. You should also cover an example where the are
assumed to depend either quadratically or cubically on
(that is,
or
),
but again, the
are assumed to be known exactly.
You should use either
quadratic_pts()
or cubic_pts()
to
generate your data.
The next example you should consider is more unusual: suppose that the
points approximate a circle. You should find the ``best fit''
circle to these points, and describe the process.
Recall that the general equation of a circle centered at (a,b) with a radius of r is
Unlike the previous cases, there is no independent variable.
(Note that we could try to fit
,
but not only would the resulting equations be messy, this would
bias things very badly; do you see
why? You might want to discuss this issue). Nevertheless, we press
on.
One reasonable measure of the distance between the points and a circle is
the ``area difference'', that is
A minor problem with this is that this is not quadratic in a, b,
and r (the degree is 4), and so the resulting equations are not
linear. They are, however, solvable by maple. But also note that if
we let , the resulting functional H(a,b,k) is
quadratic, and differentiating with respect to a, b, and k yields
three linear equations in three unknowns.
Solving these simultaneously gives us the values a, b, and k, and from
which we can readily determine the center and radius. (If you discuss this
approach, you should probably justify why the minimum for G(a,b,r) is the
same as the minimum for H(a,b,k). This is, in fact, true, but it needs to
be shown.)
In your paper, you should discuss this derivation in full, and give
an explicit example. Use circle_pts()
to generate 21 points which
approximate a circle. If you like, you could discuss other possible means
of measuring the distance between a collection of points and a circle.
A third example you should consider is the following:
Suppose the data points are assumed to approximate a line, but
both the x-values and the y-values are approximate. In this case, it
makes sense to minimize the sum of the squares of the shortest distance to
the line, rather than the vertical distance. That is, if (x,y) are points
on the line and
are data points, you should vary the line to
minimize the sum of the quantities
. Note that there
are several (equivalent) ways to represent the line and/or compute the
distance. You should, of course, choose whichever seems best to you.
You are to derive a least-squares fitting method for this case, and illustrate it by an example. Note that it is not possible to obtain linear equations; there will always be two critical points. Only one of them corresponds to the minimum- what is the geometric interpretation of the other one? Be sure to describe the mathematics of what you are doing in sufficient detail.
As always, you may collaborate on your efforts, although your write-up must be your own. Also note that each person should have a different collection of data, since it is generated at random. If you work with others, it would be nice to acknowledge who they are. You can produce your paper in any word-processor you like (or even write it by hand, if your writing is quite legible), or even as a heavily annoted maple worksheet. However, you should include the relevant graphics and maple commands, as needed. These, of course, cannot be handwritten. The entire project should hang together as a single document, rather than as some discussion with a maple session tagged on at the end.