numapprox[confracform] - convert a rational function to continued-fraction form
|
Calling Sequence
|
|
confracform(r)
confracform(r, x)
|
|
Parameters
|
|
r
|
-
|
procedure or expression representing a rational function
|
x
|
-
|
(optional) variable name appearing in r, if r is an expression
|
|
|
|
|
Description
|
|
•
|
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
|
mults/divs and adds/subtracts
|
|
|
•
|
The command with(numapprox,confracform) allows the use of the abbreviated form of this command.
|
|
|
Examples
|
|
>
|
|
>
|
|
| (1) |
The Horner form can be evaluated in 4 mults/divs
>
|
|
| (2) |
whereas the continued-fraction form can be evaluated in 2 mults/divs
>
|
|
| (3) |
>
|
|
| (4) |
>
|
|
| (5) |
>
|
|
| (6) |
>
|
|
| (7) |
|
|
Download Help Document
Was this information helpful?