Previous section-----Next section

Entering a Function

Once you have established a link, you are ready to perform Mathematica calculations inside Excel. One way of doing this is using the EVAL worksheet function. This worksheet function allows you to call any Mathematica function from within an Excel formula.

Try entering the simple Mathematica function, Prime, in an empty worksheet cell. This is done as shown.

The value returned is the hundredth prime number.

Now, try creating an interactive prime number calculator by specifying a cell reference as an argument.

Unless you have already entered a value in cell A1, the function returns unevaluated and displays an error code. The #N/A error code indicates that one or more inputs to the formula are not available.

Type any integer you choose in cell A1, and a prime number will be calculated for you.

Here are some other examples.

The last of these displays a Mathematica graphic. To display Mathematica graphics, the kernel will launch a copy of the Mathematica front end in server mode.

The Mathematica front end as a graphics server.

Mathematica contains thousands of functions. If you know precisely which Mathematica function you wish to use and the arguments it takes, you can type it directly into your spreadsheet, as shown.

If you are unsure of the name of a Mathematica function or how to use it, or want to explore the functions Mathematica has to offer, click Functions on the Mathematica Toolbar. This will launch the Mathematica Function Wizard.

The first step of the wizard is designed to help you find, and learn about, Mathematica functions.

The Mathematica Function Wizard—Step 1.

The next step is designed to help you interactively specify arguments to the function.

The Mathematica Function Wizard—Step 2.

An optional third step is available to select and specify options for functions such as Plot that have a defined set of options.

The Mathematica Function Wizard—Step 3.

Notes
• Unlike Excel, Mathematica uses case-sensitive syntax. Therefore, be sure to capitalize Mathematica function names like Prime.
• You cannot interact with a Mathematica front end that is in server mode. If you would like to work in the Mathematica front end, you can launch another standard instance of the front end.