Module for Padé Approximation

Numerical Methods using Mathematica  
Complementary software supplements for   
Numerical Methods textbooks  
John H. Mathews and Kurtis Fink, 2004

Background. 
	A Padé rational approximation to f(x) on [a,b] is the quotient of two polynomials (Subscript[P, n]) (x) and (Subscript[Q, m]) (x) of degrees n and m, respectively. We use the notation (Subscript[R, n, m]) (x) to denote this quotient: 

		\(\(R\_\(n, 
              m\)\) \((x)\)\  = \ \(\(P\_n\) \((x)\)\)\/\(\(Q\_m\) \((x)\)\)\).  
		
We attribute much of the founding theory to Henri Eugène Padé (1863-1953).

Theorem (Padé Approximation).  Assume that  f∈(C^(n + m)), and that f (x) Maclaurin polynomial expansion of degree at least n + m.  Then 

	\(f \((x)\)\  ≈ \ \(R\_\(n, 
                m\)\) \((x)\)\  = \ \(\(P\_n\) \((x)\)\)\/\(\(Q\_m\) \((x)\)\)\),  

where (Subscript[P, n]) (x) and (Subscript[Q, m]) (x) are polynomials of degree n and m, respectively.

Proof  Padé Approximation  Padé Approximation

Animations (Padé Approximation  Padé Approximation).  Internet hyperlink to animations.

Computer Programs  Padé Approximation  Padé Approximation

Example 1.  Find the Padé approximation (Subscript[R, 2, 2]) (x)for f[x] = (e^x).

Solution 1.

First, set up the equation   f (x) (Subscript[Q, m]) (x)  -  (Subscript[P, n]) (x)  =   0.

Clear[a, f, k, m, n, p, q, R, Q, P, 
        x];  
f[x_] = (E^x);  
F[x_, k_]  :=  Series[f[x], {x, 0, k}];    
P[x_, k_]  =  (∑_(i = 0)^k) (Subscript[p, i]) (x^i);  
Q[x_, k_]  =  
        1  +  (∑_(i = 1)^k) (Subscript[q, i]) (x^i);  
n = 2;  
m = 2;  
vars = 
        Union[Table[(Subscript[p, i]), {i, 0, n}], 
          Table[(Subscript[q, i]), {i, 1, m}]];  
\(\(Print[\*""\!\(P\_n\)(x) = "", P[x, n]\ ];\)\ \ \)
\(\(Print[\*""\!\(Q\_m\)(x) = "", Q[x, m]\ ];\)\ \ \ \)
Print[" f(x) = ", 
        F[x, m + n] ];  
Print[""];  
\(\(Print[\*""Form  f(x)(Subscript[Q, m])(x) - (Subscript[P, n])(x) = 0""];\)\ \ \)
Print[
        Expand[F[x, n + m] Q[x, m] - P[x, n]] == 0];

Second, solve the equation   f (x) (Subscript[Q, m]) (x)  -  (Subscript[P, n]) (x)  =   0.

L = Expand[F[x, n + m] Q[x, m] - P[x, n]];  
coeffs = CoefficientList[L, x];  
Eqns = Distribute[coeffs == 0,  List];  
Print[TableForm[Eqns] ];  
Print[""];  
solset = Solve[Eqns, vars];   
R[x_] = 
        Simplify[
          ReplaceAll[P[x, n]/Q[x, n], 
            (Subscript[solset, [[1]]])] ];  
Print[
        TableForm[Transpose[solset]] ];  
Print[""];  
Print["f[x] = ", f[x] ]; 
Print["R[x] = ", R[x] ];

Compare our work with Mathematica's Pade subroutine.

Needs["Calculus`Pade`"];  
Clear[r];
r[x_] = 
        ExpandDenominator[
          ExpandNumerator[
            Together[
              Pade[f[x], {x, 0, 2, 
                  2}] ] ] ];  
Print["f[x] = ", f[x] ]; 
Print["r[x] = ", r[x] ];

Plot graphs of the function and its Pade approximation over the interval  [-1,1].

Needs["Graphics`Colors`"];
Plot[{f[x], r[x]}, {x,  -1,  1}, 
        PlotStyle ->  {Red, Blue}]; 
Print["f[x] = ", f[x] ]; 
Print["r[x] = ", r[x] ];

Find the error  over the interval  [-1,1].

Plot[f[x] - r[x], {x, -1, 1}, PlotRange -> All, 
        PlotStyle ->  Green]; 
Print["f[x]-r[x] = ", 
        f[x] - r[x] ]; 
Print["The maximum error is"];
Print["|f[x]-r[x]| ≤ ", 
        Abs[f[1.0] - r[1.0]] ];

Compare with the error in a (4^th) degree Maclaurin polynomial over the interval  [-1, 1].

s[x_] = 
        Normal[Series[f[x], {x, 0, 4}]];   
Print["s[x] = ", s[x] ];

