lesson 34: pad é meets chebyshevisrael/m210/lesson34.pdfcontinued fractions for numbers consider...

16
(1.2) (1.2) (1.1) (1.1) (1.3) (1.3) Lesson 34: Padé meets Chebyshev restart; with(numtheory): Continued fractions for numbers Consider any positive number x. We can represent it by a simple continued fraction with integer elements as follows. Let , so . If that is 0, then . Otherwise with . Let . Again, if , then , otherwise etc. The continued fraction for x terminates if and only if x is a rational number. For example: cfrac([3,7,110,3]); CFRAC([3,7,110,3]); 7291 2320 For an irrational number, the continued fraction does not terminate. It is eventually periodic if and only if x is a quadratic irrational, i.e. an irrational root of a quadratic polynomial with integer coefficients. cfrac(sqrt(3)); cfrac(sqrt(7)/5);

Upload: others

Post on 14-Aug-2020

4 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Lesson 34: Pad é meets Chebyshevisrael/m210/lesson34.pdfContinued fractions for numbers Consider any positive number x. We can represent it by a simple continued fraction with integer

(1.2)(1.2)

(1.1)(1.1)

(1.3)(1.3)

Lesson 34: Padé meets Chebyshev restart;

with(numtheory):

Continued fractions for numbersConsider any positive number x. We can represent it by a simple continued fraction with integer elements as follows. Let , so . If that is 0, then . Otherwise

with . Let . Again, if , then , otherwise

etc.

The continued fraction for x terminates if and only if x is a rational number. For example:cfrac([3,7,110,3]); CFRAC([3,7,110,3]);

72912320

For an irrational number, the continued fraction does not terminate. It is eventually periodic if and only if x is a quadratic irrational, i.e. an irrational root of a quadratic polynomial with integer coefficients.

cfrac(sqrt(3));

cfrac(sqrt(7)/5);

Page 2: Lesson 34: Pad é meets Chebyshevisrael/m210/lesson34.pdfContinued fractions for numbers Consider any positive number x. We can represent it by a simple continued fraction with integer

(1.4)(1.4)

(1.3)(1.3)1

You can get as many terms as you want.cfrac(sqrt(7)/5,15);

1

Page 3: Lesson 34: Pad é meets Chebyshevisrael/m210/lesson34.pdfContinued fractions for numbers Consider any positive number x. We can represent it by a simple continued fraction with integer

(1.8)(1.8)

(1.6)(1.6)

(1.9)(1.9)

(1.11)(1.11)

(1.7)(1.7)

(1.5)(1.5)

(1.4)(1.4)

(1.3)(1.3)

(1.10)(1.10)

For a more compact representation, use the quotients option.cfrac(sqrt(7)/5,30,quotients);

For a quadratic irrational, you can ask cfrac to give you the initial part and the repeating part.cfrac(sqrt(7)/5,periodic,quotients);

For non-quadratic irrationals, not much can be said. There are very few for which much is known.cfrac(2^(1/3),quotients,20);

If you could prove that the sequence of quotients here (or for any non-quadratic algebraic number) isunbounded, or that it is bounded, you would become rather famous. The same for these:

cfrac(Pi,quotients,20);

cfrac(gamma,quotients,20);

Some do have known patterns:cfrac(exp(1),quotients,20);

cfrac(tan(1),quotients,20);

The convergents of the continued fraction provide, in certain senses, the best rational approximations of an irrational number.

For any positive integers a and b with ,

For each n, , and at least one of or

Any rational

Page 4: Lesson 34: Pad é meets Chebyshevisrael/m210/lesson34.pdfContinued fractions for numbers Consider any positive number x. We can represent it by a simple continued fraction with integer

(2.5)(2.5)

(2.6)(2.6)

(2.4)(2.4)

(1.13)(1.13)

(2.2)(2.2)

(1.12)(1.12)

(1.14)(1.14)

(2.1)(2.1)

(1.4)(1.4)

(1.3)(1.3)

(2.3)(2.3)

in lowest terms with is a convergent of .

