fnsqexp.gms : Test correctness of sqexp intrinsic

Description

sqexp(x,S) =   exp(x)                     if x <= S
               exp(S) * (1 + r + r^2/2)   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 : fnsqexp.gms   includes :   fnset_xy.inc [htmlfntest_xy.inc [html]

$title 'Test correctness of sqexp intrinsic' (FNSQEXP,SEQ=719)

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

Contributor: Steve, Mar 2017
$offText

$include fnset_xy.inc

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

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

$include fntest_xy.inc