Why Is Mathematica Not Graphing This 3d Graph Correctly?

  • Mathematica
  • Thread starter Ascendant0
  • Start date
  • Tags
    Mathematica
  • #1
Ascendant0
55
11
TL;DR Summary
Trying to graph y = 5sin(1/x) in both an 2d and 3d graph, and the 3d isn't looking right
As you can see from the image here, when I graph the 2d graph of y = 5sin(1/x), it comes out like I'd expect. However, when I graph it in a 3d graph, it doesn't look right at all. Can someone tell me why it isn't displaying right, or is it and I'm just missing something when I add the z axis?

Mathematica 1.JPG
 
Physics news on Phys.org
  • #2
You need to increase the number of plot points. But this function is just an ugly function, so don’t get your hopes up.
 
  • Like
Likes Ascendant0
  • #3
I have no explanation for that 3D graph. Its behavior near ##x=\pm 0.05## (##1/x \approx 20## radians) is strange. In the 3D plot, it is not graphing ##y=5\sin(1/x)##. It is graphing ##f(x,y)=5\sin(1/x)##, where ##y\in [-6,6]## doesn't even appear in the equation.
 
  • #4
As @Dale mentioned, this is a case of low sampling relative to the frequency of the function. It is known as aliasing.
 
  • Like
Likes Ascendant0
  • #5
Dale said:
You need to increase the number of plot points. But this function is just an ugly function, so don’t get your hopes up.
Thank you. How do I go about doing that in Mathematica? I'm thinking I probably need to actually learn the Mathematica language to have more versatility like that?
 
  • #6
I don't have experience with Mathematica and do not have it to test things on, but this looks like something to try:
Plot3D[ ... as before ...., PlotPoints ->{10000, 3}]
Click the PlotPoints option documentation here.
You might also try adding MaxRecursion -> r. That is supposed to help when the function changes rapidly.
PS. This looks like TERRIBLE documentation, leaving a lot to guess about. Am I missing something?
 
  • Like
Likes Ascendant0

Related to Why Is Mathematica Not Graphing This 3d Graph Correctly?

1. Why does Mathematica not show any graph when I try to plot a 3D graph?

This issue often arises due to problems with the function or the range specified for the variables. Ensure that the function is correctly defined for the range you are plotting. Check for any syntax errors or undefined variables. Also, adjust the plot range and consider the scale of the values being plotted; sometimes the output might be too small or too large to be visible on the default plot settings.

2. Why is the 3D graph in Mathematica missing some parts or seems incomplete?

This could be due to discontinuities or complex values within the specified range. Mathematica might not plot sections where the function fails to return real numbers. To resolve this, you can redefine the function to handle such values or adjust the domain to avoid these issues. Additionally, increasing the number of plot points using the PlotPoints option can help improve the completeness and resolution of the graph.

3. Why does the 3D graph look distorted or not as expected?

Distortion in 3D graphs can result from inappropriate scaling or aspect ratios. Use the AspectRatio and BoxRatios options to adjust the proportions of the axes. Also, the choice of viewing angles can significantly affect the appearance of the graph. Experiment with different values of the ViewPoint option to find a more suitable perspective.

4. Why is Mathematica taking a long time to render a 3D graph, or why does it crash during plotting?

Complex 3D graphs require significant computational power, especially if the function involves intricate calculations or a high-resolution mesh is used. To mitigate this, reduce the resolution by lowering the PlotPoints and MaxRecursion settings, or simplify the function if possible. Ensure that your computer has adequate resources (like RAM and CPU power) to handle the computations.

5. Why do the colors or lighting in the 3D graph not display as intended?

Coloring issues can arise from the automatic scaling of color functions relative to the values being plotted. Use the ColorFunctionScaling option to disable this feature if needed. For lighting, the default settings might not be suitable for all graphs. Customize the Lighting option to better highlight the features of your graph, adjusting the direction and intensity of light sources.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
3
Views
162
  • General Math
Replies
3
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
999
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
283
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
7
Views
3K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
3K
  • Introductory Physics Homework Help
Replies
6
Views
814
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
Back
Top