diff --git a/books/bookvol10.4.pamphlet b/books/bookvol10.4.pamphlet index 81328bf..e833a60 100644 --- a/books/bookvol10.4.pamphlet +++ b/books/bookvol10.4.pamphlet @@ -124209,6 +124209,369 @@ PadeApproximantPackage(R: Field, x:Symbol, pt:R): Exports == Implementation wher \pagehead{PadeApproximants}{PADE} \pagepic{ps/v104padeapproximants.ps}{PADE}{1.00} +From Jeffrey (pp413-415): + +An effective and concise form of approximation is provided by Pad\'e +approximation in which a function $f(x)$ defined over an interval +$a \le x \le b$ is approximated by a function of the form $F(x) = N(x)/D(x)$, +where $N(x)$ and $D(x)$ are polynomials with no common zeros. +This type of approximation can be used with functions $f(x)$ +that are analytic over the interval $a \le x \le b$, and also with +functions that have singularities in the interval at which the +function becomes infinite. In the latter case the zeros of $D(x)$ are +chosen to coincide with the singularities of $f(x)$ inside the +interval. + +Unless there is a reason to do otherwise, the degrees of the +polynomial $N(x)$ in the numerator and $D(x)$ in the denominator of a +Pad\'e approximation are usually chosen to be the same. If, however, the +function $f(x)$ to be approximated is an even function, $N(x)$ and +$D(x)$ are both chosen to be even functions, while if $f(x)$ is odd, +one of the functions $N(x)$ and $D(x)$ is chosen to be even and the +other to be odd. As already stated, when the function to be +approximated has singularities in the interval, the zeros of $D(x)$ +are taken to coincide with the singularities. + +The determination of a Pad\'e approximation $F(x)$ for $f(x)$ over the +interval $a \le x \le b$ is determined as follows where, by way of +example, $f(x)$ is supposed to be neither even nor odd so the degrees +of $N(x)$ and $D(x)$ are both taken to be $n$. Setting +$+F(x) = \frac{a_1(x-a)^n + a_2(x-a)^{n-1} + \cdots + a_n(x-a) + f(a)} +{b_1(x-a)^n + b_2(x-a)^{n-1} + \cdots + b_n(x-a) + 1} +$ + +the values of $f(x)$ are computed at $2n$ points $x_1$, $x_2$, +$\ldots$, $x_{2n}$ distributed over the interval\\ +$a \le x \le b$ +in such a way that the functional values at these points provide +a good representation of $f(x)$ away from any singularities that +might occur. Set $f_r = f(x_r)$ with $r=1,2,\ldots,2n$, where the +initial point $x=a$ is excluded from this set of $2n$ points. Then, +for each value $x$, set $F(x_r)=f_r$, so that after multiplication +of $F(x)$ by +$+b_1(x_r-a)^n + \ldots + b_n(x_r-a) + 1, +$ + +$+a_1(x_r-a)^n+\ldots+a_n(x_r-a)+f(a)= +f_r[b_1(x_r-a)^n + \ldots + b_n(x_r-a) + 1] +$ + +with $r=1,2,\ldots{},2n$. These $2n$ equations determine the $2n$ +coefficients $a_1$, $a_2$, $\ldots$, $a_n$, $b_1$, $b_2$, $\ldots$, +$b_n$ to be used in the Pad\'e approximation. + +The approach is different if $f(x)$ is analytic in an interval of +interest that contains no singularities of $f(x)$ and the function +is known in the form of a power series. The method used in such a +case is illustrated by finding a Pad\'e approximation for $sin(x)$ +based on the first four terms of its Maclaurin series +$+sin(x) = x - \frac{1}{6}x^3 + \frac{1}{120}x^5 - \frac{1}{5040}x^5 +$ + +the sine function is an odd function, so a Pad\'e approximation +is sought of the form +$+x - \frac{1}{6}x^3 + \frac{1}{120}x^5 - \frac{1}{5040}x^5 = +\frac{x+a_1 x^3}{1+b_1 x^2+b_2 x^4} +$ + +where the numerator is an odd polynomial function of degree three +and the denominator is an even polynomial of degree four. + +Multiplying this representation by $1+b_1 x^2 +b_2 x^4$ and +equating corresponding powers of $x$ on each side of the equation gives: +$+b_1-\frac{1}{6}=a_1,\quad +b_2-\frac{1}{6}b_1+\frac{1}{120}=0,\quad +-\frac{1}{5040}+\frac{1}{120}b_1-\frac{1}{6}b_2=0 +$ +so $a_1=-31/294$, $b_1=3/49$ and $b_2=11/5880$. Substituting for +$a_1$, $b_1$, and $b_2$ in the original expression and clearing +fractions shows that the required Pad\'e approximation to be +$+sin(x) \approx F(x) = \frac{5880x-620x^3}{5880+360x^2+11x^4} +$ + +The positive zero of the numerator at 3.07959 provides a surprisingly +good approximation to the zero of $sin(x)$ at $\pi = 3.14159\ldots$ +despite the very few terms used in the Maclaurin series for $sin(x)$. +The Pad\'e approximations $F(1)=0.84147$, $F(2) = 0.90715$, and +$F(3) = 0.08990$, should be compared with the true values +$sin(1)=0.84147\ldots$, $sin(2)=0.90929\ldots$ and +$sin(3)=0.14112\ldots$. + +An example of a Pad\'e approximation to an analytic function that is +neither even or odd is provided by an approximation to $exp(-x)$, +based on the first nine terms of its Maclaurin series expansion +and a rational approximation in which the numerator and denominator +are both of degree four, yields +$+exp(-x) \approx F(x) = +\frac{1680 - 840x + 180x^2 - 20x^3 + x^4} +{1680 + 840x + 180x^2 + 20x^3 + x^4} +$ + +This approximation gives $F(-1)=2.718281$, that should be compared +with the true value $exp(1)=e=2.718281\ldots$, similarly +$F(-2)=7.388889$ should be compared with the true value +$exp(2)=7.389056\ldots$ and $F(-3)=20.065421$ should be compared +with the true value $exp(3)=20.085536\ldots$. + +A final example is provided by the Pad\'e approximation to the odd +function $tan(x)$, based on the first five terms of its Maclaurin +series expansion and a rational function approximation in which the +numerator is an odd function of degree five and the denominator is +an even function of degree four. + +In this case the Pad\'e approximation becomes +$+tan(x) \approx F(x) = +\frac{945x - 105x^3 + x^5}{945 - 420x^2 + 15x^4} +$ + +The smallest positive zero of the denominator +$945 - 420x^2 + 15x^4$ gives for the approximation to +$\pi/2 = 1.57079\ldots$ the surprisingly accurate estimate +$\pi/2 \approx 1.57081$. The value $F(1.1)=1.96476$ should be +compared with the true value +$tan(1.1)=1.964759\ldots$, the value $F(1.5)=14.10000$ should be +compared to the true value $tan(1.5)=14.10141\ldots$ and the +value $F(1.57)=1237.89816$ should be compared with the true value\\ +$tan(1.57)=1255.76559\ldots$. + +\begin{chunk}{PadeApproximants.input} +)set break resume +)sys rm -f PadeApproximants.output +)spool PadeApproximants.output +)set message test on +)set message auto off +)clear all + +--S 1 of 30 +F(x:PI):DFLOAT == (5880*x-620*x^3)/(5880+360*x^2+11*x^4) +--R Function declaration F : PositiveInteger -> DoubleFloat has been +--R added to workspace. +--R Type: Void +--E 1 + +--S 2 of 30 +F(1) +--R Compiling function F with type PositiveInteger -> DoubleFloat +--R +--R (2) 0.84146536554151341 +--R Type: DoubleFloat +--E 2 + +--S 3 of 30 +sin(1)::EXPR(DFLOAT) +--R +--R (3) 0.8414709848078965 +--R Type: Expression(DoubleFloat) +--E 3 + +--S 4 of 30 +F(1)-sin(1) +--R +--R (4) - 5.6192663830945122E-6 +--R Type: Expression(DoubleFloat) +--E 4 + +--S 5 of 30 +F(2) +--R +--R (5) 0.90715048025613665 +--R Type: DoubleFloat +--E 5 + +--S 6 of 30 +sin(2)::EXPR(DFLOAT) +--R +--R (6) 0.90929742682568171 +--R Type: Expression(DoubleFloat) +--E 6 + +--S 7 of 30 +F(2)-sin(2) +--R +--R (7) - 2.1469465695450607E-3 +--R Type: Expression(DoubleFloat) +--E 7 + +--S 8 of 30 +F(3) +--R +--R (8) 8.9901108780341618E-2 +--R Type: DoubleFloat +--E 8 + +--S 9 of 30 +sin(3)::EXPR(DFLOAT) +--R +--R (9) 0.14112000805986721 +--R Type: Expression(DoubleFloat) +--E 9 + +--S 10 of 30 +F(3)-sin(3) +--R +--R (10) - 5.1218899279525595E-2 +--R Type: Expression(DoubleFloat) +--E 10 + +)clear all + +--S 11 of 30 +F(x:INT):DFLOAT == _ + (1680-840*x+180*x^2-20*x^3+x^4)/(1680+840*x+180*x^2+20*x^3+x^4) +--R +--R Function declaration F : Integer -> DoubleFloat has been added to +--R workspace. +--R Type: Void +--E 11 + +--S 12 of 30 +F(-1) +--R Compiling function F with type Integer -> DoubleFloat +--R +--R (2) 2.7182817182817183 +--R Type: DoubleFloat +--E 12 + +--S 13 of 30 +exp(1)::EXPR(DFLOAT) +--R +--R (3) 2.7182818284590451 +--R Type: Expression(DoubleFloat) +--E 13 + +--S 14 of 30 +F(-1)-exp(1) +--R +--R (4) - 1.1017732681750658E-7 +--R Type: Expression(DoubleFloat) +--E 14 + +--S 15 of 30 +F(-2) +--R +--R (5) 7.3888888888888893 +--R Type: DoubleFloat +--E 15 + +--S 16 of 30 +exp(2)::EXPR(DFLOAT) +--R +--R (6) 7.3890560989306504 +--R Type: Expression(DoubleFloat) +--E 16 + +--S 17 of 30 +F(-2)-exp(2) +--R +--R (7) - 1.6721004176112331E-4 +--R Type: Expression(DoubleFloat) +--E 17 + +--S 18 of 30 +F(-3) +--R +--R (8) 20.065420560747665 +--R Type: DoubleFloat +--E 18 + +--S 19 of 30 +exp(3)::EXPR(DFLOAT) +--R +--R (9) 20.085536923187668 +--R Type: Expression(DoubleFloat) +--E 19 + +--S 20 of 30 +F(-3)-exp(3) +--R +--R (10) - 2.0116362440003144E-2 +--R Type: Expression(DoubleFloat) +--E 20 + +)clear all + +--S 21 of 30 +F(x) == (945*x - 105*x^3+x^5)/(945-420*x^2+15*x^4) +--R Type: Void +--E 21 + +--S 22 of 30 +F(1.1) +--R Compiling function F with type Float -> Float +--R +--R (2) 1.9647583984 270694032 +--R Type: Float +--E 22 + +--S 23 of 30 +tan(1.1) +--R +--R (3) 1.9647596572 486519509 +--R Type: Float +--E 23 + +--S 24 of 30 +F(1.1)-tan(1.1) +--R +--R (4) - 0.0000012588 215825478 +--R Type: Float +--E 24 + +--S 25 of 30 +F(1.5) +--R +--R (5) 14.1 +--R Type: Float +--E 25 + +--S 26 of 30 +tan(1.5) +--R +--R (6) 14.1014199471 71719388 +--R Type: Float +--E 26 + +--S 27 of 30 +F(1.5)-tan(1.5) +--R +--R (7) - 0.0014199471 71719388 +--R Type: Float +--E 27 + +--S 28 of 30 +F(1.57) +--R +--R (8) 1237.8982990170 10806 +--R Type: Float +--E 28 + +--S 29 of 30 +tan(1.57) +--R +--R (9) 1255.7655915006 916051 +--R Type: Float +--E 29 + +--S 30 of 30 +F(1.57)-tan(1.57) +--R +--R (10) - 17.8672924836 807991 +--R Type: Float +--E 30 + +)spool +)lisp (bye) +\end{chunk} + {\bf Exports:}\\ \begin{tabular}{ll} \cross{PADE}{pade} & @@ -124224,8 +124587,9 @@ PadeApproximantPackage(R: Field, x:Symbol, pt:R): Exports == Implementation wher ++ Examples: ++ References: ++ "Pade Approximants, Part I: Basic Theory", Baker & Graves-Morris. +++ "Handbook of Mathematical Formulas and Integrals" Alan Jeffrey ++ Description: -++ This package computes reliable Pad&ea. approximants using +++ This package computes reliable Pade. approximants using ++ a generalized Viskovatov continued fraction algorithm. PadeApproximants(R,PS,UP): Exports == Implementation where diff --git a/changelog b/changelog index ca9a0b2..6b41130 100644 --- a/changelog +++ b/changelog @@ -1,3 +1,6 @@ +20120301 tpd src/axiom-website/patches.html 20120301.01.tpd.patch +20120301 tpd src/algebra/Makefile add Pade regression test +20120301 tpd books/bookvol10.4 document and regression test PadeApproximants 20120228 tpd src/axiom-website/patches.html 20120228.01.tpd.patch 20120228 tpd books/bookvol5 add )tangle and )regress commands 20120227 tpd src/axiom-website/patches.html 20120227.01.tpd.patch diff --git a/src/algebra/Makefile.pamphlet b/src/algebra/Makefile.pamphlet index d6802ba..34fe3f9 100644 --- a/src/algebra/Makefile.pamphlet +++ b/src/algebra/Makefile.pamphlet @@ -18121,6 +18121,7 @@ REGRESS= \ PackageForAlgebraicFunctionField.regress \ PackageForAlgebraicFunctionFieldOverFiniteField.regress \ PackageForPoly.regress \ + PadeApproximants.regress \ PAdicInteger.regress \ PAdicIntegerCategory.regress \ PAdicRational.regress \ @@ -18163,7 +18164,7 @@ REGRESS= \ PolynomialCategory.regress \ PolynomialFactorizationExplicit.regress \ PolynomialIdeals.regress \ - PolynomialPackageForCurve.regress \ + PolynomialPackageFoCurve.regress \ PolynomialRing.regress \ PolynomialSetCategory.regress \ PositiveInteger.regress \ diff --git a/src/axiom-website/patches.html b/src/axiom-website/patches.html index c1dbfcd..b59565d 100644 --- a/src/axiom-website/patches.html +++ b/src/axiom-website/patches.html @@ -3830,5 +3830,7 @@ books/bookvol8.1 add Icosahedron, remove v18equation103
buglist fix bug 7217
20120228.01.tpd.patch books/bookvol5 add )tangle and )regress commands
+20120301.01.tpd.patch +books/bookvol10.4 document and regression test PadeApproximants