numapprox
confracform
convert a rational function to continued-fraction form
Calling Sequence
Parameters
Description
Examples
confracform(r)
confracform(r, x)
r
-
procedure or expression representing a rational function
x
(optional) variable name appearing in r, if r is an expression
This procedure converts a given rational function r into the continued-fraction form which minimizes the number of arithmetic operations required for evaluation.
If the second argument x is present then the first argument must be a rational expression in the variable x. If the second argument is omitted then either r is an operator such that yields a rational expression in y, or else r is a rational expression with exactly one indeterminate (determined via indets).
Note that for the purpose of evaluating a rational function efficiently (i.e. minimizing the number of arithmetic operations), the rational function should be converted to continued-fraction form. In general, the cost of evaluating a rational function of degree when each of numerator and denominator is expressed in Horner (nested multiplication) form, with the denominator made monic, is
mults/divs and adds/subtracts
whereas the same rational function can be evaluated in continued-fraction form with a cost not exceeding
The command with(numapprox,confracform) allows the use of the abbreviated form of this command.
The Horner form can be evaluated in 4 mults/divs
whereas the continued-fraction form can be evaluated in 2 mults/divs
See Also
convert/confrac
indets
numapprox[hornerform]
Download Help Document