MathGroup Archive 1999

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Continued fraction problem

  • To: mathgroup at smc.vnet.net
  • Subject: [mg17134] Re: Continued fraction problem
  • From: Mark Sofroniou <marks>
  • Date: Sat, 17 Apr 1999 03:35:21 -0400
  • Organization: NETTuno
  • References: <7f1dqc$kp6@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Alan W.Hopper wrote:

>  A quite artificial but nevertheless interesting construction
> in recreational maths is the Champernowne Constant, defined
> in Eric Weisstein's Concise Encyc. of Math.,
> as the decimal 0.1234567891011... , obtained by concatenating
> the positive integers.
>
> The continued fraction expansion of this  number is stated to
> be ;  (0,8,9,1,149083,1,1,1,4,1,1,1,3,4,1,1,1,15, a 166 digit #,...,
> (position 41)a 2504 digit #,...,(position 163)a 33102 digit #,...
>
> ...text omitted...
>
> So I wonder if anyone knows a workable method of obtaining the correct
> continued fraction period of a difficult case like the Champernowne const.
>  with Mathematica, say up to that enormous 163 rd term, if it is at all
> feasible?
>
> Alan Hopper
> awhopper at hermes.net.au

Dear Alan. Thanks for this most interesting example. If you
are prepared to wait for version 4.0 then this is reasonably
straightforward (please don't ask me about release dates).

First set up a function to make a floating point number from
the first n digit blocks. This requires a bit of subtlety in
order to efficiently generate a number with many digits.

In[1]:=
  Champernowne[n_]:=
    Module[{cint, creal},
      (* Make an integer to represent the digit sequence *)
      cint = ToExpression[ StringJoin[Table[ ToString[i],{i, n}] ] ];
      (* Convert to an arbitrary precision floating point number
         and set the error *)
      creal = SetAccuracy[cint, 0];
      (* Renormalise and extract the mantissa m, where 1 > m >= 1/10 *)
      First[ MantissaExponent[creal] ]
    ];

Next generate the floating point approximation concatenated
from the first 17000 integers (this number was simply found
experimentally).

In[2]:= x = Champernowne[ 17000 ];//Timing

Out[2]= {3.06 Second, Null}

Next find the continued fraction, which is a kernel function
in version 4.0.

In[3]:= cf = ContinuedFraction[ x ];//Timing

Out[3]= {1.96 Second, Null}

The ContinuedFraction function will take care of error control for
inexact numbers by only returning partial quotients that are justified
by the precision of the input value - this was not the case in the
NumberTheory package in version 3.0.

This is the number of partial quotients that were generated.

In[4]:= Length[cf]

Out[4]= 355

This extracts the partial quotients of interest at specified positions.

In[5]:= cf2 = Part[ cf, {19, 41, 163}];

This evaluates approximate numbers at the extracted positions,
which seem to confirm the results that were expected.

In[6]:= N[ cf2 ]

                  165                      2503                      33101
Out[6]= {4.5754 10   , 4.457353800911179 10    , 4.445733537800891 10     }

Mark Sofroniou
Wolfram Research Inc.






  • Prev by Date: Math 3.0
  • Next by Date: Re: Ugly expressions. Was: Toghether, Apart ?
  • Previous by thread: Re: Continued fraction problem
  • Next by thread: Re(2): Re: Eigenvalue Problem