So e.g. for we get the following good approximations:S:= [seq(nthconver(cfrac(Pi,5),n),n=1..5)];

Digits:= 15; seq(evalf(abs(Pi - S[n])),n=1..5);

seq(evalf(abs(Pi-S[n])*denom(S[n])^2), n=1..5);

Continued fractions for analytic functions

Consider again our function f0.f0:= x -> arctan(2*x+1);

Q:=cfrac(f0(x),x,21,quotients);

CFRAC(Q[1..5]);

How do these come about? In a way it's rather analogous to what we had for numbers.f0(0);

f1:= solve(f0(x) = Pi/4 + x/f1,f1); series(f1, x);

f2:= solve(f1 = 1 + x/f2, f2); series(f2,x);

Page 5: Lesson 34: Pad é meets Chebyshevisrael/m210/lesson34.pdfContinued fractions for numbers Consider any positive number x. We can represent it by a simple continued fraction with integer

(2.8)(2.8)

(2.9)(2.9)

(2.6)(2.6)

(2.7)(2.7)

(2.10)(2.10)

(1.4)(1.4)

(1.3)(1.3)

f3:= solve(f2 = 1 + x/f3, f3); series(f3,x);

f4:= solve(f3 = -3 + x/f4, f4); series(f4,x);

And thus

which Maple prefers to write asCFRAC([(1/4)*Pi, [x, 1], [x, 1], [-x, 3], [4*x, 1],`...`]);

for nn from 1 to 20 do F[nn]:= nthconver(Q,nn) end do;

Page 6: Lesson 34: Pad é meets Chebyshevisrael/m210/lesson34.pdfContinued fractions for numbers Consider any positive number x. We can represent it by a simple continued fraction with integer

(2.6)(2.6)

(2.10)(2.10)

(1.4)(1.4)

(1.3)(1.3)

Page 7: Lesson 34: Pad é meets Chebyshevisrael/m210/lesson34.pdfContinued fractions for numbers Consider any positive number x. We can represent it by a simple continued fraction with integer

(2.6)(2.6)

(2.10)(2.10)

(1.4)(1.4)

(1.3)(1.3)

Page 8: Lesson 34: Pad é meets Chebyshevisrael/m210/lesson34.pdfContinued fractions for numbers Consider any positive number x. We can represent it by a simple continued fraction with integer

(2.6)(2.6)

(2.10)(2.10)

(1.4)(1.4)

(1.3)(1.3)

Page 9: Lesson 34: Pad é meets Chebyshevisrael/m210/lesson34.pdfContinued fractions for numbers Consider any positive number x. We can represent it by a simple continued fraction with integer

(2.6)(2.6)

(2.10)(2.10)

(1.4)(1.4)

(1.3)(1.3)

In many cases the continued fraction converges on a much larger interval than the Maclaurin series, but it's not always the case.

with(plots):

display([seq](plot(F[n]-f0(x),x=-2..20,-0.01..0.01,title=

('n'=n)),n=1..20),insequence=true,axes=box);

Page 10: Lesson 34: Pad é meets Chebyshevisrael/m210/lesson34.pdfContinued fractions for numbers Consider any positive number x. We can represent it by a simple continued fraction with integer

(2.11)(2.11)

(2.14)(2.14)

(2.6)(2.6)

(2.12)(2.12)

(2.13)(2.13)

(2.10)(2.10)

(1.4)(1.4)

(1.3)(1.3)

x0 5 10 15 20

0

n = 1

