# HP Forums

Full Version: (20S) and (21S) Numerical Derivative
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Numerical Derivative

f'(x0) ≈ ( f(x0 + h) - f(x0 - h) ) / ( 2*h )

x = point
h = small change of x, example h = 0.0001

LBL A: Main Progam
LBL F: f(X), where R0 acts as X

Input variables:
R1 = h
R2 = point x0

Used variables:
R0 = x (use R0 for f(x), LBL F)

Calculated Variables:
R3 = f'(x)

Program:
Code:
``` 01  LBL A:  61,41A 02  RAD:  61,24 03  RCL 2:  22,2 04  +:  75 05  RCL 1:  22, 1 06  =:  74 07  STO 0:  21,0 08 XEQ F:  41,F 09  STO 3:  21, 3 10  RCL 2: 22,2 11 -:  65 12 RCL 1: 22,1 13 =:  74 14 STO 0: 21,0 15 XEQ F:  41,F 16 STO - 3:  21,65,3 17 2:  2 18 STO ÷ 3:  21,45,3 19  RCL 1:  22,1 20 STO ÷ 3: 21,45,3 21  RCL 3:  22,3 22 R/S:  26 23 LBL F:  61,41,F ... xx  RTN:  61,26  (end f(X) with RTN)```

Example: e^x * sin x

LBL F
RCL 0
e^x
*
RCL 0
SIN
=
RTN

R1 = 0.0001
R2 = x0 = 0.03
Result: 1.060899867

R1 = 0.0001
R2 = x0 = 1.47
Result: 4.7648049
Reference URL's
• HP Forums: https://www.hpmuseum.org/forum/index.php
• :