How to |
Enter Ranges and Options for Functions
The main expression or object that a built-in Mathematica
function acts on is given as the first argument to the function. As part of the syntax, a built-in Mathematica
function can take more arguments, which may be required or may be generalizations or extensions of the function. After the arguments come options, which allow further extensions to control the behavior of the function.
Many visualization functions in Mathematica
require you to enter the bounds over which to create a plot as the second argument to the plotting function.
is the first argument in Plot
, while the second argument
gives the variable and the range for the plot:
If you try to use Plot
without specifying a range, Mathematica
produces an error message:
Other visualization functions are similar in requiring a range to plot over.
Here, a parametric curve is plotted with range between
. These bounds are specified in the second argument to ParametricPlot
When plotting functions of two variables, the ranges for each variable are entered in the second and third arguments:
To see the exact syntax for a visualization function, see its page in the documentation. For help in finding the documentation page for a function, see How to: Find Information about Functions
While the default behavior of Mathematica
's built-in functions is suitable in the majority of cases, you can use options with functions to control exactly how they behave.
Options are entered using rules. The short form for a rule uses a right arrow, which you get by typing
(with no space between - and >). The Mathematica
front end automatically converts
upon further typing. Either symbol is a short form for Rule
When entering options for functions, the option is on the left side of the rule and its setting is on the right side. Options are always positioned after any arguments required by the function.
Use the Filling
option with Plot
to create a filled plot:
Import some data from the Mathematica
documentation example data and display it in a Grid
Use the Frame
option with Grid
You can also use several options together, and unlike arguments, the order does not matter:
The options that are available depend upon the function being used. To find out which options you can use with a function, see How to: Find Available Options