Minpack added for solving non-linear equations and non-linear least-squares
Subject: Minpack added for solving non-linear equations and non-linear least-squares
From: Žiga Lenarčič
Date: Mon, 19 Jan 2009 17:56:23 +0100
Hi!
Nice to see minimisation in maxima finally. I would like to stress
the importance of proper maxima-level interface to minpack. In the
past Andrej V. tried to do a simple interface to quadpack routines,
but somehow mailing list couldn't agree on the name, so maxima still
has no interface to numerical integration functions.
Hopefully this will not be the case this time.
In my opinion the underlying method names and routine names should be
hidden to the user. Maxima level function should be named by "what
they do", not "what method they use". So I'm in favour of functions
"find_minimum" rather than "minpack_minimize" or something along
those lines. The user should call an appropriately named function
(this goes for quadpack also), which should then decide which method
will be called. Ofcourse user has also the option to choose the
method and set options if he wants to, but an usable soultion should
be found with a simple function call.
Sometime ago, some debated, what's the purpose of numerical
subroutines in a CAS like maxima. for non-perfomnace cricitcal
operations (like model fitting, numerical ode integration, numerical
quadrature ... - single calls of course) a CAS like maxima enables
the user to formulate the problem in a straightforward way, while the
CAS abilities can then transform the problem into a form, suitable
for numerical solving. One could compare nonlinear fitting in
Mathematica and MATLAB to compare the two. In Mathematica, one simply
writes the model in its mathematical form, while in MATLAB one has to
provide a function/program for the fitting routine to evaluate. Also
ODE integration - numerical integrators integrate a system of first
order ODEs. In matlab, one has to provide the rhs of such a system as
is usual with numerical solvers. If Maxima had a numerical ode
solver, one could state ode system as usual equations, while the
symbolic abilities of Maxima would take care of converting the user's
(mathematically looking) ode to a system of 1st order odes, compute
the solution using some standard algorithm and return the appropriate
solution (interpolating function preferably). Using a CAS for some
numerical tasks is much better than fortran-in-disguise a.k.a matlab/
octave. With todays computers, performance is often not an issue.
I suggest the following naming:
- maxima (user) level functions with names according to what they do:
"find_minimum" (for iterative numerical minimum searching, where
local minimums can be found, consistent with find_root)
- lisp level functions with names suggesting the underlying algorithm/
fortran name: "minpack-lmderl", "lapack-deesgv", "quadpack-qagi" (at
least for fortran numerical packages, where it's nice to know which
code is in maxima) etc.
Another important thing is to make use of maxima sybolic abilities,
to make the formulation of the problem as mathematically simple as
possible (jacobian can be calculated automaticly as suggested, or
optionallly user defined).
I'm still slowly working on a fitting package - looks like i won't
have to implement levenberg myself if minpack works.
I would also suggest agains naming packages via their fortran names.
A package "load(optimization)$" should include minimization, perhaps
fitting, linearprogramming/simplex functions imo. I think the user
has a right of not getting to know the names of fortran numerical
libraries, when he wants a simple numerical approximation of an
integral/ fit a function. Maxima should provide that.
Hope someone writes nice wrapping functions for minpack.
Ziga