Needs["Graphics`Colors`"];
Plot[{f[x], s[x]}, {x,  -1,  1}, 
        PlotStyle ->  {Red, Blue}]; 
Print["f[x] = ", f[x] ]; 
Print["s[x] = ", s[x] ];

Find the error  over the interval  [-1,1].

s[x_] = 
        Normal[Series[f[x], {x, 0, 4}]];   
Plot[f[x] - s[x], {x, -1, 1}, PlotRange -> All, 
        PlotStyle ->  Cyan]; 
Print["f[x]-s[x] = ", 
        f[x] - s[x] ]; 
Print["The maximum error is"];
Print["|f[x]-s[x]| ≤ ", 
        Abs[f[1.0] - s[1.0]] ];

Compare with the error in a (5^th) degree Maclaurin polynomial over the interval  [-1, 1].

s[x_] = 
        Normal[Series[f[x], {x, 0, 5}]];   
Print["s[x] = ", s[x] ];

Needs["Graphics`Colors`"];
Plot[{f[x], s[x]}, {x,  -1,  1}, 
        PlotStyle ->  {Red, Blue}]; 
Print["f[x] = ", f[x] ]; 
Print["s[x] = ", s[x] ];

Find the error  over the interval  [-1,1].

s[x_] = 
        Normal[Series[f[x], {x, 0, 5}]];   
Plot[f[x] - s[x], {x, -1, 1}, PlotRange -> All, 
        PlotStyle ->  Cyan]; 
Print["f[x]-s[x] = ", 
        f[x] - s[x] ]; 
Print["The maximum error is"];
Print["|f[x]-s[x]| ≤ ", 
        Abs[f[1.0] - s[1.0]] ];

Example 2.  Find the Padé approximation (Subscript[R, 4, 4]) (x)for f[x] = Cos[x].

Solution 2.

First, set up the equation   f (x) (Subscript[Q, m]) (x)  -  (Subscript[P, n]) (x)  =   0.

Clear[a, f, k, m, n, p, q, R, Q, P, 
        x];  
f[x_] = Cos[x];  
F[x_, k_]  :=  Series[f[x], {x, 0, k}];    
P[x_, k_]  =  (∑_(i = 0)^k) (Subscript[p, i]) (x^i);  
Q[x_, k_]  =  
        1  +  (∑_(i = 1)^k) (Subscript[q, i]) (x^i);  
n = 4;  
m = 4;  
vars = 
        Union[Table[(Subscript[p, i]), {i, 0, n}], 
          Table[(Subscript[q, i]), {i, 1, m}]];  
\(\(Print[\*""\!\(P\_n\)(x) = "", P[x, n]\ ];\)\ \ \)
\(\(Print[\*""\!\(Q\_m\)(x) = "", Q[x, m]\ ];\)\ \ \ \)
Print[" f(x) = ", 
        F[x, m + n] ];  
Print[""];  
\(\(Print[\*""Form  f(x)(Subscript[Q, m])(x) - (Subscript[P, n])(x) = 0""];\)\ \ \)
Print[
        Expand[F[x, n + m] Q[x, m] - P[x, n]] == 0];

Second, solve the equation   f (x) (Subscript[Q, m]) (x)  -  (Subscript[P, n]) (x)  =   0.

L = Expand[F[x, n + m] Q[x, m] - P[x, n]]; 
coeffs = CoefficientList[L, x]; 
Eqns = Distribute[coeffs == 0,  List]; 
Print[TableForm[Eqns] ]; 
Print[""]; 
solset = Solve[Eqns, vars];  
R[x_] = 
        Simplify[
          ReplaceAll[P[x, n]/Q[x, n], 
            (Subscript[solset, [[1]]])] ]; 
Print[TableForm[Transpose[solset]] ];
Print[""];  
Print["f[x] = ", f[x] ]; 
Print["R[x] = ", R[x] ];

Compare our work with Mathematica's Pade subroutine.

Needs["Calculus`Pade`"];  
Clear[r];
r[x_] = 
        ExpandDenominator[
          ExpandNumerator[
            Together[
              Pade[f[x], {x, 0, 4, 
                  4}] ] ] ];  
Print["f[x] = ", f[x] ];  
Print["r[x] = ", r[x] ];

Plot graphs of the function and its Pade approximation over the interval  [-1, 1].

Needs["Graphics`Colors`"];
Plot[{f[x], r[x]}, {x,  -1,  1}, 
        PlotStyle ->  {Red, Blue}]; 
Print["f[x] = ", f[x] ]; 
Print["r[x] = ", r[x] ];

Find the error  over the interval  [-1, 1].

Plot[f[x] - r[x], {x, -1, 1}, PlotRange -> All, 
        PlotStyle ->  Green]; 
Print["f[x]-r[x] = ", 
        f[x] - r[x] ]; 
Print["The maximum error is"];
Print["|f[x]-r[x]| ≤ ", 
        Abs[f[1.0] - r[1.0]] ];

