1
$\begingroup$

My doubts here are related to the construction of 3D plots of Multivariable functions. As a consequence of that, I am going to keep these questions in this single post rather than creating several posts on the same topic.
It should be remarked that I have also read Mathematica's documentation and previous questions of Mathematica stack exchange. However, these latter did not help me.

With that said, suppose that we have the following multivariable function

$\displaystyle \psi(x,y)=\frac{-((2 (132 + 56 x^4 - 382 y + 394 y^2 - 171 y^3 + 26 y^4 + 6 x^3 (-47 + 31 y) + x^2 (608 - 782 y + 240 y^2) + x (-602 + 1130 y - 716 y^2 + 153 y^3)))}{((16 + 4 x^2 + 8 x (-2 + y) - 16 y + 5 y^2)^2 (5 x^2 + (3 - 2 y)^2 + x (-6 + 4 y))^2))}$

Based on the above, I ask the following questions:

  1. How may I construct a 3D plot of $\psi(x,y)$ so that positive values are represented by red colors and negative values are regarded to blue colors?

Here, I have tried to use the Plot3D command as follows,

Plot3D[-((2 (132 + 56 x^4 - 382 y + 394 y^2 - 171 y^3 + 26 y^4 + 
    6 x^3 (-47 + 31 y) + x^2 (608 - 782 y + 240 y^2) + 
    x (-602 + 1130 y - 716 y^2 + 153 y^3)))/((16 + 4 x^2 + 
    8 x (-2 + y) - 16 y + 5 y^2)^2 (5 x^2 + (3 - 2 y)^2 + 
    x (-6 + 4 y))^2)), {x, -1, 4}, {y, -1, 3}, ColorFunction -> Function[{x, y, z}, If[z > 0, Red, Blue]], AxesLabel -> (Style[#, Black, 20, Bold] & /@ {"x", "y", 
 "\[CapitalPsi]"}), TicksStyle -> Directive[Bold, Black],Epilog -> {Black, PointSize@Large, Point[{2, 1, 0}]}]

In this code, I have considered the ColorFunction command to represent the positive and negative values of $\psi(x,y)$. However, I am not quite sure whether this is indeed correct. As we may see, $\psi(x,y)$ is a negative function. Hence, should not we observe a predominantly blue color in the 3D plot of $\psi$?

  1. Is there a way to determine whether or not $\psi(x,y)$ is symmetric using Mathematica? That is to say, is the Swap command applicable to multivariable functions like $\psi$ ?

  2. How may one insert the point $(2,1)$ in the 3-D plot of $\psi(x,y)$? Here, I have applied the Epilog command, as one may see above. However, the point is not visiable.

Thanks and I look forward to hearing from you.

$\endgroup$
1
  • 2
    $\begingroup$ "How may I construct a 3D plot ... so that positive values are represented by red colors and negative values are regarded to blue colors?" - the trick I used here and in a few other answers is to use LogisticSigmoid[] + Blend[] in the ColorFunction; using a simpler example: Plot3D[Sin[x + Sin[y]], {x, -3, 3}, {y, -3, 3}, ColorFunction -> (Blend[{Blue, Gray, Red}, LogisticSigmoid[15 #3]] &), ColorFunctionScaling -> False] $\endgroup$ Jun 30, 2022 at 13:58

1 Answer 1

2
$\begingroup$
  • Use MeshFunctions -> Function[{x, y, z}, z], Mesh -> {{0}}, MeshShading -> {Blue, Red}] to set positive values are represented by red colors and negative values are regarded to blue colors.

  • Use plot2 to draw meshs.

  • Use Graphics3D to draw a point in 3D.

SetOptions[Plot3D, PlotPoints -> 50, MaxRecursion -> 2, 
 AxesLabel -> (Style[#, Black, 15, Bold] & /@ {"x", "y", 
     "Ψ"}), TicksStyle -> Directive[Bold, Black]]; plot1 =
  Plot3D[-((2 (132 + 56 x^4 - 382 y + 394 y^2 - 171 y^3 + 26 y^4 + 
         6 x^3 (-47 + 31 y) + x^2 (608 - 782 y + 240 y^2) + 
         x (-602 + 1130 y - 716 y^2 + 153 y^3)))/((16 + 4 x^2 + 
          8 x (-2 + y) - 16 y + 5 y^2)^2 (5 x^2 + (3 - 2 y)^2 + 
          x (-6 + 4 y))^2)), {x, -1, 4}, {y, -1, 3}, 
  MeshFunctions -> Function[{x, y, z}, z], Mesh -> {{0}}, 
  MeshShading -> {Blue, Red}];
plot2 = Plot3D[-((2 (132 + 56 x^4 - 382 y + 394 y^2 - 171 y^3 + 
          26 y^4 + 6 x^3 (-47 + 31 y) + x^2 (608 - 782 y + 240 y^2) + 
          x (-602 + 1130 y - 716 y^2 + 153 y^3)))/((16 + 4 x^2 + 
           8 x (-2 + y) - 16 y + 5 y^2)^2 (5 x^2 + (3 - 2 y)^2 + 
           x (-6 + 4 y))^2)), {x, -1, 4}, {y, -1, 3}, 
   PlotStyle -> None, MeshStyle -> White];
plot3 = Graphics3D[{Yellow, PointSize@Large, Point[{2, 1, 0}]}];
Show[plot1, plot2, plot3]

enter image description here

$\endgroup$
2
  • $\begingroup$ Hi @cvgmt, I hope you are doing well. Your answer is perfect! That's exactly what I was thinking. Thank you so much!!!! $\endgroup$
    – VH84
    Jun 30, 2022 at 14:42
  • $\begingroup$ @cvgmt.This year, I plan to write a scientific paper in which I will employ your suggestions. Based on that, I would like to acknowledge you. May you inform me your true real name and institution ? $\endgroup$
    – VH84
    Jun 30, 2022 at 14:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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