4
$\begingroup$

When plotting in Mathematica I just got some "dark artifacts". Here is my code:

Plot3D[Exp[-100 x^2], {x, -5, 5}, {p, -5, 5}, PlotRange -> All, PlotPoints -> {100, 100}]

and the result isenter image description here

(I know that the 3D is useless here, but I minimized my actual code to the relevant problem). I have the feeling that it has something to do with the precision, when there is the transition from 10^-200 or so to 0 but increasing the WorkingPrecision didn't change anything.
I tried plotting in 2D from x = 2.3 and there is still an exponential function with value 10^-175 to see. When I plot from 3 to 4 (which is after the dark artifact line) then the 2D Plot says just zero.

I don't need to caluculate with super high precision, I just want to get rid of those dark strips.
I also tried to look for similar questions but couldnt find one, perhaps because I don't really know if artifacts is the right word.

$\endgroup$
  • 1
    $\begingroup$ it's just fp noise. Try plotting Chop@Exp[-100 x^2] to get rid of them. $\endgroup$ – rm -rf Nov 10 '13 at 17:22
10
$\begingroup$

Chop is useful here:

You can use it inside the Plot3D (as rm -rf wrote in the comment) for rounding small values of Exp

Plot3D[Chop@Exp[-100 x^2], {x, -5, 5}, {p, -5, 5}, PlotRange -> All, PlotPoints -> 100]

If your function is complicated you can use Chop as the post-processing function

Chop@Plot3D[Exp[-100 x^2], {x, -5, 5}, {p, -5, 5}, PlotRange -> All, PlotPoints -> 100]

In the both cases results are the same:

enter image description here

$\endgroup$
  • $\begingroup$ thx to you, ybeltukov, and rm -rf. i appreciate the post-processing option :) $\endgroup$ – user104857 Nov 10 '13 at 18:29

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.