Compare with the error in a (7^th) degree Maclaurin polynomial over the interval  [-1, 1].  
Remark.  The coefficient of  (x^7) is zero, but that's o.k.

s[x_] = 
        Normal[Series[f[x], {x, 0, 7}]];   
Print["s[x] = ", s[x] ];

Plot graphs of the function and its Pade approximation over the interval  [-1, 1].

Needs["Graphics`Colors`"];
Plot[{f[x], s[x]}, {x,  -1,  1}, 
        PlotStyle ->  {Red, Blue}]; 
Print["f[x] = ", f[x] ]; 
Print["s[x] = ", s[x] ];

s[x_] = 
        Normal[Series[f[x], {x, 0, 7}]];   
Plot[f[x] - s[x], {x, -1, 1}, PlotRange -> All, 
        PlotStyle ->  Cyan]; 
Print["f[x]-s[x] = ", 
        f[x] - s[x] ]; 
Print["The maximum error is"];
Print["|f[x]-s[x]| ≤ ", 
        Abs[f[1.0] - s[1.0]] ];

Compare with the error in a (9^th) degree Maclaurin polynomial over the interval  [-1, 1].  
Remark.  The coefficient of  (x^9) is zero, but that's o.k.

s[x_] = 
        Normal[Series[f[x], {x, 0, 9}]];   
Print["s[x] = ", s[x] ];

Plot graphs of the function and its Pade approximation over the interval  [-1, 1].

Needs["Graphics`Colors`"];
Plot[{f[x], s[x]}, {x,  -1,  1}, 
        PlotStyle ->  {Red, Blue}]; 
Print["f[x] = ", f[x] ]; 
Print["s[x] = ", s[x] ];

s[x_] = 
        Normal[Series[f[x], {x, 0, 9}]];   
Plot[f[x] - s[x], {x, -1, 1}, PlotRange -> All, 
        PlotStyle ->  Cyan]; 
Print["f[x]-s[x] = ", 
        f[x] - s[x] ]; 
Print["The maximum error is"];
Print["|f[x]-s[x]| ≤ ", 
        Abs[f[1.0] - s[1.0]] ];

Various Scenarios and Animations for the Pade Approximation.

Example 3.  Find Pade approximations for f[x] = (Sqrt[x]) expanded about  (Subscript[x, 0]) = 1, (Subscript[x, 0]) = 4, and (Subscript[x, 0]) = 5.

Solution 3 (a).

f[x_] = (Sqrt[x]);  
x0 = 1;  
a = 0; 
b =  10.5; 
c = 0.0; 
d = 3.5; 
a0 = 0.0; 
b0 = 2.0; 
Needs["Graphics`Colors`"];
Needs["Calculus`Pade`"];
Cdot = 
        Graphics[{{Red, PointSize[0.02], 
              Point[{x0, f[x0]}]}}]; 
Rends = 
        Graphics[{{Green, Line[{{a0, c}, {a0, d}}]}, {Red, 
              Line[{{x0, c}, {x0, d}}]}, {Green, 
              Line[{{b0, c}, {b0, d}}]}}]; 
For[n = 1, 
      n ≤ 5, n++, 
P[x_]  =  
        Together[Pade[f[x], {x, x0, n, n}]];   
graph = 
        Plot[{f[x], P[x]}, {x, a, b}, PlotStyle -> {Magenta, Blue}, 
          PlotRange -> {{a, b}, {c, d}}, 
          Ticks -> {Range[0, 10, 2], Range[0, 4, 1]}, 
          DisplayFunction -> Identity]; 
Show[graph, 
        Cdot, Rends, 
        DisplayFunction -> $DisplayFunction]; 
Print["\
  f[x] = ", 
        f[x]]; 
Print[(Subscript["P", n, n]), "[x] = ", 
        P[x]];   ]

Animation 1.  ( Pade Approximation  Pade Approximation ).  Internet hyperlink.

Solution 3 (b).

f[x_] = (Sqrt[x]);  
x0 = 4;  
a = 0; 
b =  10.5; 
c = 0.0; 
d = 3.5; 
a0 = 0.0; 
b0 = 8.0; 
Needs["Graphics`Colors`"];
Needs["Calculus`Pade`"];
Cdot = 
        Graphics[{{Red, PointSize[0.02], 
              Point[{x0, f[x0]}]}}]; 
Rends = 
        Graphics[{{Green, Line[{{a0, c}, {a0, d}}]}, {Red, 
              Line[{{x0, c}, {x0, d}}]}, {Green, 
              Line[{{b0, c}, {b0, d}}]}}]; 
\(For[n = 1, 
      n ≤ 
        5, \(n++\), 
P[x_]\  = \ \ Together[
          Pade[f[x], {x, x0, n, n}]]; \ \ 
graph = 
        Plot[{f[x], P[x]}, {x, a, b}, PlotStyle -> {Magenta, Blue}, 
          PlotRange -> {{a, b}, {c, d}}, 
          Ticks -> {Range[0, 10, 2], Range[0, 4, 1]}, 
          DisplayFunction -> Identity]; 
Show[graph, 
        Cdot, Rends, 
        DisplayFunction -> $DisplayFunction]; \ \ 
Print["  f[x] = ", 
        f[x]]; 
Print["P"\_\(n, n\), "[x] = ", 
        P[x]];\ \ ]\ \ \ \)

