Plotting Functions in Mathematica: A Simple Guide

  • Mathematica
  • Thread starter clanijos
  • Start date
  • Tags
    Mathematica
In summary, the individual is seeking advice on how to plot a function in Mathematica, specifically x^2 or sqrt(x). They are directed to a related forum and given instructions on how to use the Plot function in Mathematica. They are also warned about potential errors and given a tip for changing the scale on the x-axis. They are asked for more specific information about their desired plot.
  • #1
clanijos
27
0
Could someone tell me how I would go about plotting a function in Mathematica over say, x^2? or sqrt(x)?

Thanks!
 
Physics news on Phys.org
  • #2
clanijos said:
Could someone tell me how I would go about plotting a function in Mathematica over say, x^2? or sqrt(x)?

Perhaps more appropriate posted here:

https://www.physicsforums.com/forumdisplay.php?f=189

To do this use

Plot[x^2,{x,-3,3}]

which is documented here

http://reference.wolfram.com/mathematica/ref/Plot.html

or when you are running the software hit <f1> and when the help browser pops up type in Plot or any other likely keyword you want documentation on.

Mathematica is fanatic about exact use of {} versus [] versus (), := versus = versus == versus even === and correct capitalization. Make an error in anyone of those and you will get possibly incomprehensible error messages.
 
  • #3
Thanks!

Edit: Gah, replied before I really looked over what you said! Yeah, I know how I should go about plotting a function like that. What I am looking for is something similar to LogPlot, but where the scale of the x-axis can be changed to another function.
 
Last edited:
  • #4
clanijos said:
What I am looking for is something similar to LogPlot, but where the scale of the x-axis can be changed to another function.
You want to compress the scale on the x-axis, but not logarithmically? It's difficult to see why you might want to do that. I think you would have to do the compression yourself and then re-label the axis after the computer has done the plotting.

Exactly what are you wanting to plot?
 
  • #5


Sure, I'd be happy to help! To plot a function in Mathematica, you can use the "Plot" command. For example, to plot the function x^2 over a range of x values, you would type "Plot[x^2, {x, -5, 5}]" into the Mathematica notebook. This will create a graph of the function with x values ranging from -5 to 5.

To plot the function sqrt(x), you would follow the same process but replace "x^2" with "Sqrt[x]". You can also adjust the range of x values to plot by changing the numbers in the curly brackets after the function.

Additionally, you can add options to the "Plot" command to customize your graph, such as adding labels or changing the color and style of the plot. The Mathematica documentation has more information on the different options available for plotting functions.

I hope this helps and happy plotting!
 

Related to Plotting Functions in Mathematica: A Simple Guide

1. What is Mathematica and what is it used for?

Mathematica is a software program used for mathematical and scientific calculations, data analysis, and visualization. It also has programming capabilities and can be used to create interactive simulations and models.

2. How do I perform basic calculations in Mathematica?

To perform basic calculations, you can simply type in the expression using Mathematica's syntax, such as "2+2" or "3*x^2". You can also use the built-in functions and operators, such as "Sin[x]" or "Sqrt[9]".

3. Can Mathematica handle large datasets?

Yes, Mathematica has powerful data analysis capabilities and can handle large datasets with millions of data points. It also has features for data cleaning, visualization, and statistical analysis.

4. How can I plot mathematical functions in Mathematica?

To plot a mathematical function, you can use the "Plot" function and specify the function expression and range of values for the variable. For example, "Plot[Sin[x], {x, 0, 2 Pi}]" will plot the sine function from 0 to 2π.

5. Is Mathematica suitable for beginners?

While Mathematica has a steep learning curve for beginners, it has a user-friendly interface and provides helpful documentation and tutorials. With some practice and familiarity with its syntax, beginners can perform basic calculations and use its built-in functions.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
312
  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
920
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
787
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
461
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
13
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
1K
Back
Top