fnslexp.gms : Test correctness of slexp intrinsic

Description

slexp(x,S) =   exp(x)            if x <= S
               exp(S) * (1 + r)  otherwise, r = x - S
for S <= 150, default S = 150.

Contributor: Steve, Mar 2017


Small Model of Type : GAMS


Category : GAMS Test library


Main file : fnslexp.gms   includes :   fnset_xy.inc [htmlfntest_xy.inc [html]

$title 'Test correctness of slexp intrinsic' (FNSLEXP,SEQ=717)

$onText
slexp(x,S) =   exp(x)            if x <= S
               exp(S) * (1 + r)  otherwise, r = x - S
for S <= 150, default S = 150.

Contributor: Steve, Mar 2017
$offText

$include fnset_xy.inc

$gdxIn fnslexp
$load aeps reps relToInput T data
$gdxIn

loop {T,
  data(T,  'f')  = slexp.value(   data(T,'x'),data(T,'y'));
  data(T, 'fx')  = slexp.grad(1:  data(T,'x'),data(T,'y'));
  data(T, 'fy')  = slexp.grad(2:  data(T,'x'),data(T,'y'));
  data(T,'fxx')  = slexp.hess(1:1:data(T,'x'),data(T,'y'));
  data(T,'fxy')  = slexp.hess(1:2:data(T,'x'),data(T,'y'));
  data(T,'fyx')  = slexp.hess(2:1:data(T,'x'),data(T,'y'));
  data(T,'fyy')  = slexp.hess(2:2:data(T,'x'),data(T,'y'));
  data(T, 'rc')  = mathlastrc;
  data(T, 'ec')  = mathlastec;
};

$include fntest_xy.inc