Texas Instruments TI-89 Tip List page 187

Graphing calculator
Hide thumbs Also See for TI-89:
Table of Contents

Advertisement

nder2("tan", /2.01)
which returns 16374.242. The absolute error is about 1.01E-4, and the relative error is 6.19E-9.
The table below demonstrates the improvement in the derivative estimate as h decreases, for tan(x)
evaluated at x = 1.
nder2() starts with h = 0.01, and divides h by 10 for each new estimate, so that the steps for h are
1E-2, 1E-3, ... 1E-14. Since the difference in f'(x) starts increasing at h = 1E-7, nder2() returns the
value for h = 1E-6.
More accurate results with Ridders' method: nder1()
Ridders' method (Advances in Engineering Software, vol. 4, no. 2, 1982) is based on extrapolating the
central difference formula to h=0. This method also has the important advantage that it returns an
estimate of the error, as well. This program, nder2(), implements the algorithm:
nder1(ff,xx,hh)
func
©("f",x,"auto" or h), return {f'(x),err}
©Based on Ridders' algorithm
©6jun00/dburkett@infinet.com
local con,con2,big,ntab,safe,i,j,err,errt,fac,amat,dest,fphh,fmhh,ffun,h1,d3
© Initialize constants
1.4→con
con*con→con2
1900→big
10→ntab
2→safe
newmat(ntab,ntab)→amat
© Build function strings
ff&"(xx+hh)"→fphh
ff&"(xx-hh)"→fmhh
ff&"(xx)"→ffun
© Find starting hh if hh="auto"
if hh="auto" then
if xx=0 then: .01→h1
else: xx/1000→h1
endif
expr(ff&"(xx+h1)")-2*expr(ffun)+expr(ff&"(xx-h1)")→d3
if d3=0: .01→d3
h
f'(x)
1E-2
3.4264 6416 009
1E-3
3.4255 2827 135
1E-4
3.4255 1891 5
1E-5
3.4255 1882
1E-6
3.4255 188
1E-7
3.4255 185
difference in f'(x)
(none)
9.359E-4
9.356E-6
9.5E-8
2E-8
3E-7
6 - 29

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Ti-92+

Table of Contents