# [Maxima] Exponential fitting with lsquares

Jose A. Vallejo jose.a.vallejo at prodigy.net.mx
Sat May 23 02:07:33 CDT 2009

```Hi there!
I'm trying to make a script for a calculus class. I want to
introduce exponential fittings, and I use the example of USA
population growth, defining:

>> 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]
)\$

It is easy to find the linear fitting:

>> lsquares_estimates(M,[x,y],y=m*x+n,[m,n])\$

Substituting the returned values of m and n, we can compute
y(2009) to see if the approximation predicts USA actual
population. We see it doesn't, and this motivates to
consider an exponential fitting. Here I have a problem: I
try to use lsquares_estimates_approximate, in the form
(I do know that a good fitting is provided by
y=2*10^(-9)*exp(0.01*x), this is the reason for the initial
guess):

>> mse:lsquares_mse(M,[x,y],y=a*exp(b*x));
>> lsquares_estimates_approximate(mse,[a,b],initial=[0.0001,1],iprint=[-1,
>> 0]);

The result I get is:

Maxima encountered a Lisp error:

NTH: T is not a list
Automatically continuing.
To reenable the Lisp debugger set *debugger-hook* to nil.

With a 0.999-probability I'm doing some stupid thing...
Could someone offer some help?
Thanks in advance!
___________________________________
José Antonio Vallejo Rodríguez
Departamento de Matemáticas
Facultad de Ciencias UASLP
Lat. Av. Salvador Nava s/n
78290 San Luis Potosí (México)
http://galia.fc.uaslp.mx/~jvallejo/
email: jvallejo at fciencias.uaslp.mx
___________________________________

```

More information about the Maxima mailing list