0
$\begingroup$

I have a function in cylindrical co-ordinate with 3 independent coorrdinates, give by:

f[r_, z_, v_] := -(Sqrt[E^(-(r^2/32) - z^2/32) - v^2]/\[Pi]) + 
  45/392 r^2 Sqrt[E^(-(r^2/32) - z^2/32) - v^2] - (
  1.5957691216057308` E^(-(r^2/32) - z^2/
    32) (-1 - E^(r^2/32 + z^2/32) + E^(r^2/32 + z^2/32) v^2))/(1 - 
    2 (-E^(-(r^2/32) - z^2/32) + v^2))^(3/2) - (
  2 Sqrt[E^(-(r^2/32) - z^2/32) - 
    v^2] (1 - 2 Log[-4 (-E^(-(r^2/32) - z^2/32) + v^2)]))/(49 \[Pi])

As this has 3 independent variables, I need to have a 4D plot. Hence I used DensityPlot3D.

[![DensityPlot3D\[ftrGenK\[\[2\]\], {r, -20, 20}, {z, -20, 20}, {v, -1, 1}, 
 AxesLabel -> {"r", "z", "v"}, 
 AxesStyle -> Directive\[Black, FontSize -> 15\], 
 AxesStyle -> Directive\[Black, FontSize -> 15\], 
 ColorFunction -> "Rainbow", LabelStyle -> Directive\[Bold, Black\], 
 TicksStyle -> Directive\[Thick, Black, 15\], PlotLabel -> "\[Kappa\]=2",
  PlotLegends -> 
  BarLegend\[{"Rainbow", {0, 1}}, LegendMarkerSize -> 150, 
   LegendMargins -> {{0, 0}, {20, 0}}\]\]][1]][1]

I got a plot like this:

As my equation is in cylindrical coordinates, is this correct way to do this?? I think the plot have come issue. Can you please help me Thanks in advance

$\endgroup$
1
  • $\begingroup$ First, in cylindrical coordinate we have three variables with specific ranges z(0, infinity), \theta (0,2pi) and r (0, infinity) . You have to define this clearly. Your code is a mess, you did not define ftrGenK[]. Can you revise your code and make it more clear? $\endgroup$
    – MMA13
    Commented Aug 5, 2018 at 13:20

1 Answer 1

1
$\begingroup$

In Cartesian coordinates, it looks like two eggs in a frying pan

f[r_, z_, v_] := -(Sqrt[E^(-(r^2/32) - z^2/32) - v^2]/\[Pi]) + 
  45/392 r^2 Sqrt[
    E^(-(r^2/32) - z^2/32) - 
     v^2] - (1.5957691216057308` E^(-(r^2/32) - z^2/32) (-1 - 
       E^(r^2/32 + z^2/32) + E^(r^2/32 + z^2/32) v^2))/(1 - 
      2 (-E^(-(r^2/32) - z^2/32) + v^2))^(3/2) - (2 Sqrt[
      E^(-(r^2/32) - z^2/32) - v^2] (1 - 
       2 Log[-4 (-E^(-(r^2/32) - z^2/32) + v^2)]))/(49 \[Pi])
DensityPlot3D[
 f[Sqrt[x^2 + y^2], z, ArcTan[y/x]], {x, 0, 20}, {y, -10, 
  10}, {z, -10, 10}, AxesLabel -> {"x", "y", "z"}, 
 AxesStyle -> Directive[Black, FontSize -> 15], 
 AxesStyle -> Directive[Black, FontSize -> 15], 
 ColorFunction -> "Rainbow", LabelStyle -> Directive[Bold, Black], 
 TicksStyle -> Directive[Thick, Black, 15], PlotLabel -> "\[Kappa]=2",
  PlotLegends -> 
  BarLegend[{"Rainbow", {0, 1}}, LegendMarkerSize -> 150, 
   LegendMargins -> {{0, 0}, {20, 0}}]]

fig1

$\endgroup$
1
  • $\begingroup$ Thanks a lot.. I had to make some changes.. but finally it worked. Thank you for the idea. Thank you $\endgroup$ Commented Aug 7, 2018 at 12:26

Your Answer

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

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