Input x is the point at which the derivative is estimated. dy/dx is the derivative estimate. Error est is the
error estimate. The derivative estimate is saved in the global variable nderout in the current folder.
Push [ENTER] to find another derivative, or press [ESC] to exit the program.
Diagnosing nder1() with nder1p()
nder1p() uses the same algorithm as nder1(), but is coded as a program instead of a function. This
version can be used to debug situations in which nder1() returns results with unacceptably high errors.
nder1p() is called in the same way as nder1():
nder1p(f,x,h).
When nder1p() finishes, the results are shown on the program I/O screen. Push ENTER to return to
the home screen. The results screen looks like this:
The 'Starting interval hh' shows the first value for h, which is especially helpful when the "auto" option is
used. The string "SAFE limit exit" may or may not be shown, depending on how nder1p() terminates.
The 'amat[] column' shows the number of main loops that executed before exit. 'fac' is a scaling factor.
nder1p() creates these global variables, which can all be deleted:
con, con2, big, ntab, safe, i, j, err, errt, fac, amat, dest, fphh, fmhh, ffun ,h1, d3
This is the code for nder1p():
nder1p(ff,xx,hh)
prgm
©("f",x,h) return f'(x), h is step size or "auto"
©6jun00/dburkett@infinet.com
©program version of nder1()
1.4→con
con*con→con2
1900→big
10→ntab
2→safe
ff&"(xx+hh)"→fphh
ff&"(xx-hh)"→fmhh
ff&"(xx)"→ffun
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
6 - 33