Animation 2.  ( Pade Approximation  Pade Approximation ).  Internet hyperlink.

Solution 3 (c).

f[x_] = (Sqrt[x]);  
x0 = 5;  
a = 0; 
b =  10.5; 
c = 0.0; 
d = 3.5; 
a0 = 0.0; 
b0 = 10.0; 
Needs["Graphics`Colors`"];
Needs["Calculus`Pade`"];
Cdot = 
        Graphics[{{Red, PointSize[0.02], 
              Point[{x0, f[x0]}]}}]; 
Rends = 
        Graphics[{{Green, Line[{{a0, c}, {a0, d}}]}, {Red, 
              Line[{{x0, c}, {x0, d}}]}, {Green, 
              Line[{{b0, c}, {b0, d}}]}}]; 
\(For[n = 1, 
      n ≤ 
        5, \(n++\), 
P[x_]\  = \ \ Together[
          Pade[f[x], {x, x0, n, n}]]; \ \ \ 
graph = 
        Plot[{f[x], P[x]}, {x, a, b}, PlotStyle -> {Magenta, Blue}, 
          PlotRange -> {{a, b}, {c, d}}, 
          Ticks -> {Range[0, 10, 2], Range[0, 4, 1]}, 
          DisplayFunction -> Identity]; 
Show[graph, 
        Cdot, Rends, 
        DisplayFunction -> $DisplayFunction]; \ \ 
Print["  f[x] = ", 
        f[x]]; 
Print["P"\_\(n, n\), "[x] = ", 
        P[x]];\ \ ]\ \ \ \ \ \ \)

Animation 3.  ( Pade Approximation  Pade Approximation  ).  Internet hyperlink.

Example 4.  Find Pade approximations for f[x] = (1/(Sqrt[1 - x])) expanded about  (Subscript[x, 0]) = 0.

Solution 4.

f[x_] = (1/(Sqrt[1 - x]));  
x0 = 0;  
a = -1.5; 
b =  1.5; 
c = 0.0; 
d = 8.5; 
a0 = -1.0; 
b0 = 1.0; 
Needs["Graphics`Colors`"];
Needs["Calculus`Pade`"];
Cdot = 
        Graphics[{{Red, PointSize[0.02], 
              Point[{x0, f[x0]}]}}]; 
Rends = 
        Graphics[{{Green, Line[{{a0, c}, {a0, d}}]}, {Red, 
              Line[{{x0, c}, {x0, d}}]}, {Green, 
              Line[{{b0, c}, {b0, d}}]}}]; 
\(For[n = 1, 
      n ≤ 5, \(n++\), 
P[x_]\  = \ 
        Together[\ 
          Pade[f[x], {x, x0, n, n}]]; \ \ 
graph1 = 
        Plot[f[x], {x, \(-1.5\),  .9999}, PlotStyle -> Magenta, 
          DisplayFunction -> Identity]; 
graph2 = 
        Plot[P[x], {x, \(-1.5\), 1.5}, PlotStyle -> Blue, 
          DisplayFunction -> Identity]; 
Show[graph1, 
        graph2, Cdot, Rends, PlotRange -> {{a, b}, {c, d}}, 
        Ticks -> {Range[\(-1.5\), 1.5, 0.5], Range[0, 5, 1]}, 
        DisplayFunction -> $DisplayFunction]; \ \ 
Print["  f[x] = ", 
        f[x]]; 
Print["P"\_\(n, n\), "[x] = ", 
        P[x]];\ \ ]\ \ \ \ \ \ \ \ \ \)

Animation 4.  ( Pade Approximation  Pade Approximation ).  Internet hyperlink.

Example 5.  Find Pade approximations for f[x] = Log[x] expanded about  (Subscript[x, 0]) = 1, and (Subscript[x, 0]) = 2.

Solution 5 (a).

f[x_] = Log[x];  
x0 = 1;  
a = -0.5; 
b =  4.1; 
c = -6.0; 
d = 3.0; 
a0 = 0; 
b0 = 2.0; 
Needs["Graphics`Colors`"];
Needs["Calculus`Pade`"];
Cdot = 
        Graphics[{{Red, PointSize[0.02], 
              Point[{x0, f[x0]}]}}]; 
Rends = 
        Graphics[{{Green, Line[{{a0, c}, {a0, d}}]}, {Red, 
              Line[{{x0, c}, {x0, d}}]}, {Green, 
              Line[{{b0, c}, {b0, d}}]}}]; 
