Introduction to minpack
=======================

Minpack is a Common Lisp translation (via f2cl) of the Fortran library MINPACK, as obtained from Netlib.

Categories: Numerical methods Optimization Share packages Package minpack

Functions and Variables for minpack
===================================

 -- Function: minpack_lsquares
     minpack_lsquares (FLIST, VARLIST, GUESS)
     minpack_lsquares (..., 'tolerance = TOLERANCE)
     minpack_lsquares (..., 'jacobian = JACOBIAN)

     Compute the point that minimizes the sum of the squares of the functions in the list FLIST.  The variables are in the list VARLIST.  An initial guess of the optimum point must be provided in GUESS.

     The optional keyword arguments, TOLERANCE and JACOBIAN provide some control over the algorithm.  TOLERANCE is the estimated relative error desired in the sum of squares. JACOBIAN can be used to specify the Jacobian.  If JACOBIAN is not given or is true (the default), the Jacobian is computed from FLIST.  If JACOBIAN is false, a numerical approximation is used.

     minpack_lsquares returns a list.  The first item is the estimated solution; the second is the sum of squares, and the third indicates the success of the algorithm.  The possible values are

     0
          improper input parameters.

     1
          algorithm estimates that the relative error in the sum of squares is at most tolerance.

     2
          algorithm estimates that the relative error between x and the solution is at most tolerance.

     3
          conditions for info = 1 and info = 2 both hold.

     4
          fvec is orthogonal to the columns of the jacobian to machine precision.

     5
          number of calls to fcn with iflag = 1 has reached 100*(n+1).

     6
          tol is too small. no further reduction in the sum of squares is possible.

     7
          tol is too small. no further improvement in the approximate solution x is possible.

          /* Problem 6: Powell singular function */
          (%i1) powell(x1,x2,x3,x4) :=
                   [x1+10*x2, sqrt(5)*(x3-x4), (x2-2*x3)^2,
                        sqrt(10)*(x1-x4)^2]$
          (%i2) minpack_lsquares(powell(x1,x2,x3,x4), [x1,x2,x3,x4],
                                 [3,-1,0,1]);
          (%o2) [[1.652117596168394e-17, - 1.652117596168393e-18,
                  2.643388153869468e-18, 2.643388153869468e-18],
                 6.109327859207777e-34, 4]

          /* Same problem but use numerical approximation to Jacobian */
          (%i3) minpack_lsquares(powell(x1,x2,x3,x4), [x1,x2,x3,x4],
                                 [3,-1,0,1], jacobian = false);
          (%o3) [[5.060282149485331e-11, - 5.060282149491206e-12,
                  2.179447843547218e-11, 2.179447843547218e-11],
                 3.534491794847031e-21, 5]

     Categories: Package minpack

 -- Function: minpack_solve
     minpack_solve (FLIST, VARLIST, GUESS)
     minpack_solve (..., 'tolerance = TOLERANCE)
     minpack_solve (..., 'jacobian = JACOBIAN)

     Solve a system of n equations in n unknowns. The n equations are given in the list FLIST, and the unknowns are in VARLIST.  An initial guess of the solution must be provided in GUESS.

     The optional keyword arguments, TOLERANCE and JACOBIAN provide some control over the algorithm.  TOLERANCE is the estimated relative error desired in the sum of squares. JACOBIAN can be used to specify the Jacobian.  If JACOBIAN is not given or is true (the default), the Jacobian is computed from FLIST.  If JACOBIAN is false, a numerical approximation is used.

     minpack_solve returns a list.  The first item is the estimated solution; the second is the sum of squares, and the third indicates the success of the algorithm.  The possible values are

     0
          improper input parameters.

     1
          algorithm estimates that the relative error in the solution is at most tolerance.

     2
          number of calls to fcn with iflag = 1 has reached 100*(n+1).

     3
          tol is too small. no further reduction in the sum of squares is possible.

     4
          Iteration is not making good progress.

          /* Problem 6: Powell singular function */
          (%i1) powell(x1,x2,x3,x4) :=
                   [x1+10*x2, sqrt(5)*(x3-x4), (x2-2*x3)^2,
                        sqrt(10)*(x1-x4)^2]$
          (%i2) minpack_lsquares(powell(x1,x2,x3,x4), [x1,x2,x3,x4],
                                 [3,-1,0,1]);
          (%o2) [[8.586306796471285e-19, - 8.586306796471285e-20,
                 1.902656479186597e-18, 1.902656479186597e-18], 1.552862701642987e-35, 4]

     In this particular case, we can solve this analytically:

          (%i3) solve(powell(x1,x2,x3,x4),[x1,x2,x3,x4]);
          (%o3)       [[x1 = 0, x2 = 0, x3 = 0, x4 = 0]]

     and we see that the numerical solution is quite close the analytical one.

     Categories: Package minpack