Description
Test the function values and derivatives of centropy(x,y,delta) = x * log((x+delta)/(y+delta)) on very small inputs : x in [0,1e2] y in [1e-298,1e2] d in [0,1e2] Contributor: Steve Dirkse
Small Model of Type : GAMS
Category : GAMS Test library
Main file : fncentr6.gms includes : fnset_xy.inc [html] fntest_xy.inc [html]
$title 'Test centropy intrinsic on small inputs' (FNCENTR6,SEQ=362)
$onText
Test the function values and derivatives of
centropy(x,y,delta) = x * log((x+delta)/(y+delta))
on very small inputs :
x in [0,1e2]
y in [1e-298,1e2]
d in [0,1e2]
Contributor: Steve Dirkse
$offText
$include fnset_xy.inc
$gdxIn fncentr6
$load aeps reps T data
$gdxIn
relToInput = 0;
aeps = 5e-13;
loop {T,
data(T, 'f') = centropy.value( data(T,'x'),data(T,'y'),data(T,'d'));
data(T, 'fx') = centropy.grad(1: data(T,'x'),data(T,'y'),data(T,'d'));
data(T, 'fy') = centropy.grad(2: data(T,'x'),data(T,'y'),data(T,'d'));
data(T,'fxx') = centropy.hess(1:1:data(T,'x'),data(T,'y'),data(T,'d'));
data(T,'fxy') = centropy.hess(1:2:data(T,'x'),data(T,'y'),data(T,'d'));
data(T,'fyx') = centropy.hess(2:1:data(T,'x'),data(T,'y'),data(T,'d'));
data(T,'fyy') = centropy.hess(2:2:data(T,'x'),data(T,'y'),data(T,'d'));
data(T, 'rc') = mathlastrc;
data(T, 'ec') = mathlastec;
};
* we may get evaluation errors: this should not cause the test to fail
execerror = 0;
display relToInput;
$include fntest_xy.inc