\(For[n = 1, 
      n ≤ 5, \(n++\), 
P[x_]\  = \ 
        Together[
          Pade[f[x], {x, x0, n, n}]]; \ \ \ 
graph1 = 
        Plot[{f[x], P[x]}, {x, 0.001, b}, PlotStyle -> {Magenta, Blue}, 
          DisplayFunction -> Identity]; 
graph2 = 
        Plot[P[x], {x, \(-0.5\), b}, PlotStyle -> {Magenta, Blue}, 
          DisplayFunction -> Identity]; 
Show[graph1, 
        graph2, Cdot, Rends, PlotRange -> {{a, b}, {c, d}}, 
        Ticks -> {Range[\(-0.5\), 4.0, 0.5], Range[\(-5\), 0, 1]}, 
        DisplayFunction -> $DisplayFunction]; \ 
Print["  f[x] = ", 
        f[x]]; 
Print["P"\_\(n, n\), "[x] = ", 
        P[x]];\ \ ]\ \ \ \ \ \ \ \ \ \ \ \)

Animation 5.  ( Pade Approximation  Pade Approximation ).  Internet hyperlink.

Solution 5 (b).

f[x_] = Log[x];  
x0 = 2;  
a = -0.5; 
b =  4.1; 
c = -6.0; 
d = 3.0; 
a0 = 0; 
b0 = 4.0; 
Needs["Graphics`Colors`"];
Needs["Calculus`Pade`"];
Cdot = 
        Graphics[{{Red, PointSize[0.02], 
              Point[{x0, f[x0]}]}}]; 
Rends = 
        Graphics[{{Green, Line[{{a0, c}, {a0, d}}]}, {Red, 
              Line[{{x0, c}, {x0, d}}]}, {Green, 
              Line[{{b0, c}, {b0, d}}]}}]; 
\(For[n = 1, 
      n ≤ 5, \(n++\), 
P[x_]\  = \ 
        Together[
          Pade[f[x], {x, x0, n, n}]]; \ \ \ 
graph1 = 
        Plot[{f[x], P[x]}, {x, 0.001, b}, PlotStyle -> {Magenta, Blue}, 
          DisplayFunction -> Identity]; 
graph2 = 
        Plot[P[x], {x, \(-0.5\), b}, PlotStyle -> {Magenta, Blue}, 
          DisplayFunction -> Identity]; 
Show[graph1, 
        graph2, Cdot, Rends, PlotRange -> {{a, b}, {c, d}}, 
        Ticks -> {Range[\(-0.5\), 4.0, 0.5], Range[\(-6\), 0, 1]}, 
        DisplayFunction -> $DisplayFunction]; \ 
Print["  f[x] = ", 
        f[x]]; 
Print["P"\_\(n, n\), "[x] = ", 
        P[x]];\ \ ]\ \ \ \ \ \ \ \ \ \ \)

Animation 6.  ( Pade Approximation  Pade Approximation ).  Internet hyperlink.

Example 6.  Find Pade approximations for f[x] = Sin[x] expanded about  (Subscript[x, 0]) = 0.

Solution 6.

f[x_] = Sin[x];  
x0 = 0;  
a = -3 π; 
b = 3  π; 
c = -1.3; 
d =  1.3; 
a0 = -10; 
b0 = 10; 
Needs["Graphics`Colors`"];
Needs["Calculus`Pade`"];
Cdot = 
        Graphics[{{Red, PointSize[0.02], 
              Point[{x0, f[x0]}]}}]; 
Rends = 
        Graphics[{{Green, Line[{{a0, c}, {a0, d}}]}, {Red, 
              Line[{{x0, c}, {x0, d}}]}, {Green, 
              Line[{{b0, c}, {b0, d}}]}}]; 
\(For[n = 1, 
      n ≤ 6, \(n++\), 
P[x_]\  = \ 
        Together[Pade[f[x], {x, x0, n, n}]]; 
graph = 
        Plot[{f[x], P[x]}, {x, a, b}, PlotStyle -> {Magenta, Blue}, 
          PlotRange -> {{a, b}, {c, d}}, 
          Ticks -> {Range[\(-3\) π, 3  π, π], 
              Range[\(-0.5\), 1, 0.5]}, 
          DisplayFunction -> Identity]; 
Show[graph, 
        Cdot, Rends, 
        DisplayFunction -> $DisplayFunction]; \ \ 
Print["  f[x] = ", 
        f[x]]; 
Print["P"\_\(n, n\), "[x] = ", 
        P[x]];\ \ \ ]\ \ \)

Animation 8.  ( Pade Approximation  Pade Approximation ).  Internet hyperlink.

Example 7.  Find Pade approximations f[x] = Cos[x] expanded about  (Subscript[x, 0]) = 0.

Solution 7.

f[x_] = Cos[x];  
x0 = 0;  
a = -3 π; 
b = 3  π; 
c = -1.3; 
d =  1.3; 
a0 = -10; 
b0 = 10; 
Needs["Graphics`Colors`"];
Needs["Calculus`Pade`"];
Cdot = 
        Graphics[{{Red, PointSize[0.02], 
              Point[{x0, f[x0]}]}}]; 
