lqsuares module



On 5/20/07, Jussi Eloranta <Jussi.Eloranta at csun.edu> wrote:

> 2) I decided to hack the lsquares module a bit in order to use it with
> BFGS and have a nicer output from it. The behavior can be controlled
> with parameter settings (see the modified lsquares.mac attachment). The
> default is to do things the old way (to be compatible with earlier apps).
> More specifically, it is now possible to get the fitted function and the
> parameters separately as a list.

Jussi, thanks for your message. Looking over lsquares.mac,
I believe it can be simplified quite a lot. Some things come to mind.
(1) Preserving the calls to solve and mnewton isn't important.
At the time lsquares was written, Maxima didn't have any better
way of solving minimization problems, now there is lbfgs.
(There are also specialized methods for least squares problems,
but Maxima doesn't include any of those yet.)
(2) I don't like putting print messages into the body of a function.
In various interesting scenarios, there is no one at the console.
Also, once the messages go by, they are lost (you don't see them
again by displaying the return value again.)
(3) Other functions for solving equations return just a list
like [x = ..., y = ..., z = ...] (and not an equation with those
values substituted). I believe lsquares should do likewise.

Solving least squares problems is an important application,
so we should fix up lsquares. Thanks for bringing this to our
attention. I'll put it on my to-do list.

All the best,
Robert Dodier