Below are the correct values of the function, gradient and Hessian of the
function f in book exercise 18.3, as well as those of the
quadratic-penalty function Q for mu=1, evaluated at the initial point, so
that you can check that your functions are coded correctly.


>> X = [-1.8 1.7 1.9 -0.8 -0.8], mu = 1
X =
   -1.8000    1.7000    1.9000   -0.8000   -0.8000
mu =
     1

>> [ff,gf,Hf] = F18_3_f(X)
ff =
    0.0209
gf =
   -0.7373   -0.7553   -0.0474    0.1126    0.1126
Hf =
  -93.5001  -84.3525   -0.0717    0.1702    0.1702
  -84.3525  -75.8791    0.0759   -0.1802   -0.1802
   -0.0717    0.0759    0.0929   -0.1613   -0.1613
    0.1702   -0.1802   -0.1613    0.5238    0.3830
    0.1702   -0.1802   -0.1613    0.3830    0.5238

>> [fQ,gQ,HQ] = Q(X,f,paramf,E,paramE,I,paramI,mu)
fQ =
    0.5449
gQ =
   -3.6220    3.4720    3.8796   -1.3994   -1.3994
HQ =
   15.1035  -12.3201  -13.7517    5.9302    5.9302
  -12.3201   17.3260   16.2559    1.9798    1.9798
  -13.7517   16.2559   19.4629    0.5587    0.5587
    5.9302    1.9798    0.5587   21.1238   18.7930
    5.9302    1.9798    0.5587   18.7930   21.1238