Rends = 
        Graphics[{{Green, Line[{{a0, c}, {a0, d}}]}, {Red, 
              Line[{{x0, c}, {x0, d}}]}, {Green, 
              Line[{{b0, c}, {b0, d}}]}}]; 
\(For[n = 1, 
      n ≤ 6, \(n++\), 
P[x_]\  = \ 
        Together[Pade[f[x], {x, x0, n + 1, n}]]; 
graph = 
        Plot[{f[x], P[x]}, {x, a, b}, PlotStyle -> {Magenta, Blue}, 
          PlotRange -> {{a, b}, {c, d}}, 
          Ticks -> {Range[\(-3\) π, 3  π, π], 
              Range[\(-0.5\), 1, 0.5]}, 
          DisplayFunction -> Identity]; 
Show[graph, 
        Cdot, Rends, 
        DisplayFunction -> $DisplayFunction]; \ \ 
Print["  f[x] = ", 
        f[x]]; 
Print["P"\_\(n + 1, n\), "[x] = ", 
        P[x]];\ \ \ ]\ \ \)

Animation 9.  ( Pade Approximation  Pade Approximation ).  Internet hyperlink.

Example 8.  Find Pade approximations for f[x] = Tan[x] expanded about  (Subscript[x, 0]) = 0.

Solution 8.

f[x_] = Tan[x];  
x0 = 0;  
a = -π; 
b = π; 
c = -10; 
d =  10; 
a0 = ((-π)/2); 
b0 = (π/2); 
Needs["Graphics`Colors`"];
Needs["Calculus`Pade`"];
Cdot = 
        Graphics[{{Red, PointSize[0.02], 
              Point[{x0, f[x0]}]}}]; 
Rends = 
        Graphics[{{Green, Line[{{a0, c}, {a0, d}}]}, {Red, 
              Line[{{x0, c}, {x0, d}}]}, {Green, 
              Line[{{b0, c}, {b0, d}}]}}]; 
\(For[n = 1, 
      n ≤ 5, \(n++\), 
P[x_]\  = 
        Together[
          Pade[f[x], {x, x0, n, n}]]; \ \ \ 
graph1 = 
        Plot[f[x], {x, a, \(-π\)\/2}, PlotStyle -> {Magenta}, 
          DisplayFunction -> Identity]; 
graph2 = 
        Plot[f[x], {x, \(-π\)\/2, π\/2}, PlotStyle -> {Magenta}, 
          DisplayFunction -> Identity]; 
graph3 = 
        Plot[f[x], {x, π\/2, b}, PlotStyle -> {Magenta}, 
          DisplayFunction -> 
            Identity]; 
r = π\/2; \ 
If[n > 1, 
        solset = 
          NSolve[Denominator[P[x]] == 0]; 
solset = 
          Sort[Abs[\(Transpose[solset]\)\_\(\([[\)\(1, All, 2\)\(]]\)\)]]; 
r = 
          solset\_\(\([[\)\(1\)\(]]\)\);\ ]; 
graph4 = 
        Plot[P[x], {x, a, \(-r\)}, PlotStyle -> {Blue}, 
          DisplayFunction -> Identity]; 
graph5 = 
        Plot[P[x], {x, \(-r\), r}, PlotStyle -> {Blue}, 
          DisplayFunction -> Identity]; 
graph6 = 
        Plot[P[x], {x, r, b}, PlotStyle -> {Blue}, 
          DisplayFunction -> Identity]; 
Show[graph1, 
        graph2, graph3, graph4, graph5, graph6, Cdot, Rends, 
        PlotRange -> {{a, b}, {c, d}}, 
        Ticks -> {Range[\(-π\), π, π\/2], 
            Range[\(-6\), 10, 2]}, 
        DisplayFunction -> $DisplayFunction]; \ \ 
Print["  f[x] = ", 
        f[x]]; 
Print["P"\_\(n, n\), "[x] = ", 
        P[x]];\ \ \ ]\ \ \)

Animation 12.  ( Pade Approximation  Pade Approximation ).  Internet hyperlink.

Example 9.  Find Pade approximations for f[x] = (e^x) expanded about  (Subscript[x, 0]) = 0.

Solution 9.

f[x_] = (E^x);  
x0 = 0;  
a = -2.0; 
b =  3.0; 
c = -4.0; 
d = 20.5; 
a0 = -5.0; 
b0 = 5.0; 
Needs["Graphics`Colors`"];
Needs["Calculus`Pade`"];
Cdot = 
        Graphics[{{Red, PointSize[0.02], 
              Point[{x0, f[x0]}]}}]; 
Rends = 
        Graphics[{{Green, Line[{{a0, c}, {a0, d}}]}, {Red, 
              Line[{{x0, c}, {x0, d}}]}, {Green, 
              Line[{{b0, c}, {b0, d}}]}}]; 
