Sunday, March 15, 2020

HP Prime and Casio fx-CG50 Condition Number of a Function

HP Prime and Casio fx-CG50 Condition Number of a Function

Introduction

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)

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

Casio fx-CG 50 Program FCOND

"2020-02-05 EWS"
"NO QUOTES NEEDED"
Rad
"F(X): "?→Y1
"X0: "?→A
Abs( A * d/dx(Y1,A) ÷ Y1(A))→C

Note: Y1 is from the VARS, Graphic menu.

Example: 

F(X):  2*X*COS(X), X0:  1.5;   Result:  20.15212992

F(X):  e^(-.25*X), X0:  1.5;  Result:  0.375


Source: 
Condition Number.  Wikipedia.  https://en.wikipedia.org/wiki/Condition_number  Retrieved February 1, 2020


Eddie

All original content copyright, © 2011-2020.  Edward Shore.   Unauthorized use and/or unauthorized distribution for commercial purposes without express and written permission from the author is strictly prohibited.  This blog entry may be distributed for noncommercial purposes, provided that full credit is given to the author.

Spotlight: Sharp EL-5200

  Spotlight: Sharp EL-5200 As we come on the 13 th (April 16) anniversary of this blog, I want to thank you. Blogging about mathematic...