Vorige: , Nach oben: cobyla   [Inhalt][Index]

37.3 Examples for cobyla

Minimize x1*x2 with 1-x1^2-x2^2 >= 0. The theoretical solution is x1 = 1/sqrt(2), x2 = -1/sqrt(2).

(%i1) load("fmin_cobyla")$

(%i2) fmin_cobyla(x1*x2, [x1, x2], [1,1], 
                         constraints = [x1^2+x2^2<=1], iprint=1);

   Normal return from subroutine COBYLA

   NFVALS =   66   F =-5.000000E-01    MAXCV = 1.999956E-12
   X = 7.071058E-01  -7.071077E-01
(%o2) [[x1 = .7071058493484819, x2 = - .7071077130247994], 
                                      - .499999999999263

There are additional examples in the share/cobyla/ex directory.


Vorige: , Nach oben: cobyla   [Inhalt][Index]