\(For[n = 1, 
      n ≤ 4, \(n++\), 
P[x_]\  = \ 
        Together[Pade[f[x], {x, x0, n, n}]]; \ \ 
graph1 = 
        Plot[{f[x], P[x]}, {x, a, b}, PlotStyle -> {Magenta, Blue}, 
          PlotRange -> {{a, b}, {c, d}}, 
          Ticks -> {Range[\(-2\), 3, 1], Range[0, 20, 5]}, 
          DisplayFunction -> Identity]; 
figure = 
        Show[graph1, Cdot, Rends, 
          DisplayFunction -> $DisplayFunction]; \ 
Print["  f[x] = ", 
        f[x]]; 
Print["P"\_\(n, n\), "[x] = ", 
        P[x]];\ \ \ ]\ \ \)

Animation 13.  ( Pade Approximation  Pade Approximation ).  Internet hyperlink.

Example 10.  Find Pade approximations f[x] = ArcTan[x] expanded about  (Subscript[x, 0]) = 0.

Solution 10.

f[x_] = ArcTan[x];  
x0 = 0;  
a = -2; 
b =  2; 
c = -1.6; 
d =  1.6; 
a0 = -1; 
b0 = 1; 
Needs["Graphics`Colors`"];
Needs["Calculus`Pade`"];
Cdot = 
        Graphics[{{Red, PointSize[0.02], 
              Point[{x0, f[x0]}]}}]; 
Rends = 
        Graphics[{{Green, Line[{{a0, c}, {a0, d}}]}, {Red, 
              Line[{{x0, c}, {x0, d}}]}, {Green, 
              Line[{{b0, c}, {b0, d}}]}}]; 
\(For[n = 1, 
      n ≤ 5, \(n++\), 
P[x_]\  = \ 
        Together[Pade[f[x], {x, x0, n, n}]]; \ \ 
graph = 
        Plot[{f[x], P[x]}, {x, a, b}, PlotStyle -> {Magenta, Blue}, 
          PlotRange -> {{a, b}, {c, d}}, 
          Ticks -> {Range[\(-1.5\), 1.5, 0.5], 
              Range[\(-π\)\/4, π\/4, π\/4]}, 
          DisplayFunction -> Identity]; 
Show[graph, 
        Cdot, Rends, 
        DisplayFunction -> $DisplayFunction]; \ 
Print["  f[x] = ", 
        f[x]]; 
Print["P"\_\(n, n\), "[x] = ", 
        P[x]];\ \ \ ]\ \ \)

Animation 16.  ( Pade Approximation  Pade Approximation ).  Internet hyperlink.

Example 11.  Find Pade approximations for f[x] = ArcSin[x] expanded about  (Subscript[x, 0]) = 0.

Solution 11.

f[x_] = ArcSin[x];  
x0 = 0;  
a = -1.5; 
b =  1.5; 
c = -2.2; 
d = 2.2; 
a0 = -1.0; 
b0 = 1.0; 
Needs["Graphics`Colors`"];
Needs["Calculus`Pade`"];
Cdot = 
        Graphics[{{Red, PointSize[0.02], 
              Point[{x0, f[x0]}]}}]; 
Rends = 
        Graphics[{{Green, Line[{{a0, c}, {a0, d}}]}, {Red, 
              Line[{{x0, c}, {x0, d}}]}, {Green, 
              Line[{{b0, c}, {b0, d}}]}}]; 
\(For[n = 1, 
      n ≤ 5, \(n++\), 
P[x_]\  = 
        Together[
          Pade[f[x], {x, x0, n, n}]]; \ \ \ \ 
graph1 = 
        Plot[{f[x], P[x]}, {x, \(-0.9999\), 0.9999}, 
          PlotStyle -> Magenta, 
          DisplayFunction -> Identity]; 
graph2 = 
        Plot[P[x], {x, \(-1.5\), 1.5}, PlotStyle -> Blue, 
          DisplayFunction -> Identity]; 
Show[graph1, 
        graph2, Cdot, Rends, PlotRange -> {{a, b}, {c, d}}, 
        Ticks -> {Range[\(-1.5\), 1.5, 0.5], 
            Range[\(-π\)\/2, π\/2, π\/4]}, 
        DisplayFunction -> $DisplayFunction]; \ 
Print["  f[x] = ", 
        f[x]]; 
Print["P"\_\(n, n\), "[x] = ", 
        P[x]];\ \ \ ]\ \ \)

Animation 17.  ( Pade Approximation  Pade Approximation ).  Internet hyperlink.

Example 12.  Find Pade approximations for f[x] = BesselJ[0, x] expanded about  (Subscript[x, 0]) = 0.

Solution 12.

f[x_] = BesselJ[0, x];  
x0 = 0;  
a = -10.2; 
b = 10.2; 
c = -0.8; 
d =  1.3; 
a0 = -11; 
b0 = 11; 
Needs["Graphics`Colors`"];
Needs["Calculus`Pade`"];
Cdot = 
        Graphics[{{Red, PointSize[0.02], 
              Point[{x0, f[x0]}]}}]; 
