Tuesday, July 12, 2022

TI-58/TI-59 Week: Numerical Derivative

TI-58/TI-59 Week:  Numerical Derivative


Introduction


The program estimates the numeric derivative:


d/dx f(x) = (f(x + h) - f(x)) / h


Registers used:

R01:  x

R02:  h

R03:  d/dx


Labels:

[ A ]:  store x

[ B ]:  store h

[ C ]:  calculate derivative


LBL E:  store f(x), assume x is in the display.  You can use registers R00 and R06 and above for registers.  Use Rad  ( [ 2nd ] [ - ] ) if f(x) contains trigonometric functions.  End each function with the steps =, INV SBR (RTN)


Function Listings


(step number, key code, key)


000 76 LBL

001 11 A

002 42 STO

003 01 01

004 92 INV SBR (RTN)


005 76 LBL

006 12 B

007 42 STO

008 02 02

009 92 INV SBR (RTN)


010 76 LBL

011 13 C

012 43 RCL

013 01 01

014 85 +

016 43 RCL

017 02 02

018 71 SBR

019 15 E

020 42 STO

021 03 03

022 43 RCL

023 01 01

024 71 SBR

025 15 E

026 94 +/-

027 85 +

028 43 RCL

029 03 03

030 95 =

031 55 ÷

032 43 RCL

033 02 02

034 95 =

035 42 STO

036 03 03

037 92 INV SBR (RTN)


038 76 LBL

039 15 E

...      .... ....

n-1 95 =

nnn 92 INV SBR (RTN)


Examples


f(x) = sin x;    Rad, sin


x = 0.5, h = 0.1, [ C ] returns 0.8521693479

x = 0.5, h = 1E-8, [ C ] returns 0.87755


f(x) = (1 + cos x)^1.5;   Rad, cos, +, 1, =, y^x, 1.5


x = 2, h = 0.01, [ C ] returns -1.035743295

x = 2, h = 1E-8, [ C ] returns -1.04206


f(x) = x * e^(x);   STO, 00, e^x * RCL, 00


x = 3, h = 0.01, [ C ] returns 80.84630054

x = 3, h = 1E-5, [ C ] returns 80.342648


Eddie


All original content copyright, © 2011-2022.  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. 


HP 20S: Gamma Function Approximation (Stirling's Formula)

HP 20S:  Gamma Function Approximation (Stirling's Formula) Introduction The gamma function uses the approximation sequence: Let t = x + ...