Merge branch 'master' of ssh://git.code.sf.net/p/maxima/code
[maxima.git] / share / cobyla / ex / ex6.mac
blobb6e590009606feeb8556641cdcc67db4dd62b87c
1 /*
2  * Equation 9.1.15 in Fletcher's book Practical Methods of
3  * Optimization
4  *
5  * f = -x1-x2
6  * x2-x1^2 >= 0
7  * 1-x1^2-x2^2 >= 0
8  *
9  * True solution: x1=1/sqrt(2), x2=1/sqrt(2)
10  */
12 fmin_cobyla(-x1-x2, [x1, x2], [1, 1], constraints = [x2-x1^2 >= 0, 1-x1^2-x2^2 >= 0], iprint=1);
14 /* Output
16    Normal return from subroutine COBYLA
18    NFVALS =   63   F =-1.414214E+00    MAXCV = 2.000067E-12
19    X = 7.071064E-01   7.071072E-01
20 [[x1 = .7071063653426506,x2 = .7071071970316142],-1.414213562374265,
21          63, 0]
24 /* True output
26        Output from test problem 6 (Equation (9.1.15) in Fletcher)
28    Normal return from subroutine COBYLA
30    NFVALS =   63   F =-1.414214E+00    MAXCV = 2.000067E-12
31    X = 7.071064E-01   7.071072E-01