Rends = 
        Graphics[{{Green, Line[{{a0, c}, {a0, d}}]}, {Red, 
              Line[{{x0, c}, {x0, d}}]}, {Green, 
              Line[{{b0, c}, {b0, d}}]}}]; 
\(For[n = 1, 
      n ≤ 6, \(n++\), 
P[x_]\  = \ 
        Together[Pade[f[x], {x, x0, n + 1, n}]]; 
graph = 
        Plot[{f[x], P[x]}, {x, a, b}, PlotStyle -> {Magenta, Blue}, 
          PlotRange -> {{a, b}, {c, d}}, 
          Ticks -> {Range[\(-10\), 10, 2], Range[\(-0.5\), 1, 0.5]}, 
          DisplayFunction -> Identity]; 
Show[graph, 
        Cdot, Rends, 
        DisplayFunction -> $DisplayFunction]; \ \ 
Print["  f[x] = ", 
        f[x]]; 
Print["P"\_\(n, n\), "[x] = ", 
        P[x]];\ \ \ ]\ \ \)

Animation 18.  ( Pade Approximation  Pade Approximation ).  Internet hyperlink.

Example 13.  Find Pade approximations for f[x] = (1/(Sqrt[2  π])) (e^(-(x^2)/2)) expanded about  (Subscript[x, 0]) = 0.

Solution 13.

f[
          x_] = (1/(Sqrt[2  π])) (E^(-(x^2)/2));  
x0 = 0;  
a = -3.0; 
b =  3.0; 
c = -0.15; 
d = 0.5; 
a0 = -4.0; 
b0 = 4.0; 
Needs["Graphics`Colors`"];
Needs["Calculus`Pade`"];
Cdot = 
        Graphics[{{Red, PointSize[0.02], 
              Point[{x0, f[x0]}]}}]; 
Rends = 
        Graphics[{{Green, Line[{{a0, c}, {a0, d}}]}, {Red, 
              Line[{{x0, c}, {x0, d}}]}, {Green, 
              Line[{{b0, c}, {b0, d}}]}}]; 
\(For[n = 1, 
      n ≤ 6, \(n++\), 
P[x_]\  = \ 
        Together[Pade[f[x], {x, x0, n + 1, n}]]; 
graph = 
        Plot[{f[x], P[x]}, {x, a, b}, PlotStyle -> {Magenta, Blue}, 
          PlotRange -> {{a, b}, {c, d}}, 
          Ticks -> {Range[\(-3\), 3, 1], Range[0, 0.4, 0.1]}, 
          DisplayFunction -> Identity]; 
Show[graph, 
        Cdot, Rends, 
        DisplayFunction -> $DisplayFunction]; \ \ 
Print["  f[x] = ", 
        f[x]]; 
Print["P"\_\(n, n\), "[x] = ", 
        P[x]];\ \ \ ]\ \ \)

Animation 20.  ( Pade Approximation  Pade Approximation ).  Internet hyperlink.

Example 14.  Find Pade approximations for f[x] = (1/2)  + (1/2) Erf[(x/(Sqrt[2]))] expanded about  (Subscript[x, 0]) = 0.

Solution 14.

f[x_] = (1/2)  + (1/2) Erf[(x/(Sqrt[2]))];  
x0 = 0;  
a = -3.0; 
b =  3.0; 
c = -0.25; 
d = 1.25; 
a0 = -4. ; 
b0 = 4.0; 
Needs["Graphics`Colors`"];
Needs["Calculus`Pade`"];
Cdot = 
        Graphics[{{Red, PointSize[0.02], 
              Point[{x0, f[x0]}]}}]; 
Rends = 
        Graphics[{{Green, Line[{{a0, c}, {a0, d}}]}, {Red, 
              Line[{{x0, c}, {x0, d}}]}, {Green, 
              Line[{{b0, c}, {b0, d}}]}}]; 
\(For[n = 1, 
      n ≤ 6, \(n++\), 
P[x_]\  = \ 
        Together[Pade[f[x], {x, x0, n, n}]]; 
graph = 
        Plot[{f[x], P[x]}, {x, a, b}, PlotStyle -> {Magenta, Blue}, 
          PlotRange -> {{a, b}, {c, d}}, 
          Ticks -> {Range[\(-3\), 3, 1], Range[0, 0.8, 0.25]}, 
          DisplayFunction -> Identity]; 
Show[graph, 
        Cdot, Rends, 
        DisplayFunction -> $DisplayFunction]; \ \ 
Print["  f[x] = ", 
        f[x]]; 
Print["P"\_\(n, n\), "[x] = ", 
        P[x]];\ \ \ ]\ \ \)

Animation 21.   Pade Approximation  Pade Approximation ).  Internet hyperlink.

Animations (Pade Approximation  Pade Approximation).  Internet hyperlink to animations.

Research Experience for Undergraduates

Padé Approximation  Padé Approximation  Internet hyperlinks to web sites and a bibliography of articles.