MathGroup Archive 2005

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

Search the Archive

Re: DigitDifferences?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg60754] Re: DigitDifferences?
  • From: "Ray Koopman" <koopman at sfu.ca>
  • Date: Tue, 27 Sep 2005 03:45:24 -0400 (EDT)
  • References: <dh2tfe$d69$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Paul Abbott wrote:
> I would like some suggestions on good implementations of the following
> idea: suppose that you have two numbers whose floating point
> representation has many common digits, say
>
>   2`50 Sum[(-1)^(k - 1)/(2 k - 1), {k, 1, 50000}]
>
>   1.5707863267948976192313211916397520520985833146875579625874449850433
>
> and
>
>   N[Pi/2, 50]
>
>   1.5707963267948966192313216916397514420985846996875529104874722962622
>
> Although these two numbers disagree in the 5th decimal place, they still
> have a great many common digits from that point onwards.
>
> (By the way, if you are using OS X you can use the "Evaluate to Text"
> MathService under the Services menu to do inline Mathematica evaluations
> in your favourite newsreader, avoiding much of the cutting and pasting
> to and from Mathematica. I used that here for the numerical evaluations.)
>
> I would like to display the differences between these numbers a la
> Borwein Borwein and Dilcher (1989) in "Pi, Euler numbers and asymptotic
> expansions", Amer. Math. Monthly 96 (1989), 681-687. To get an idea,
> paste either cell below into a Notebook. These attempts were done by
> hand -- so automated code for their production would be nice -- and they
> have one unfortunate problem: the spacing between numbers is not
> uniform. Suggestions for a DigitDifferences function most welcome.
>
> Cheers,
> Paul
>
> Here my two attempts to display the sort of formatting required -- there
> may be other better solutions:
>
>   Cell[BoxData[
>     FormBox[
>       RowBox[{"1.5707",
>         UnderscriptBox["8",
>           UnderscriptBox["_", "1"]], "632679489",
>         UnderscriptBox[
>           UnderscriptBox["7", "_"],
>           RowBox[{"-", "1"}]], "619231321",
>         UnderscriptBox["1",
>           UnderscriptBox["_", "5"]], "9163975",
>         UnderscriptBox[
>           UnderscriptBox["205", "_"],
>           RowBox[{"-", "61"}]], "209858",
>         UnderscriptBox["3314",
>           UnderscriptBox["_", "1385"]], "6876"}],
>       TraditionalForm]], "Text"]
>
>
>
>    Cell[BoxData[
>     FormBox[
>       RowBox[{"1.5707", " ",
>         UnderscriptBox["8",
>           UnderscriptBox["_", "1"]], " ", "632679489", " ",
>         OverscriptBox[
>           OverscriptBox["7", "_"], "1"], " ", "619231321", " ",
>         UnderscriptBox["1",
>           UnderscriptBox["_", "5"]], " ", "9163975", " ",
>         OverscriptBox[
>           OverscriptBox["205", "_"], "61"], " ", "209858", " ",
>         UnderscriptBox["3314",
>           UnderscriptBox["_", "1385"]], " ", "6876"}],
>       TraditionalForm]], "Text"]
>
> _______________________________________________________________________
> Paul Abbott                                      Phone:  61 8 6488 2734
> School of Physics, M013                            Fax: +61 8 6488 1014
> The University of Western Australia         (CRICOS Provider No 00126G)
> AUSTRALIA                               http://physics.uwa.edu.au/~paul

I suppose it depends on why one is comparing the numbers,
but I find this a little easier to read:

Cell["\n
      8         7         1       205      3314    \n
1.5707 632679489 619231321 9163975   209858    6876\n
      9         6         6       144      4699    \n",
Text, LineSpacing->{.40,0}]

Adjust LineSpacing to suit the output device.


  • Prev by Date: Re: Recursion problem in SymbolicSum
  • Next by Date: Re: DigitDifferences?
  • Previous by thread: Re: DigitDifferences?
  • Next by thread: Re: DigitDifferences?