Mathematica Plots Wrong: How is it Possible?

In summary, Mathematica can plot a graph with a function that contains a square root of a negative number, even though the function is only defined for x <= 0. This is possible because when x > 0, the function can be rewritten using Euler's formula as 2Cos[Sqrt[x]], which is defined for all real values of x > 0.
  • #1
nikolafmf
114
0
I said to Mathematica to plot a graph as this:

Plot[Exp[-Sqrt[-x]] + Exp[Sqrt[-x]] - 2 == 0, {x, -10, 40}].

You can see that there is square root of -x, which should mean that the function is defined only for x<=0. But no, Mathematica would plot a curve also for positive values of x. How is this possible at all?
 
Physics news on Phys.org
  • #2
Note that when x > 0, we have Exp[-Sqrt[-x]] + Exp[Sqrt[-x]] = Exp[-iSqrt[x]] + Exp[iSqrt[x]] = 2Cos[Sqrt[x]], which is defined and a real number for all real values of x > 0. The latter equality is a result of Euler's formula.
 
  • Like
Likes 1 person

1. Why is Mathematica plotting my data inaccurately?

There could be several reasons for this. One possibility is that there is an error in the input data. Check to make sure that the data is correctly formatted and that there are no missing or incorrect values. Additionally, make sure that you are using the correct plot type for your data. Another possibility is that there is an issue with your code. Check for any typos or errors in your code that could be causing the incorrect plot.

2. Is it possible that my computer is causing the incorrect plots?

It is unlikely that your computer is causing the issue, as long as it meets the minimum requirements for running Mathematica. However, if your computer is running low on memory or processing power, it may have difficulty accurately plotting large or complex data sets. In this case, try closing other programs and freeing up memory before running the plot again.

3. Can incorrect plot settings cause my data to be plotted incorrectly?

Yes, incorrect plot settings can definitely affect the accuracy of your plot. Make sure that you have chosen the appropriate plot type and that all of the settings, such as axis labels and scaling, are correct for your data. You may also want to try adjusting the plot settings to see if it improves the accuracy of your plot.

4. How can I troubleshoot my incorrect plots in Mathematica?

Start by checking your input data and code for any errors. If everything appears to be correct, try simplifying your code or breaking it down into smaller parts to isolate the issue. You can also consult the Mathematica documentation or online forums for help with troubleshooting specific plot types or issues.

5. Is it possible to fix incorrect plots in Mathematica?

Yes, it is possible to fix incorrect plots in Mathematica. Once you have identified the issue, you can make the necessary changes to your data or code to correct the plot. You may also want to save your work periodically as you make changes, so that you can easily revert back if needed. It may also be helpful to consult with other Mathematica users or seek assistance from the Mathematica support team if you are having trouble fixing the issue on your own.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
248
  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
3K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
10
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
877
  • MATLAB, Maple, Mathematica, LaTeX
Replies
18
Views
4K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
3
Views
1K
Back
Top