Computer Algebra

An example exercise in computer algebra, using Maple or Maxima.

David MacKay
A straight line y = mx is to be fitted (by least squares) to a data set that happens to lie uniformly on a circle of radius 1 centred at (1,1). This picture shows the data and the lines for m=1 and m=2/3.

Find the value of m that minimizes the average square distance between the data y value and the y-coordinate of the curve.

Is m=1 optimal?


Solution using maple:
| postscript | maple session file | gif |
Solution using Maxima(aka Macsyma):
| text file

The optimal m is 2/3. Bear this in mind whenever someone uses least squares fitting!

data

David MacKay / mackay@mrao.cam.ac.uk - home page.