Name

Condition Overview — Computes the condition number of various functions.

Description

These functions provides the condition number of various elementary functions. Their goal is to evaluate the potential numerical difficulty of evaluating numerically a function at a given point.

Consider a smooth function f defined by:

<latex> \begin{eqnarray} y = f(x) \end{eqnarray} </latex>

where x and y are a real numbers.

The condition number is a measure of the sensitivity of the output y with respect to the input x. It is the ratio of the relative error on y and the relative error on x. For a smooth scalar function f, it is equal to:

<latex> \begin{eqnarray} c_f(x) = \left| \frac{xf'(x)}{f(x)} \right| \end{eqnarray} </latex>

It is possible to express the condition number of the inverse of a function, depending on its derivative. Indeed, the derivative of the inverse function of f satisfies:

<latex> \begin{eqnarray} \left(f^{-1}\right)^\prime (x) = \frac{1}{f^\prime \left(f^{-1}(x)\right)} \end{eqnarray} </latex>

The condition number of the inverse function is then:

<latex> \begin{eqnarray} c_{f^{-1}} (x) = \left| \frac{x}{f^{-1}(x)f^\prime \left(f^{-1}(x)\right)} \right| \end{eqnarray} </latex>

For several elementary functions, we provide the exact condition number. In the case where the condition number is not provided, the user may call the assert_condnum function, which uses finite differences to estimate it.

Condition of Normal Standard Distribution Function

In this section, we analyze the condition number of the normal standard distribution function and its inverse.

// Condition number of Inverse normal standard distribution function / p
function x = myinvnorstd ( p )
  mu = zeros(p)
  std = ones(p)
  q = 1-p
  x = cdfnor("X",mu,std,p,q)
endfunction
p = linspace(1e-5,1-1e-5,1000);
for k = 1 : size(p,"*")
  c(k) = assert_condnum(myinvnorstd,p(k));
end
h = scf();
plot(p,c)
h.children.log_flags="nln";
xtitle("Conditionning of Inverse Normal Standard","p","Condition Number");

// Condition number of Inverse normal standard distribution function / q
// Notice that, when the function is ill-conditionned for p close to 1, 
// then it is well conditionned with respect to q, which is close to 0.
// The only unavoidable ill-conditionned point is p~q~0.5, since both 
// p and q make the function ill-conditionned.
function x = myinvnorstdq ( q )
  mu = zeros(q)
  std = ones(q)
  p = 1-q
  x = cdfnor("X",mu,std,p,q)
endfunction
q = linspace(1e-5,1-1e-5,1000);
for k = 1 : size(q,"*")
  c(k) = assert_condnum(myinvnorstdq,q(k));
end
h = scf();
plot(q,c)
h.children.log_flags="nln";
xtitle("Conditionning of Inverse Normal Standard","q","Condition Number");

// Condition number of normal standard distribution function / p.
// Notice that the standard normal CDF is equal to zero as soon as x<-40.
// The condition number is never greater than 1.e4, which is not 
// very large, but should be noticed in accuracy tests.
// The symetric behaviour will be observed with respect to q.
h = scf();
subplot(2,1,1);
x = linspace(-40,10,1000);
p = mynorstd ( x );
plot(x,p);
function p = mynorstd ( x )
  mu = zeros(x)
  std = ones(x)
  p=cdfnor("PQ",x,mu,std)
endfunction
for k = 1 : size(x,"*")
  c(k) = assert_condnum(mynorstd,x(k));
end
subplot(2,1,2);
plot(x,c)
xtitle("Conditionning of Normal Standard","x","Condition Number");
h.children(1).y_location = "left";
h.children(2).y_location = "left";
   

Authors

Michael Baudin, DIGITEO, 2010

Bibliography

"Accuracy and Stability of Numerical Algorithms", Nicholas J. Higham, Society for Industrial and Applied Mathematics, Philadelphia, PA, USA, Second Edition, 2002

"Rounding errors in algebraic processes", James Hardy Wilkinson, 1963, Prentice Hall

"Handbook of Floating-Point Arithmetic", Muller, Brisebarre, de Dinechin, Jeannerod, Lefevre, Melquiond, Revol, Stehle, Torres, Birkhauser Boston, 2010