mingamma.gms : Minimal y of GAMMA(x)

Description

```Find minimum of y = gamma(x) and y = loggamma(x) for x > 0
```

Reference

Small Model of Type : DNLP

Category : GAMS Model library

Main file : mingamma.gms

``````\$title Minimal y of GAMMA(x) (MINGAMMA,SEQ=299)

\$onText
Find minimum of y = gamma(x) and y = loggamma(x) for x > 0

Sloane, N J A, The On-Line Encyclopedia of Integer Sequences; Sequence
A030169. https://oeis.org/A030169

Keywords: nonlinear programming, discontinuous derivatives, statistics
\$offText

Variable y1, y2, x1, x2;

Equation y1def, y2def;

x1.lo = 0.01;
x2.lo = 0.01;

y1def.. y1 =e= gamma(x1);

y2def.. y2 =e= loggamma(x2);

Model
m1 / y1def /
m2 / y2def /;

solve m1 minimizing y1 using dnlp;

solve m2 minimizing y2 using  nlp;

Scalar
x1opt   / 1.46163214496836   /
x1delta
x2delta
y1opt   / 0.8856031944108887 /
y1delta
y2delta
y2opt;

y2opt = log(y1opt);

option decimals = 8;

x1delta = x1.l - x1opt;
y1delta = y1.l - y1opt;
x2delta = x2.l - x1opt;
y2delta = y2.l - y2opt;

display x1.l, x2.l, y1.l, y2.l, x1opt, y1opt, y2opt, x1delta, x2delta, y1delta, y2delta;

Scalar tol / 1e-6 /;

if(m1.solveStat <> %SolveStat.Capability Problems% and
m2.solveStat <> %SolveStat.Capability Problems%,
abort\$(abs(x1delta) > tol or abs(x2delta) > tol or
abs(y1delta) > tol or abs(y2delta) > tol   ) "inconsistent results";
);
``````