Condition Number of a Function
03-16-2020, 06:31 AM
Post: #1
 Eddie W. Shore Senior Member Posts: 1,122 Joined: Dec 2013
Condition Number of a Function
Condition number for a function f(x) is:

Cond = abs( x * d/dx f(x) / f(x) )

If the condition number is low, then function is not sensitive to small changes. This is similar to the condition number for matrices, where a low number gives for a well-conditioned problem while a higher number gives for an ill-conditioned problem.

HP Prime Program CONDFX

Arguments: f(X) as a string, use the capital X as a variable; a: value

Syntax: CONDFX(f, a)

Code:
EXPORT CONDFX(f,a) BEGIN // f(X) as a string, x0 // 2020-02-06 EWS X:=a; fx:=EXPR(f); X:=a+.0001; dx:=(EXPR(f)-fx)/.0001; c:=ABS(a*dx/fx);  RETURN c; END;

Note: The derivative is calculated manually.