I've been encountering a problem while trying to use the method of least squares to fit a quadratic polynomial. Below is the question
1) Use the method of least squares to fit a quadratic polynomial (y=a$_{0}$+a$_{1}x$+$a_{2}$x$^{2}$) to the given data. Here is the data (-1.1,-2.1),(-.3,-.9),(.9,.1),(1.6,1.1),(2.3,1.8). I had no problem getting it to fit a linear model by using Maple's "Curve Fitting" package. However when I go to try and get it to fit a quadratic polynomial it keeps giving me an error that reads
"Error, (in CurveFitting:-LeastSquares) curve to fit is not linear in the parameters"
My code is as follows
LeastSquares([[-1.1, -2.1], [-.3, -.9], [.9, .1], [1.6, 1.1], [2.3, 1.8]], v, curve = av^2+bv+c)
I'm very confused as to why this keeps occuring. I tried looking it up on the maple website for help and followed their example and everything worked out fine. I'm curious as to why mine is not working out. As always any help is always appreciated.
Your difficulty is because you forgot the multiplication sign between
aandv^2, and betweenband `v.Note that variable names in Maple are not restricted to a single character. They can be names of several characters.
As you have it, Maple is seeing variables named
avandbv. And your model is not linear in the parameters in that case, since it contains(av)^2which is the square of the parameterav.So use
a*v^2+b*v+cinstead as your model expression for thecurveoption.