Post Reply 
Condition Number of a Function
03-16-2020, 06:31 AM
Post: #1
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.

Example: (in Radians mode)

CONDFX("2*X*COS(X)",1.5) returns 20.15361502

CONDFX("e^-(.25*X)",1.5) returns 0.374995308312

Blog link: http://edspi31415.blogspot.com/2020/03/h...ition.html
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)