The basic method is to replace nsolve() with a TI Basic program that uses Newton's method, coupled
with an accurate estimating function. Further speed improvements are possible since you control the
accuracy of the solution.
The function is called fipoly(), and here is the code:
fipoly(clist,fguess,yval,yemax,yetype)
func
©Fast inverse polynomial solver
©26 nov 99 dburkett@infinet.com
©Find x, given f(x)
©clist: list of polynomial coefficients
©fguess: list of guess generating polynomial coefficients
©yval: point at which to find 'x'
©yemax: max error in 'y'
©yetype: "rel": yemax is relative error; "abs": yemax is absolute error.
local fd,dm,xg,yerr,n,erstr,nm
©Set maximum iterations & error string
30→nm
"fipoly iterations"→erstr
©Find list of derivative coefficients
dim(clist)→dm
seq(clist[k]*(dm-k),k,1,dm-1)→fd
©Find first guess and absolute error
polyeval(fguess,yval)→xg
polyeval(clist,xg)-yval→yerr
©Loop to find solution 'x'
0→n
if yetype="abs" then
while abs(yerr)>yemax
xg-(polyeval(clist,xg)-yval)/polyeval(fd,xg)→xg
polyeval(clist,xg)-yval→yerr
n+1→n
if n=nm:return erstr
endwhile
else
yerr/yval→yerr
while abs(yerr)>yemax
xg-(polyeval(clist,xg)-yval)/polyeval(fd,xg)→xg
(polyeval(clist,xg)-yval)/yval→yerr
n+1→n
if n=nm:return erstr
endwhile
endif
xg
Endfunc
Again, this routine will only work if your function to be solved is a polynomial, and you can find a fairly
accurate estimating function for the solution. (If you can find a very accurate estimating function, you
don't need this routine at all!)
6 - 15