fnset_x.inc : intrinsics tests for f(x)

File : fnset_x.inc  used by :  fnsqr.gms [html]   fnexp.gms [htmlfnlog.gms [html]   fnlog2.gms [htmlfnlog10.gms [html]   fnsqrt.gms [htmlfncos.gms [html]   fnsin.gms [htmlfnsinh.gms [html]   fncosh.gms [htmlfntanh.gms [html]   fnfact.gms [htmlfngamma.gms [html]   fngamma2.gms [html]   fnatan.gms [htmlfnerrf.gms [html]   fnerrf2.gms [htmlfnentro.gms [html]   fnentro2.gms [html]   fnsigmo.gms [htmlfnsigmo2.gms [html]   fntan.gms [htmlfnacos.gms [html]   fnacosx.gms [htmlfnasin.gms [html]   fnasinx.gms [htmlfncentr.gms [html]   fncentr2.gms [html]   fncentr3.gms [html]   fnloggamma.gms [html]   fnlogit.gms [html]

$onText
How is relative accuracy defined?  Given:
  1. a point x,
  2. the computed value f(x), and
  3. the known value fbar,

we can compute the relative accuracy of f vis-a-vis fbar in two ways:
  1. |f-fbar| <= reps * |fbar|
  2. |f-fbar| <= reps * max(1,|x|)

The first case is the most common, but for some functions
the second is more appropriate (e.g. sin(x)).

We can also pass a test if the absolute accuracy is within some
tolerance aeps:
  1. |f-fbar| <= aeps

Contributor: Steven Dirkse, October 2004
$offText

scalar aeps       'absolute error tolerance';
scalar aeps0      'absolute error tolerance, function';
scalar aeps1      'absolute error tolerance, first derivative';
scalar aeps2      'absolute error tolerance, second derivative';
scalar reps       'relative error tolerance';
scalar reps0      'relative error tolerance, function';
scalar reps1      'relative error tolerance, first derivative';
scalar reps2      'relative error tolerance, second derivative';
scalar relToInput 'reps is relative to input (not output) magnitude';

sets
  T          'all test instances'
  V / x,       c,       d,
      f,      f_,     f_r,     f_a
     fx,     fx_,    fx_r,    fx_a
    fxx,    fxx_,   fxx_r,   fxx_a
     rc,     rc_,    rc_e
     ec,     ec_,    ec_e
  /
  badT(T)    'failed test instances'
  badTV(T,V) 'only the items/checks that failed'
  inV(V)     'inputs' / x, c, d /
  fV(V)      'func info' /  f,   f_,   f_r,   f_a  /
  fxV(V)     'grad info' /  fx,  fx_,  fx_r,  fx_a  /
  fxxV(V)    'Hess info' /  fxx, fxx_, fxx_r, fxx_a  /
  rcV(V)     'rc info'   /  rc,  rc_,  rc_e /
  ecV(V)     'ec info'   /  ec,  ec_,  ec_e /
  ;
parameters
  data(T,V)
  tmp(T)
  failures(T,V) 'all data for failed test instances'
  fail2(T,V)    'most relevant data for failed test instances'
  ;