Help with Mathematica: Plotting Graphs & Changing Scales

  • Mathematica
  • Thread starter camillerinadia
  • Start date
  • Tags
    Mathematica
In summary, you can use the Ticks option to change the tick marks on the axis and the PlotRange option to change the range of the graph. To plot Ln x, use Plot[Log[Abs[x]], {x, -3, 3}] and to draw vectors and apply transformations, use transformation matrices and ListPlot.
  • #1
camillerinadia
22
0
Hello, I need help with Mathematica. I want to plot a graph of y=sin x, but on the x-axis, I want pi, 2pi, 3pi, etc and not 2, 4, 6, etc. How can I change this? and also how can I change the scale for any graphs? For example, if I currently plot y=e^x, I get a big range for the y-axis (4000), how can I alter this?? Thank you
 
Physics news on Phys.org
  • #2
For changing the tick marks for the axis use the Ticks option:
Code:
Plot[Sin[x], {x, -2 Pi, 2 Pi}, Ticks -> {{-2 Pi, -Pi, 0, Pi, 2 Pi}, {-1, 0, 1}}]

For changing the range use the PlotRange option:
Code:
Plot[E^x, {x, -10, 10}, PlotRange -> {0, 20}]
 
  • #3
oh thank you so much Moo of Doom. Do you know how to use LaTeX with mathematica? I'm having an error when I try to insert a mathematica file, with an extension .eps in LaTeX. This is because program is not finding a .eps file, or it is not recognizing it. Any ideas?
 
  • #4
You're welcome.

Nope, sorry. I have no experience with using [itex]\LaTeX[/itex] with Mathematica. Hopefully someone else here can help you with that problem. Good luck.
 
  • #5
Also, if I want to plot a graph of Ln x, I'm inserting Plot[Log[|x|],{x,-3,3}] and I'm having errors, what shall I use then? Thank you so much
 
  • #6
Abs[x] instead of |x|.
 
  • #7
Oh yes it worked! I've written Plot[{{Log[Abs[x]]} etc but the only problem is that the x and y-axis do not intersect. the graph is starting from x=1 onwards. Why is that and how can I alter it. Moreover how can I draw the asymptote on x=1 if for example I have to plot Log[x-1]
 
  • #8
Can I do transformations with Mathematica??

:cry::cry: Can anyone here help me? I want to draw two vectors on mathematica, namely (1,0) and (0,1), the i and j vectors and want to make some transformations on them, like for example reflections with x-axis, with y=x, etc. How can I do this?? I need urgent help here. Please help me!
 
  • #9
camillerinadia said:
Oh yes it worked! I've written Plot[{{Log[Abs[x]]} etc but the only problem is that the x and y-axis do not intersect. the graph is starting from x=1 onwards. Why is that and how can I alter it. Moreover how can I draw the asymptote on x=1 if for example I have to plot Log[x-1]
I don't think there is any Mathematica version that will show you anything but errors. You will have to specify at least the domain, and here Plot[Log[Abs[x]], {x, -1, 1}] just works fine.

camillerinadia said:
:cry::cry: Can anyone here help me? I want to draw two vectors on mathematica, namely (1,0) and (0,1), the i and j vectors and want to make some transformations on them, like for example reflections with x-axis, with y=x, etc. How can I do this?? I need urgent help here. Please help me!

You can apply transformation matrices to vectors, like this
{{1,0},{0,-1}} . {a, b}
returns the vector {a,b} mirrored in the x-axis, etc. You can use e.g. ListPlot to plot them and add some labels.
 

1. How do I plot a function in Mathematica?

To plot a function in Mathematica, use the Plot function followed by the desired function and its range of values. For example, to plot f(x) = x^2 from x = 0 to x = 10, you would use the command Plot[x^2, {x, 0, 10}].

2. Can I change the scale of my graph in Mathematica?

Yes, you can change the scale of your graph in Mathematica by using the PlotRange option in the Plot function. For example, Plot[x^2, {x, 0, 10}, PlotRange -> {0, 100}] would change the y-axis scale to range from 0 to 100.

3. How can I add labels and titles to my graph in Mathematica?

To add labels and titles to your graph in Mathematica, use the PlotLabels and PlotLabel options in the Plot function. For example, Plot[x^2, {x, 0, 10}, PlotLabel -> "Parabola", PlotLabels -> {"x-axis", "y-axis"}] would add a title and labels for the x-axis and y-axis.

4. Is it possible to plot multiple functions on the same graph in Mathematica?

Yes, you can plot multiple functions on the same graph in Mathematica by using the Plot function followed by a list of functions. For example, Plot[{x^2, x^3}, {x, 0, 10}] would plot both f(x) = x^2 and f(x) = x^3 on the same graph.

5. Can I change the color and style of my graph in Mathematica?

Yes, you can change the color and style of your graph in Mathematica by using the PlotStyle option in the Plot function. For example, Plot[x^2, {x, 0, 10}, PlotStyle -> {Red, Dashed}] would plot f(x) = x^2 with a red dashed line. You can also use other options like Thickness to change the line thickness or PlotLegends to add a legend to your graph.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
247
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
752
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
7
Views
957
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
692
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
733
Back
Top