Skip to main content
11 events
when toggle format what by license comment
Dec 22, 2013 at 4:35 comment added Rojo Any theories about why Mathematica automatically goes the weird way?
Dec 21, 2013 at 4:11 comment added Silvia FWIW, here is my code: res=Table[MapThread[#1@#2&,{{(len=Length[#];#)&[RealDigits[#,2][[1]]]&,RealDigits[#,2][[1]]&,RealDigits[#,2][[1,1;;len]]&},{Divide[k,SetPrecision[n,MachinePrecision]],k/SetPrecision[n,MachinePrecision],N[k/n,100]}}]//Length/@{LongestCommonSubsequence[#[[1]],#[[3]]],LongestCommonSubsequence[#[[2]],#[[3]]]}&//#1-#2&@@#&,{n,1,200},{k,1,200}]
Dec 21, 2013 at 3:58 comment added Silvia Hmm.. That is different from my observation.. I compared all Divide[k, n] vs k/n for k and n both from 1 to 200. Looks like the chance is 50-50.
Dec 21, 2013 at 3:55 comment added Szabolcs @MarkAdler Some more observations: HoldComplete[Divide[a,b]] prints as HoldComplete[$\frac{a}{b}$], but it does actually keep the internal representation as Divide (as shown by FullForm). However, typing HoldComplete[Divide[a,b]] and then pressing Command-Shift-N to convert to StandardForm destroys Divide, and replaces it with /. Evaluating it and using FullForm gives Times[a,Power[b,-1]].
Dec 21, 2013 at 3:31 comment added Mark Adler The documentation (which we have already established as incorrect) indicates that $a\div b$ (a[esc]div[esc]b) is another way to write Divide[a,b]. However it is actually interpreted as a/b. I think that documentation needs some work.
Dec 21, 2013 at 3:22 comment added Szabolcs @Silvia If you compare the binary digits directly, using RealDigits[..., 2], you'll see that all binary digits of Divide[15,137.] are correct, but the last two binary digits of 15/137. are wrong. Generally the Divide form is more likely to be correct because it is a result of a single division. The / form is the result of two operations: a division and a multiplication, so roundoff errors may accumulate.
Dec 21, 2013 at 3:15 comment added Silvia By camparing with N[15/137, 100], 15/137. looks preciser. Does a/b always preciser than Divide[a, b] for machine-precision a and b?
Dec 21, 2013 at 3:10 comment added Mark Adler Sure enough. Divide[15, 137.] - 15/137. gives 1.38778*10^-17. Fascinating.
Dec 21, 2013 at 3:03 vote accept Mark Adler
Dec 21, 2013 at 2:52 history edited Szabolcs CC BY-SA 3.0
added 278 characters in body
Dec 21, 2013 at 2:46 history answered Szabolcs CC BY-SA 3.0