fnsqlog10.gms : Test correctness of sqlog10 intrinsic

Description

sqlog10(x,S) = log_10(x)                         if x >= S
               (1/log 10) (ln(S) + r/S - 1/S^2)  otherwise, r = x - S
for S >= 1e-150, default S = 1e-150.

Contributor: Steve, Mar 2017


Small Model of Type : GAMS


Category : GAMS Test library


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

$title 'Test correctness of sqlog10 intrinsic' (FNSQLOG10,SEQ=721)

$onText
sqlog10(x,S) = log_10(x)                         if x >= S
               (1/log 10) (ln(S) + r/S - 1/S^2)  otherwise, r = x - S
for S >= 1e-150, default S = 1e-150.

Contributor: Steve, Mar 2017
$offText

$include fnset_xy.inc

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

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

$include fntest_xy.inc