I can't estimate the parameters of a function when the data have been generated with rk.
I attach a wxMaxima file. The commands are below
The first pass is taken from Woollett. In this case lsquares_estimates works as expected.
dataL : [ [1,1], [2,7/4], [3,11/4], [4,13/4]]$
dataM : apply('matrix, dataL)$
dataM;
load(lsquares)$
lsquares_estimates(dataM, [x, y], y = a+b*x^c, [a,b,c],initial=[0,1,1], iprint=[-1,0]);
Next, I create some data using rk. As far as I can see, the data matrix is well-behaved, but lsquares_estimates now generates an error message.
kill(all)$
w:2*%pi$ w0:1.5*w$ b:w0/4$ g:1.5$ phi0:-%pi/2$
data6a: rk( [y,-2*b*y-w0*w0*sin(x) + g*w0*w0*cos(w*t)], [x,y], [phi0,0], [t, 0, 20*%pi/w, 1])$
data6b: rk([y,-2*b*y-w0*w0*sin(x) + g*w0*w0*cos(w*t)], [x,y], [phi0+0.01,0], [t, 0, 20*%pi/w, 1])$
data6a: data6a, numer$ data6b: data6b, numer$
logDx: makelist(log(abs(data6a[i][2]-data6b[i][2])), i,1,11)$
tList: makelist(t,t,1,11)$ dataD: transpose(matrix(tList,logDx));
lsquares_estimates(dataD, [time, lDx], lDx = a+b*time, [a,b], initial=[1,1], iprint=[-1,0]);
Next I recreate the Woollett exercise, getting error messages.
dataL : [ [1,1], [2,7/4], [3,11/4], [4,13/4]]$
dataM : apply('matrix, dataL);
load(lsquares)$
lsquares_estimates(dataM, [x, y], y = a+b*x^c, [a,b,c], initial=[0,1,1], iprint=[-1,0]);
Finally, I execute kill(all)$ and recreate the Woollett exercise. Now lsquares_estimates works.
kill(all)$
dataL : [ [1,1], [2,7/4], [3,11/4], [4,13/4]]$
dataM : apply('matrix, dataL)$
load(lsquares)$
lsquares_estimates(dataM, [x, y], y = a+b*x^c, [a,b,c],
initial=[0,1,1], iprint=[-1,0]);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: lsquares.wxm
Type: application/octet-stream
Size: 2498 bytes
Desc: lsquares.wxm
URL: <http://www.math.utexas.edu/pipermail/maxima/attachments/20120216/568224d3/attachment.obj>