Why Is Mathematica Not Graphing This 3d Graph Correctly?

  • Context: Mathematica 
  • Thread starter Thread starter Ascendant0
  • Start date Start date
  • Tags Tags
    Mathematica
Click For Summary

Discussion Overview

The discussion revolves around issues related to graphing the function y = 5sin(1/x) in 3D using Mathematica. Participants explore the behavior of the graph, particularly focusing on the challenges of visualizing the function accurately in three dimensions.

Discussion Character

  • Technical explanation, Debate/contested, Experimental/applied

Main Points Raised

  • One participant notes that while the 2D graph appears as expected, the 3D graph does not seem to represent the function correctly, questioning the addition of the z-axis.
  • Another participant suggests increasing the number of plot points to improve the graph's accuracy, while also expressing skepticism about the function's overall appearance.
  • A different participant highlights strange behavior of the 3D graph near x = ±0.05, indicating that the graph may not be accurately representing y = 5sin(1/x) but rather a different function f(x,y) that includes y values not present in the original equation.
  • One participant mentions aliasing as a potential issue due to low sampling relative to the function's frequency.
  • Another participant provides a suggestion for increasing plot points in Mathematica and mentions the possibility of using MaxRecursion to address rapid changes in the function.
  • There is a concern expressed about the quality of the documentation for Mathematica, with one participant feeling that it leaves much to be desired.

Areas of Agreement / Disagreement

Participants express varying opinions on the reasons for the graphing issues, with some agreeing on the need for increased plot points and others questioning the representation of the function in 3D. The discussion remains unresolved regarding the exact cause of the discrepancies in the graph.

Contextual Notes

Limitations include potential misunderstandings of the function's behavior in 3D, the impact of sampling on graph accuracy, and the reliance on Mathematica's documentation, which some participants find inadequate.

Ascendant0
Messages
177
Reaction score
37
TL;DR
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
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   Reactions: Ascendant0
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.
 
As @Dale mentioned, this is a case of low sampling relative to the frequency of the function. It is known as aliasing.
 
  • Like
Likes   Reactions: Ascendant0
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?
 
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   Reactions: Ascendant0

Similar threads

  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 9 ·
Replies
9
Views
3K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 3 ·
Replies
3
Views
3K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 0 ·
Replies
0
Views
2K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 2 ·
Replies
2
Views
5K