2
$\begingroup$

I am try to show a simple plane wave by DensityPlot the real part of $e^{ikr}$, $k=(k_x,k_y)$, $r=(x,y)$.

DensityPlot[Cos[(3 x + 4 y)], {x, -10, 10}, {y, -10, 10}, 
 PlotRange -> {{-10, 10}, {-10, 10}}, Frame -> False, 
 ColorFunction -> "BlueGreenYellow", WorkingPrecision -> 100]

Here $k=(3,4)$, It is supposed to be a clear stripe, however there is something wrong with the image as I show below.

enter image description here.

Then I tried to change $k$ to $k=(1,1)$, this time it looks correct.

DensityPlot[Cos[(x + y)], {x, -10, 10}, {y, -10, 10}, 
  PlotRange -> {{-10, 10}, {-10, 10}}, Frame -> False, 
  ColorFunction -> "BlueGreenYellow", WorkingPrecision -> 100]

enter image description here

I am wondering why it happens and how to change the code?

$\endgroup$

1 Answer 1

3
$\begingroup$

Does specifying PlotPoints work?

DensityPlot[Cos[(3 x + 4 y)], {x, -10, 10}, {y, -10, 10}, 
  PlotRange -> {{-10, 10}, {-10, 10}}, Frame -> False, 
  ColorFunction -> "BlueGreenYellow", WorkingPrecision -> 100, 
  PlotPoints -> 100]
$\endgroup$
2
  • $\begingroup$ It does! Thank you. $\endgroup$
    – p.s
    Commented Mar 15, 2020 at 22:53
  • $\begingroup$ you are welcome $\endgroup$
    – Rupesh
    Commented Mar 15, 2020 at 23:12

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