1
$\begingroup$

I am trying to make a 3D plot of an expression but the the plot has some holes in it. I have asked a similar question before according to which I should adjust my PlotRange. I did that too. I have taken PlotRange->All but it didn't work. I also tried Full and Automatic for PlotRange but that didn't help also. Then I tried taking some values of plot range manually like {-5,5}, {-0.1,0.1}, {-0.2,0.2} etc. but either they don't fix the problem or alter the plot's shape. Firstly, I was taking PlotPoints->100 for high-quality plots but then I changed its values to see what happens and when I chose PlotPoints->20, the appearance of holes was reduced but they were still there. I tried some other values of PlotPoints as well but they didn't disappear. Please tell me how to solve this issue?


\[Gamma] = x + I*y; 

z = 1; 

\[Theta] = Pi/4; 

m = 3; 

a = Sum[((1/(j!*l!))*Binomial[m, j]*Binomial[m, l]*Conjugate[z*Sin[\[Theta]]*Tan[\[Theta]]]^j*(-2*\[Gamma] + z*Cos[\[Theta]])^j*(-2*Conjugate[\[Gamma]] + Conjugate[z]*Cos[\[Theta]])^l*
       HypergeometricU[-l, 1 + j - l, (-2*\[Gamma] + z*Cos[\[Theta]])*(-2*Conjugate[\[Gamma]] + Conjugate[z]*Cos[\[Theta]])]*(z*Sin[\[Theta]]*Tan[\[Theta]])^l)/
      ((-2*\[Gamma] + z*Cos[\[Theta]])*(-2*Conjugate[\[Gamma]] + Conjugate[z]*Cos[\[Theta]]))^l, {j, 0, m}, {l, 0, m}]/E^(2*Abs[\[Gamma] - z*Cos[\[Theta]]]^2)/
   (Pi*Sum[((1/(k!*l!))*(-1)^k*Binomial[m, k]*Binomial[m, l]*Conjugate[z*Sin[\[Theta]]*Tan[\[Theta]]]^l*((-z)*Cos[\[Theta]])^l*(Conjugate[z]*Cos[\[Theta]])^k*
       HypergeometricU[-k, 1 - k + l, (-z)*Conjugate[z]*Cos[\[Theta]]^2]*(z*Sin[\[Theta]]*Tan[\[Theta]])^k)/((-z)*Conjugate[z]*Cos[\[Theta]]^2)^k, {l, 0, m}, {k, 0, m}]);

Plot3D[a, {x, -5, 5}, {y, -5, 5}, PlotRange -> All, PlotPoints -> 20]
$\endgroup$
13
  • $\begingroup$ The holes appear, where a is getting complex, try to plot Re[a] $\endgroup$
    – Andreas
    May 23 at 14:54
  • 1
    $\begingroup$ You can also try Plot3D[a //Chop,{x,...},{y,...}...] $\endgroup$
    – Andreas
    May 23 at 15:09
  • 1
    $\begingroup$ I also recommend that you use Simplify in the definition of a Look at LeafCount /@ {a, a // Simplify} $\endgroup$
    – Bob Hanlon
    May 23 at 16:38
  • 1
    $\begingroup$ Please see this answer Step-by-step: 1._ Make a copy of the cell containing the code to be posted 2._ Convert the copied cell to raw input form 3._ Choose Convert To > Raw InputForm from the Cell menu or from the contextual (right mouse clidk) menu 4._ Select the code and do a normal copy (do not use Copy As) 5._ Paste form the clipboard in the Mathematica.SE editor pane 6._ Delete the raw input form cell from the notebook. $\endgroup$
    – rhermans
    May 23 at 17:11
  • 1
    $\begingroup$ The LeafCount was used to reflect the different computation complexity of the expression before and after simplification, (i.e., {44338, 6732}). Whether or not simplified, using arbitrary precision rather than machine precision would also resolve your issue: Plot3D[a, {x, -4, 4}, {y, -4, 4}, PlotRange -> All, PlotPoints -> 20, WorkingPrecision->15] However, it is much more efficient when Simplify is included in the definition of a $\endgroup$
    – Bob Hanlon
    May 23 at 17:45

1 Answer 1

5
$\begingroup$

The function a shows in some regions of the x-y plane small imaginary parts. You can get rid of them by modifying the plot command to

Plot3D[a//Chop, {x, -4, 4}, {y, -4, 4},PlotRange->All]
$\endgroup$

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.