My mathematica is doing weird things. Consider the function


Let's make a list out of this


when evaluated I get that the list points has these four entries


(* {{60., 0.0539289}, {61., 0.0534851}, {62., 0.00402142}, {63.,0.00395776}} *)

That is, the first two are above 0.05 and the last two are significantly smaller. Nonetheless, when I perform a ListPlot of points I get a plot where the four dots are way above 0.05. What is going on? Is this a bug?

ListPlot[points, PlotRange -> {0, 0.06}, PlotStyle -> Red]

enter image description here

  • $\begingroup$ Your Table is missing an iterator (n) and Gamma[-60,-60] doesn't evaluate for me. Did you transcribe your code correctly? $\endgroup$
    – Chris K
    Apr 20 '17 at 13:52
  • $\begingroup$ edited and Gamma[-60,-60] evaluates without any problems to me $\endgroup$ Apr 20 '17 at 14:04
  • $\begingroup$ In order to see the decimal output you show, you had to use N, otherwise you would see something with very large integers multiplied by Gama[-60,-60], so I added that line to the post. So if you use ListPlot[N@points] then you see what you expect $\endgroup$
    – Jason B.
    Apr 20 '17 at 14:04
  • 1
    $\begingroup$ @JasonB. ok. But why does not my code work? It should work shouldnt it? $\endgroup$ Apr 20 '17 at 14:06
  • $\begingroup$ @AnarchistBirdsWorshipFungus - you are multiplying very huge numbers (10^83) by very small numbers (10^-82), so you have to give some consideration to precision. I think that ListPlot is being smarter than N in this case, check the output from this: Block[{$MaxExtraPrecision = 100}, N[points, {∞, 5}] ] $\endgroup$
    – Jason B.
    Apr 20 '17 at 14:09

N @ points is using machine arithmetic and giving you bad values at 62 and 63. Changing over to Mathematica's arbitrary precision arithmetic, even at the fairly low precision of 20 digits,

N[points, 20]


{{60.000000000000000000, 0.053928873945168632029}, 
 {61.000000000000000000, 0.053485094513170474678}, 
 {62.000000000000000000, 0.053052093270633190146}, 
 {63.000000000000000000, 0.052629440880266559186}}

showing that your list plot is correct.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.