DigitDifferences?

• To: mathgroup at smc.vnet.net
• Subject: [mg60677] DigitDifferences?
• From: Paul Abbott <paul at physics.uwa.edu.au>
• Date: Sat, 24 Sep 2005 02:55:22 -0400 (EDT)
• Organization: The University of Western Australia
• Sender: owner-wri-mathgroup at wolfram.com

```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
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"}],

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"}],