Saturday, August 21, 2021

TI-95 ProCalc: Approximate Derivative and Bisection Method

TI-95 ProCalc: Approximate Derivative and Bisection Method


Introduction:  The Label FX and Flags to set Radians Mode

The two programs presented today will use a subroutine with the label FX.  FX is going to be where you store your function.  I have designated the variables such that X can be used as storing and recall in the subroutine.   To edit FX:

In run mode (out of LEARN):  [ 2nd ] [ 2 ] (GTL) FX, [ LEARN ] [ F2 ] (PC)

The subroutine FX must end with = RTN.  

Radians mode can be set during programming with the following flag commands: RF 34 SF 33.

FYI, Degrees Mode:  RF 34 RF 33

And Gradians Mode:  RF 33 SF 34

Approximate Derivative

This program calculates f'(x), rounds, and displays the answer to five decimal places.  

f'(x) ≈ ( f(x + h) - f(x - h) ) / ( 2 * h ),  h is set to 10^-5

FIX 9 resets the TI-95 ProCalc to floating (all/standard) mode.

TI-95 ProCalc File DRV
Size:  varies

RF 34 SF 33 1 EE 5 +/- STO H

CLR 'X?' BRK STO A 

+ RCL H = SBL FX STO D

RCL A - RCL H = SBL FX ST- D

RCL D / ( 2 * RCL H ) = 

FIX 5 RND FIX 9 STO D HLT

LBL FX   [insert f(x) here, do not store values to A or H] = RTN

Examples

f(x) = x * sin x 
FX:  STO X * SIN = RTN
f'( π/5 ) returns 1.09611 
f'( 1.6*π ) returns 0.60223

f(x) = 3 * e^x
FX:  INV LN * 3 = RTN
f'( 1 ) returns 8.15485
f'( -1.215 ) returns 0.89013

Bisection Method

The bisection method finds a root for the equation f(x) = 0.  An advantage to the bisection method is that there is no requirement to calculate the derivative.  However, two initial guesses a and b are required such that f(a) * f(b) < 0, and the calculation process can be lengthy.

I set the tolerance to 10^-10.   

Note:  I will need a variable to store the 0 value.  IF tests on the TI-95 ProCalc can not compare to numeric values directly.   I use the variable Z to store 0.

TI-95 ProCalc File BIS
Size:  varies

'BISECTION F(X)=0' PAU

CLR 'A?' BRK STO A

CLR 'B?' BRK STO B

10 +/- INV LOG STO T

0 STO Z

LBL A0 ( RCL A + RCL B ) / 2 = STO C

SBL FX STO F ABS IF <T GTL BO

RCL B SBL FX * RCL F = IF >Z GTL A1

RCL C STO A GTL A0

LBL A1 RCL C STO B GTL A0

LBL B0 CLR 'SOL=' COL 16 MRG C HLT

LBL FX  [insert f(x) here, do not store values to A, B, C, T, or Z] = RTN

Examples

3*x - e^x = 0
FX:  STO X * 3 - RCL X INV LN = RTN
Interval:  [1, 2] (A = 1, B = 2)
Result: 1.512134552

x - 2^(-x) = 0
FX:  STO X - 2 y^x RCL X +/- = RTN
Interval:  [0, 1]  (A = 0, B = 1)
Result:  0.6411857446

Source:
Byju's Classes  "Bisection Method - Definition, Procedure, and Example"  https://byjus.com/maths/bisection-method/  Retrieved June 5, 2021

Commas added to the results for readability.  

Eddie

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

Casio fx-991CW: Input Output Formats

Casio fx-991CW: Input Output Formats The Four Formats There are four input/output formats that the Casio fx-991CW has. With eac...