MathGroup Archive 2005

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

Search the Archive

Re: DigitDifferences?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg60714] Re: DigitDifferences?
  • From: "Carl K. Woll" <carlw at u.washington.edu>
  • Date: Sun, 25 Sep 2005 02:36:24 -0400 (EDT)
  • Organization: University of Washington
  • 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
>

Another idea is to change the line spacing and create "invisible" 
characters. The Cell below carries out this idea. If you change the 
background color to something other than white or black you can see the 
invisible characters.

Carl Woll
Wolfram Research

Cell[TextData[{
"\n",
StyleBox["0.00000000000000",
LineSpacing->{0, 0},
FontColor->GrayLevel[1]],
StyleBox["1",
LineSpacing->{0, 0}],
StyleBox["00000000000000000",
LineSpacing->{0, 0},
FontColor->GrayLevel[1]],
StyleBox["061",
LineSpacing->{0, 0}],
StyleBox["00000000000000",
LineSpacing->{0, 0},
FontColor->GrayLevel[1]],
StyleBox["\n",
LineSpacing->{0, 0}],
StyleBox["0.00000000000000",
LineSpacing->{0, 0},
FontColor->GrayLevel[1]],
StyleBox["_",
LineSpacing->{0, 0}],
StyleBox["00000000000000000",
LineSpacing->{0, 0},
FontColor->GrayLevel[1]],
StyleBox["___\n",
LineSpacing->{0, 0}],
StyleBox["\n",
LineSpacing->{1, 0}],
StyleBox["1.5707863267948976192313211916397520520985833146876\n",
LineSpacing->{0, 0}],
StyleBox["_",
LineSpacing->{0, 0},
FontColor->GrayLevel[1]],
StyleBox[".",
LineSpacing->{0, 0}],
StyleBox["____",
LineSpacing->{0, 0},
FontColor->GrayLevel[1]],
StyleBox["_",
LineSpacing->{0, 0}],
StyleBox["___________________",
LineSpacing->{0, 0},
FontColor->GrayLevel[1]],
StyleBox["_",
LineSpacing->{0, 0}],
StyleBox["________________",
LineSpacing->{0, 0},
FontColor->GrayLevel[1]],
StyleBox["____\n",
LineSpacing->{0, 0}],
StyleBox["\n",
LineSpacing->{1, 0}],
StyleBox["0.0000",
LineSpacing->{0, 0},
FontColor->GrayLevel[1]],
StyleBox["1",
LineSpacing->{0, 0}],
StyleBox["0000000000000000000",
LineSpacing->{0, 0},
FontColor->GrayLevel[1]],
StyleBox["5",
LineSpacing->{0, 0}],
StyleBox["0000000000000000",
LineSpacing->{0, 0},
FontColor->GrayLevel[1]],
StyleBox["1385",
LineSpacing->{0, 0}],
"\n"
}], "Text",
FontColor->GrayLevel[0]]

> 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
> 



  • Prev by Date: Re: What's wrong with this integral in mathematica?
  • Next by Date: Re: Recursion problem in SymbolicSum
  • Previous by thread: DigitDifferences?
  • Next by thread: Re: DigitDifferences?