In this case it looks like it converges for , but at something strange happens (it's really rather a coincidence that was the left endpoint of the interval I arbitrarily chose). The denominators of every fourth convergent seems to be 0 there. I don't know why.

seq(eval(denom(F[n]),x=-1),n=1..20);

The convergents are a special case of Padé approximants.F[4];

with(numapprox):

pade(f0(x),x=0,[2,2]);

normal(%-F[4]);

Page 11: Lesson 34: Pad é meets Chebyshevisrael/m210/lesson34.pdfContinued fractions for numbers Consider any positive number x. We can represent it by a simple continued fraction with integer

(2.6)(2.6)

(2.18)(2.18)

(2.16)(2.16)

(2.15)(2.15)

(2.14)(2.14)

(2.17)(2.17)

(2.10)(2.10)

(1.4)(1.4)

(1.3)(1.3)

0

F[5]=pade(f0(x),x=0,[3,2]);

normal(lhs(%)-rhs(%));0

F[6] = pade(f0(x),x=0,[3,3]);

normal(lhs(%)-rhs(%));0

Padé meets ChebyshevMuch the same idea that takes Taylor series to Padé approximants can be used with Chebyshev series, giving us a Chebyshev-Padé approximant. Given the Chebyshev series for a function

on the interval [-1,1], we look for a rational function with and of given degrees m and n so

that the quotient agrees with the Chebyshev series for as many terms as possible. This can be done with and expressed in terms of Chebyshev polynomials. We'll take a partial sum

of the Chebyshev series for , and we'll want to determine coefficients

and so and . I'll "normalize" this so .

Thus we have unknowns, so in general we want equations: the coefficients of

in should be 0 for j from 0 to .

This is what the chebpade command will do, if instead of an integer n you give it a list .

For example, I'll try the case , for on [-1,1].

Digits:= 20:

chebpade(f0(x),x=-1..1,[8,8]);

Page 12: Lesson 34: Pad é meets Chebyshevisrael/m210/lesson34.pdfContinued fractions for numbers Consider any positive number x. We can represent it by a simple continued fraction with integer

(2.14)(2.14)

(2.6)(2.6)

(2.10)(2.10)

(1.4)(1.4)

(1.3)(1.3)

ChebPadeApp:= eval(%,T=orthopoly[T]);

The terms of the Chebyshev series of ChebPadeApp and should agree up to the coefficient of .

chebpade(ChebPadeApp,x=-1..1,18)-chebpade(f0,x=-1..1,18);

To see how well that approximates :

plot(ChebPadeApp-f0(x),x=-1..1);

Page 13: Lesson 34: Pad é meets Chebyshevisrael/m210/lesson34.pdfContinued fractions for numbers Consider any positive number x. We can represent it by a simple continued fraction with integer

(2.14)(2.14)

(2.6)(2.6)

(2.10)(2.10)

(1.4)(1.4)

(1.3)(1.3)

(3.1)(3.1)

x0 1

For comparison, here was the Chebyshev approximation for degree 16.ChebApp:= eval(chebpade(f0,x=-1..1,16),T=orthopoly[T]);

plot(ChebApp-f0(x),x=-1..1);

Page 14: Lesson 34: Pad é meets Chebyshevisrael/m210/lesson34.pdfContinued fractions for numbers Consider any positive number x. We can represent it by a simple continued fraction with integer

(2.14)(2.14)

(3.3)(3.3)

(2.6)(2.6)

(2.10)(2.10)

(1.4)(1.4)

(1.3)(1.3)

(3.2)(3.2)

x0 1

Actually, we wanted an error no more than so we're not quite there. Try , chebpade(f0(x),x=-1..1,[9,9]);

ChebPadeApp:= eval(%,T=orthopoly[T]);

Page 15: Lesson 34: Pad é meets Chebyshevisrael/m210/lesson34.pdfContinued fractions for numbers Consider any positive number x. We can represent it by a simple continued fraction with integer

(2.14)(2.14)

(3.3)(3.3)

(2.6)(2.6)

(2.10)(2.10)

(1.4)(1.4)

(1.3)(1.3)

plot(ChebPadeApp-f0(x),x=-1..1);

x0 1

Maple commands introduced in this lesson:quotients option for cfracperiodic option for cfrac chebpade(..., ..., [m,n]) in numapprox package

Page 16: Lesson 34: Pad é meets Chebyshevisrael/m210/lesson34.pdfContinued fractions for numbers Consider any positive number x. We can represent it by a simple continued fraction with integer

(2.14)(2.14)

(3.3)(3.3)

(2.6)(2.6)

(2.10)(2.10)

(1.4)(1.4)

(1.3)(1.3)