The following example is self-explanatory.

>> load(lsquares)$

>> M:matrix(

[1900,75.995],

[1910,91.972],

[1920,105.711],

[1930,123.203],

[1940,131.669],

[1950,150.697],

[1960,179.323],

[1970,203.212],

[1980,226.505],

[1990,249.633],

[2000,281.422]

)$

mse:lsquares_mse(M,[x,y],y=a*exp(b*(x-1900)));

------------------------------------------------------------

The problem appears to be that lsquares_estimates_approximate ignores

the initial value passed to it:

lsquares_estimates_approximate(mse,'[a,b],initial=[82,0.01],iprint=[1,3]);

*************************************************

VECTOR X=

1.000000000000000D+00 1.000000000000000D+00

GRADIENT VECTOR G=

1.313813415094471D+86 1.313813414823674D+88

You can see that the initial vector X is [1,1], although [82,0.01] is passed.

The minimisation diverges because of the poor initial condiition.

If you redefine mse so that [1,1] is a reasonable initial value, you

will get an estimate:

mse:subst([a=82*a,b=0.01*b],mse)$

lsquares_estimates_approximate(mse,'[a,b],iprint=[1,3]);

THE MINIMIZATION TERMINATED WITHOUT DETECTING ERRORS.

IFLAG = 0

[[a = 1.005034579667296, b = 1.243184045872825]]