Mathematica Question: Wrapping Density Plot on Sphere

In summary, the speaker is new to Mathematica and is trying to make models of white dwarf spherical harmonics. They have attempted to use SphericalPlot3D but are now looking for a way to wrap a density plot over a sphere and control the values with sliders. They are seeking advice on how to do this and are considering shifting their post to the programming section for more responses.
  • #1
dewood88
1
0
I am new to Mathematica and I am trying to make models of white dwarf spherical harmonics similar to the ones on this site: http://whitedwarf.org/education/vis/index.html. So far the closest thing I have is this:

SphericalPlot3D[3, {\[Theta], 0, \[Pi]}, {\[Phi], 0, 2 \[Pi]},
Mesh -> None,
ColorFunction ->
Function[{x, y, z, \[Theta], \[Phi], r},
Evaluate[
Hue@Rescale[
Arg@Re[SphericalHarmonicY[3,
1, \[Theta], \[Phi]]], {-\[Pi], \[Pi]}]]],
ColorFunctionScaling -> False, PlotPoints -> 35]

However, the color scaling does not allow a blending of the two colors, so instead I would like to wrap a density plot like this one:

Manipulate[
DensityPlot[
Re[SphericalHarmonicY[l, m, \[Theta], \[Phi]]], {\[Theta],
0, \[Pi]}, {\[Phi], 0, 2 \[Pi]},
FrameLabel -> {\[Theta], \[Phi]}], {l, 1, 10, 1}, {m, 0, 10, 1}]

over a sphere of radius 3 and be able to control the l and m values with sliders ("Manipulate"). Does anyone know a simple way to do this? Any helpful hints would be greatly appreciated! :)
 
Physics news on Phys.org
  • #2
You might want to shift this post to 'programming' section. May get more responses there
 
  • #3


I can provide some insights and suggestions for your Mathematica question. First, it is great that you are using Mathematica for your models of white dwarf spherical harmonics. Mathematica is a powerful tool for scientific visualization and data analysis.

To wrap a density plot on a sphere, you can use the function SphericalPlot3D with the option ColorFunction. This will allow you to specify a color function that depends on the coordinates of the sphere, which you can use to map the density values from the density plot onto the sphere's surface.

Here is an example code that wraps a density plot on a sphere:

SphericalPlot3D[3, {\[Theta], 0, \[Pi]}, {\[Phi], 0, 2 \[Pi]},
Mesh -> None,
ColorFunction ->
Function[{x, y, z, \[Theta], \[Phi], r},
ColorData["TemperatureMap"][DensityPlot[
Re[SphericalHarmonicY[3, 1, \[Theta], \[Phi]]], {\[Theta],
0, \[Pi]}, {\[Phi], 0, 2 \[Pi]},
ColorFunctionScaling -> False,
PlotPoints -> 35][[1, 1, 3]]]],
ColorFunctionScaling -> False]

In this code, we use the ColorData function to specify a color map (in this case, the "TemperatureMap") and then we use the DensityPlot function to generate the density values for the spherical harmonics. The DensityPlot function returns a Graphics object, and we extract the color values from the Graphics object using Part ([[1,1,3]]). This allows us to map the density values onto the sphere's surface.

You can also use the Manipulate function to control the l and m values, as shown in your example code. Here is an example code that combines both the density plot and the spherical harmonics:

Manipulate[
SphericalPlot3D[3, {\[Theta], 0, \[Pi]}, {\[Phi], 0, 2 \[Pi]},
Mesh -> None,
ColorFunction ->
Function[{x, y, z, \[Theta], \[Phi], r},
ColorData["TemperatureMap"][DensityPlot[
Re[SphericalHarmonicY[l, m, \[Theta],
 

Related to Mathematica Question: Wrapping Density Plot on Sphere

1. What is Mathematica?

Mathematica is a computational software program used for various mathematical, scientific, and engineering calculations. It is developed and marketed by Wolfram Research and has been widely used in fields such as physics, engineering, economics, and data science.

2. What is a Wrapping Density Plot?

A Wrapping Density Plot is a type of plot in Mathematica that visualizes the density of a three-dimensional function on a sphere. It maps the function onto the surface of the sphere and uses color to represent the density of the function at each point on the sphere.

3. How do I create a Wrapping Density Plot on a Sphere in Mathematica?

To create a Wrapping Density Plot on a Sphere in Mathematica, you can use the built-in function SphericalPlot3D. This function takes in the function you want to visualize, the range of values for the spherical coordinates, and other customizable options such as color scheme and mesh density.

4. What are the advantages of using a Wrapping Density Plot on a Sphere?

A Wrapping Density Plot on a Sphere can provide a more intuitive and visually appealing representation of a three-dimensional function compared to a traditional 2D plot. It also allows for a better understanding of the distribution of the function on the surface of the sphere.

5. Can I customize the appearance of a Wrapping Density Plot on a Sphere?

Yes, you can customize the appearance of a Wrapping Density Plot on a Sphere by adjusting various options such as color scheme, mesh density, and lighting. You can also add annotations and labels to the plot to provide more context and information.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
411
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
407
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
Replies
2
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
6
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
2K
Back
Top