Plotting functions such as y = f(x)

Suppose we want Mathematica to plot the function y = x**2 over the range of x values 0 < x < 10. Enter

   Plot[x^2, {x, 0, 10}]
and you'll get such a plot. (Note that Mathematica uses the ^ character to indicate raising a number to a power.)

The Plot command can be used to plot virtually any one-dimensional function:
   Plot[Sin[ x + 1/x ], {x, 0.5, 5}]
Let's take this command apart to see how its components work together.

The command takes two arguments, which are (in order) the function we want to plot and the range of x values we want to use:

   Plot[ <function>, <range> ]
The range is expressed as a list with three elements: the first element is the variable that will be plotted on the horizontal axis; the second element is the lower limit on this variable; and the third element is the upper limit on this variable.

The fact that the independent variable is specified as part of the plotting range means that we can call the independent variable anything we like:

   Plot[Sin[time], {time, 0, 4 Pi}]
(Note that Mathematica has memorized the value of pi. You just have to remember that the letter P is capitalized.)

Other parts of the Mathematica tutorial: