The function parameters are
A string that specifies whether yemax is absolute error or relative error:
"abs" means absolute error
"rel" means relative error
yetype
The maximum desired y-error at the solution for x, must be >0yemax
The point at which to solve for xyval
List of coefficients of the estimating (guess) polynomialfguess
List of coefficients for the polynomial that is to be solved.clist
fipoly() returns the solution as a numeric value, if it can find one. If it cannot find a solution, it returns
the string "fipoly iterations". If you call fipoly() from another program, that program can use gettype() to
detect the error, like this:
fipoly(...)→x
if getype(x)≠"NUM" then
{handle error here}
endif
{otherwise proceed}
With fipoly(), you can specify the y-error yemax as either a relative or absolute error. If y
a
is the
approximate value and y is the actual value, then
absolute error = y − y
a
relative error =
y−y
a
y
You will usually want to use the relative error, because this is the same as specifying the number of
significant digits. For example, if you specify a relative error of 0.0001, and the y-values are on the
order of 1000, then fipoly() will stop when the y-error is less than 0.1, giving you 4 significant digits in
the answer.
However, suppose you specify an absolute error of 1E-12, and the y-values are on the order of 1000
as above. In this case, fipoly() will try to find a solution to an accuracy in y of 1E-12, but the y-values
only have a resolution of 1E-10. fipoly() won't be able to do this, and will return the error message
instead of the answer.
As an example, I'll use the same gamma function approximation function from tip [11.5]. The function
to be solved is
y = a + bx+ cx
2
+ dx
3
+ ex
4
+ fx
5
+ gx
6
+ hx
7
+ ix
8
where these coefficients are saved in a list variable called fclist:
a = 4.44240042385 b = -10.1483412133 c = 13.4835814713
d = -11.0699337662 e = 6.01503554007 f = -2.15531523837
g = 0.494033458314 h = -.0656632350273 i = 0.00388944540448
Using curve fitting software for a PC, I found this estimating function:
x = p + qy+ ry
+ sy
+ ty
+ uy
5
where these coefficients are saved in a variable called fglist:
p = -788.977246657 q = 3506.8808748 r = -6213.31596202
6 - 16