confracform - Maple Help

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 $r\left(y\right)$ 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 $\left(m,n\right)$ when each of numerator and denominator is expressed in Horner (nested multiplication) form, with the denominator made monic, is

 $m+n$ mults/divs   and   $m+n$ adds/subtracts

 whereas the same rational function can be evaluated in continued-fraction form with a cost not exceeding

 $\mathrm{max}\left(m,n\right)$ mults/divs   and   $m+n$ adds/subtracts

 • The command with(numapprox,confracform) allows the use of the abbreviated form of this command.

Examples

 > $\mathrm{with}\left(\mathrm{numapprox}\right):$
 > $f≔t↦\frac{1.1\cdot {t}^{2}-20.5\cdot t+5.3}{{t}^{2}+7.6\cdot t+0.1}$
 ${f}{≔}{t}{↦}\frac{{1.1}{\cdot }{{t}}^{{2}}{-}{20.5}{\cdot }{t}{+}{5.3}}{{{t}}^{{2}}{+}{7.6}{\cdot }{t}{+}{0.1}}$ (1)

The Horner form can be evaluated in 4 mults/divs

 > $\mathrm{hornerform}\left(f\right)$
 ${t}{↦}\frac{{5.3}{+}\left({-}{20.5}{+}{1.1}{\cdot }{t}\right){\cdot }{t}}{{0.1}{+}\left({7.6}{+}{t}\right){\cdot }{t}}$ (2)

whereas the continued-fraction form can be evaluated in 2 mults/divs

 > $\mathrm{confracform}\left(f\right)$
 ${y}{↦}{1.100000000}{-}\frac{{28.86000000}}{{y}{+}{7.779833680}{+}\frac{{1.499076119}}{{y}{-}{0.1798336798}}}$ (3)
 > $e≔\mathrm{pade}\left(\mathrm{exp}\left(x\right),x,\left[2,2\right]\right)$
 ${e}{≔}\frac{\frac{{1}}{{12}}{}{{x}}^{{2}}{+}\frac{{1}}{{2}}{}{x}{+}{1}}{\frac{{1}}{{12}}{}{{x}}^{{2}}{-}\frac{{1}}{{2}}{}{x}{+}{1}}$ (4)
 > $\mathrm{confracform}\left(e,x\right)$
 ${1}{+}\frac{{12}}{{x}{-}{6}{+}\frac{{12}}{{x}}}$ (5)
 > $r\left[2,3\right]≔\mathrm{minimax}\left(\frac{\mathrm{tan}\left(x\right)}{x},x=0..\frac{\mathrm{\pi }}{4},\left[2,3\right]\right)$
 ${{r}}_{{2}{,}{3}}{≔}\frac{{1.130422926}{+}\left({-}{0.07842798254}{-}{0.07066118710}{}{x}\right){}{x}}{{1.130423032}{+}\left({-}{0.07843711579}{+}\left({-}{0.4473405792}{+}{0.02547897687}{}{x}\right){}{x}\right){}{x}}$ (6)
 > $\mathrm{confracform}\left(r\left[2,3\right]\right)$
 ${-}\frac{{2.773313366}}{{x}{-}{18.66715865}{+}\frac{{33.63826614}}{{x}{+}{8.668760300}{+}\frac{{49.52801799}}{{x}{-}{7.558844295}}}}$ (7)