cobyla



   From: Raymond Toy <toy.raymond at gmail.com>
   Date: Sat, 27 Jul 2013 09:05:18 -0700
   Content-Type: text/plain; charset="us-ascii"

   On 7/27/13 6:03 AM, jfr.maurel at gmail.com wrote:
   > Hi,
   > 
   > I cannot find a solution with cobyla of the following problem. I can
   > solve it with python libraries.
   > I played with rhobeg, rhoend and maxfun without luck.
   > 
   > windows 7
   > wxMaxima 13.04.2
   > wxWidgets: 2.8.12
   > Support unicode: no
   > Version de Maxima:5.30.0
   > Lisp: GNU Common Lisp (GCL) GCL 2.6.8 (a.k.a. GCL)
   > 
   > Could you please tell me what I am doing wrong ?

   In maxima, %gamma is Euler's constant, 0.577.  Change %gamma to
   something else.  When I do this (changing %gamma to %g), I get the
   solution

   [[u = .03705430246865427, v = - .03357050298344191,
			   %g = .001264520332765797], - .1276445445548629,
   153, 0]

   which satisfies the constraint.


Ahh, this is really quite hard to find the error even when you know
that %gamma might be the source of the error, as you can see from my
first message. I think the root source of this issue is that
coerce-float-fun is with coerce-float-fun. It seems that when
coerce-float-fun is fed an expression, it should either replace the
input list of variables with gensyms in that expression; or, the list
of variables should be scanned for constants and an error thrown if a
constant is found.

Here is the identity function:


(%i1) :lisp (progn (defvar $FN) (setf (symbol-function '$FN) (coerce-float-fun '((mlist simp) $%GAMMA) '((mlist simp) $%GAMMA))))
#<FUNCTION (LAMBDA ($%GAMMA)) {C67005D}>
(%i1) fn(1);
(%o1)                         [.5772156649015329]

Ooops.

(%i2) :lisp (progn (setf (symbol-function '$FN) (coerce-float-fun '((mlist simp) $?) '((mlist simp) $?))))
#<FUNCTION (LAMBDA ($?)) {C6DF05D}>
(%i2) fn(1);
(%o2)                                [1.0]

Ok.

Leo