1
$\begingroup$

Hello guys I am trying to make a 3d plot out of a 2d figure, but things are going sideways. My commands are

$Assumptions = Element[A | \[Epsilon] | m | Subscript[\[CapitalOmega],0] | \[Mu] | \ 
[Nu], Reals] && A > 0 && \[Epsilon] > 0 &&   0 < \[Nu] < \[Pi] && m > 0 &&  Subscript[\ 
[CapitalOmega], 0] > 0 && \[Mu] > 0;

(Variables used)

Np = 10^5;
\[Epsilon] =  1.0 10^(-1);
m = 6.49*10^(-26);
Subscript[a, s] = 9*10^(-6);
A = 5*10^(-6);
\[HBar] = 1.054571817*10^(-34) ;
Subscript[\[CapitalOmega], 0] =  2 \[Pi] 200;
Subscript[g, 2 D] =   Sqrt[((m Subscript[\[CapitalOmega], 0])/(2 \[Pi] \[HBar]))]*(4 \ 
[Pi] \[HBar]^(2) Subscript[a, s])/  m
\[Mu] = 9.0 10^(-11);

(Defining my function-Angular part)

Subscript[\[Xi], tf] =  Sqrt[(\[Mu] - (\[HBar] \[Epsilon])/(2 m) 
(Cos[\Nu]])^2)/Subscript[g, 2 D]]

(Ploting the angular part)

Plot[{Abs[Subscript[\[Xi], tf]^{2}]}, {\[Nu], 0, \[Pi]}, 
AxesStyle -> Arrowheads[{0.0, 0.03}], 
LabelStyle -> Directive[Black, 28, Bold], 
AxesLabel -> {Style[\[Nu], 28, Black], 
Style[Abs[(Subscript[\[Xi], TF])^2], 28, Black]}, 
PlotLegends -> Style[Abs[Subscript[\[Xi], TF]^2], 28, Black], 
PlotRange -> Automatic, PlotStyle -> {{Blue, Thick}}, 
ImageSize -> Large, 
Ticks -> {{0, \[Pi]/4, \[Pi]/2, 3*\[Pi]/4, \[Pi]}, Automatic}]

Plot of angular part

(Now the full funciton with radial part)

\[Psi][r_, \[Nu]_] = 
Abs[(((m Subscript[\[CapitalOmega], 0])/(\[Pi] \[HBar]))^(1/
     4) Exp[-((m Subscript[\[CapitalOmega], 0] )/(
     2 \[HBar]))*(r - A)^2] Subscript[\[Xi], tf])^2];

escalaTF = A + A/3;

(Density plot of full function)

DensityPlot[\[Psi][Sqrt[x^2 + (1 + \[Epsilon]) z^2], 
ArcCos[(z *Sqrt[1 + \[Epsilon]])/
Sqrt[x^2 + (1 + \[Epsilon]) z^2]]], {x, -escalaTF, 
escalaTF}, {z, -escalaTF, escalaTF}, Exclusions -> None, 
PlotPoints -> 100, ColorFunction -> "BlueGreenYellow", 
LabelStyle -> {23}, PlotLegends -> Automatic] 

This is ok, I want the full figure of this, the full sphere

(UP UNTIL THIS POINT IM GETTING WHAT I NEED, NOW THE PROBLEM BEGINS)

(I want the full 3d vizualization of my sphere, so I try the commands)

\[Psi][x_, z_] = \[Psi][Sqrt[x^2 + (1 + \[Epsilon]) z^2], 
ArcCos[(z *Sqrt[1 + \[Epsilon]])/Sqrt[x^2 + (1 + \[Epsilon]) z^2]]]\[Psi][x_, z_] = \ 
[Psi][Sqrt[x^2 + (1 + \[Epsilon]) z^2], 
ArcCos[(z *Sqrt[1 + \[Epsilon]])/Sqrt[x^2 + (1 + \[Epsilon]) z^2]]]

Raio = A^(2);

a[x_, z_] = 
Piecewise[{{\[Psi][x, Sqrt[(Raio - x^2)/(1 + \[Epsilon])]], 
x^2 + (1 + \[Epsilon]) z^2 < Raio}, {0, 
x^2 + (1 + \[Epsilon]) z^2 > Raio}}]

DensityPlot[
a[x, z], {x, -escalaTF, escalaTF}, {z, -escalaTF, escalaTF}, 
Exclusions -> None, ColorFunction -> "BlueGreenYellow", 
PlotRange -> Automatic, PlotPoints -> 100, LabelStyle -> {23}, 
PlotLegends -> Automatic] 

Density plot THIS FIGURE IS WRONG

So the idea is that in spherical coordinates the nu angle goes from 0 to pi in the z direction, and the phi angle gos from 0 to 2 pi in the x-y plane. I want to plot the full sphere seen from the ourside so i try to rotate the figure of the shell on the phi angle from 0 to 2 pi.

