Raymond and Robert.
Thanks a lot for your help.
lsquares_estimates_approximate worked fine!!
I send my data to be fitted to a Murrell-Sorbie potential,
in case they could help to fix a bug in solve, as suggested by Raymond.
This works:
**************************
load(lsquares);
fpprintprec: 8$
M2: matrix([-.84520548,1.5615488],
[-.54520548,-.098100641], [-.34520548,-.59556932],
[-.24520548,-.72154333],[-.14520548,-.79169693],
[-.045205479,-.82071176],[.054794521,-.82014655],
[.15479452,-.79897371],[.25479452,-.76407431],
[.35479452,-.72063161],[.65479452,-0.5724966],
[1.1547945,-.35757458],[2.1547945,-.13817049],
[3.1547945,-.073458495],[4.1547945,-.040226856]);
pol2: 1+a1*x+a2*x^2+a3*x^3+a4*x^4$
MSfun: -De*(pol2)*exp(-a1*x);
mse: lsquares_mse(M2,[x,y],y=MSfun);
lsquares_estimates_approximate(mse, [De,a1,a2,a3,a4], initial=[1, 1, 1, 1, 1] ,tol=1e-8);
par_set: float(%[1]);
lsquares_residual_mse(M2,[x,y], y=MSfun , par_set);
*****************************
Results: (%o9)
parameters -----> [[De=.82575747,a1=1.7098024,a2=-.10775012,a3=-.0070734046,a4=.14074931]]
mse ------> 2.00721708*10^-5
*******************************
With the same data, this didn't work:
lsquares_estimates(M2, [x,y], y=MSfun , [De,a1,a2,a3,a4], initial=[1, 1, 1, 1, 1] ,tol=1e-6);
Best !!
Pepe
________________________________________________________________
Jose Sanchez-Marin.
Universitat de Valencia.
Spain e-mail: Jose.Sanchez at uv.es
_________________________________________________________________