How Do I Use Formulas That I Found Elsewhere in
Mathematica?
Using formulas is very simple. Just retype the formula, name it as a function,
define your variables, and you are done.
For example, suppose you have found the formula for the magnitude of a dipole
field in Cartesian coordinates.
![[Graphics:Images/index_gr_1.gif]](Images/index_gr_1.gif)
The easiest way to input this formula is to use the BasicInput.nb palette.
- Open a new
notebook or create a new cell in an open one by clicking below the last blue cell bracket.
- Open the BasicInput.nb
palette by clicking the hyperlink, or select BasicInput
from File->Palettes.
- Click
.
- Type 1, and use the tabulator key to jump to the denominator.
- Click
.
- Type (x+.
- Click
.
- Type x, use the tabulator key to jump to
the next placeholder, type 0, and press CONTROL-SPACE
to jump out of the subscript.
- Type ), select the expression
with the mouse, click
, and type 2.
To find out how you can type this input using keyboard shortcuts, see
the documentation for keyboard shortcuts for either Microsoft
Windows, Macintosh,
or X.
After you input the rest of the formula in a similar manner, you can use plotting
functions to visualize it immediately. Just plug in values for
and .
![[Graphics:Images/index_gr_9.gif]](Images/index_gr_9.gif)
![[Graphics:Images/index_gr_10.gif]](Images/index_gr_10.gif)
To use a formula more generally, you can easily represent it as a Mathematica
function. Here is the textbook formula for the electric field of a number of
radial wires carrying opposing currents organized on a unit circle.
![[Graphics:Images/index_gr_11.gif]](Images/index_gr_11.gif)
Here is the same formula written as
a Mathematica function. Note that function names are uppercase by
convention, function arguments are enclosed in square brackets, and the
independent variable is followed by an underscore in the function
definition. All the other typeset elements were input using the BasicInput.nb palette.
![[Graphics:Images/index_gr_12.gif]](Images/index_gr_12.gif)
![[Graphics:Images/index_gr_13.gif]](Images/index_gr_13.gif)
![[Graphics:Images/index_gr_14.gif]](Images/index_gr_14.gif)
Return to Top
| |