I hope you can note this is not the full sphere seen from the outside. It should have only a small blue circle on the south and north poles, and a yellow horizontal band at the equator and not a blue vertical band. I don't understand what I did wrong. This is not the usual spherical coordinates, since I added a distortion on the z direction to make an ellipsoid if wanted.

I also tried a 3d plot

Subscript[\[Psi], S][
r_, \[Nu]_] = ((
 m Subscript[\[CapitalOmega], 0])/(\[Pi] \[HBar]))^(1/4) Exp[-((
  m Subscript[\[CapitalOmega], 0] )/(
  2 \[HBar]))*(r - A)^2] Subscript[\[Xi], tf];

Subscript[\[Psi], S][x_, y_, z_] = 
Subscript[\[Psi], S][Sqrt[x^2 + y^2 + (1 + \[Epsilon]) z^2], 
ArcCos[(z *Sqrt[1 + \[Epsilon]])/
Sqrt[x^2 + y^2 + (1 + \[Epsilon]) z^2]]]

Raio = A^(2);

a[x_, y_, z_] = 
Piecewise[{{Subscript[\[Psi], S][x, 
 Sqrt[(Raio - x^2 - y^2)/(1 + \[Epsilon])]], 
x^2 + y^2 + (1 + \[Epsilon]) z^2 < Raio}, {0, 
x^2 + y^2 + (1 + \[Epsilon]) z^2 > Raio}}]

DensityPlot3D[
a[x, y, z], {x, -escalaTF, escalaTF}, {y, -escalaTF, 
escalaTF}, {z, -escalaTF, escalaTF}, 
ColorFunction -> "BlueGreenYellow", PlotRange -> Automatic, 
PlotPoints -> 50, LabelStyle -> {23}, PlotLegends -> Automatic]

3d plot the blue band shouldn't be there

But this has the same problem of the blue band going from north to south as in the other figure.

$\endgroup$
2
  • 1
    $\begingroup$ It's not really clear to me what you want to visualize exactly - the function you're defining is defined at every point in 3D space - what sphere are you plotting? Do you want to show the full 3D density cloud? The values of the function on a given spherical surface? Or something else? $\endgroup$
    – Lukas Lang
    Oct 3, 2022 at 18:22
  • $\begingroup$ Yes, the function is defined everywhere, but it forms a sphere of radius A. It is a bubble trap physics experiment of cold atom trapping. The second figure that I did is correct and shows a transversal cut of the sphere at y=0. I want the plot of the sphere as seen from the outside showing the yellow shell at the equator with the low blue points at the poles. So if you don't make the transversal cut what would you see in figure 2 looking from the outside? The colors are the values of the function on the shperical surface yes. $\endgroup$ Oct 3, 2022 at 18:31

1 Answer 1

3
$\begingroup$

Is this what you're after?

(* from the question *)
Np = 10^5;
ϵ = 1.0 10^(-1);
m = 6.49*10^(-26);
Subscript[a, s] = 9*10^(-6);
A = 5*10^(-6);
ℏ = 1.054571817*10^(-34);
Subscript[Ω, 0] = 2 π 200;
Subscript[g, 2 D] = 
  Sqrt[((m Subscript[Ω, 
         0])/(2 π ℏ))]*(4 π ℏ^(2) Subscript[a, 
       s])/m;
μ = 9.0 10^(-11);

Subscript[ξ, tf] = 
  Sqrt[(μ - (ℏ ϵ)/(2 m) (Cos[ν])^2)/
    Subscript[g, 2 D]];

ψ[r_, ν_] = 
  Abs[(((m Subscript[Ω, 0])/(π ℏ))^(1/
         4) Exp[-((m Subscript[Ω, 0])/(2 ℏ))*(r - 
           A)^2] Subscript[ξ, tf])^2];

escalaTF = A + A/3;

(* plotting code *)
DensityPlot3D[ψ[Sqrt[x^2 + y^2 + z^2], 
  ArcTan[z, Sqrt[x^2 + y^2]]], {x, -escalaTF, 
  escalaTF}, {y, -escalaTF, escalaTF}, {z, -escalaTF, escalaTF}, 
 ColorFunction -> "BlueGreenYellow", PlotRange -> Automatic, 
 LabelStyle -> {23}, PlotLegends -> Automatic]

$\endgroup$
3
  • 1
    $\begingroup$ Cool, but please add all necessary code to make that 3D graph. $\endgroup$ Oct 3, 2022 at 21:26
  • 2
    $\begingroup$ @AntonAntonov The rest of the code is in the OP. I figured it's not worth it to simply paste all of that into my answer. But since it's probably more convenient to have it all in one place, I have added it now $\endgroup$
    – Lukas Lang
    Oct 3, 2022 at 22:04
  • $\begingroup$ sweet figure that look really good! I think you did the job the yellow band goes around the full circle and the blue band disapeared thanks! I would just add the (1+\epsilon) geometrical distortion because my coordinatees are x^2+y^2+(1+\epsilon)z^2=A^2. But with some tests I did the figure looks the same with this value of \epsilon. $\endgroup$ Oct 4, 2022 at 17:12

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.