## Please enable JavaScript to view this site.

This guide is for an old version of Prism. Browse the latest version or update Prism
 Overview: User-defined equations

Few people will need to enter user-defined equations into Prism. If you need to do this, keep these points in mind:

Rather than starting with a blank screen, it is usually much easier to clone an existing equation, and then modify it.

You must define Y as a function of X and some parameters. The equation can't define P as a function of V, or Z as a function of Y. It must define Y as a function of X.

The syntax Prism uses is pretty standard. But use plenty of parentheses, so there is no doubt about what the equation means. Many people have made the mistake of entering "A/B+C" expecting Prism to divide A by the sum of B plus C. Instead, Prism first dives A by B, and then adds that quotient to C. Writing the equation with parentheses as "A/(B+C)" avoids any ambiguity.

Prism lets you use many standard mathematical functions when defining your model. Most of these are standard. But watch out for a few that are implemented differently in different languages. The log() function in Prism is common (base 10) log. If you want to use natural logs, use the ln() function. The sqr() function in Prism squares the value, while the sqrt() function computes the square root.

Prism lets you write an equation in such a way that different models are fit to different data sets.

When you write a model using several lines, Prism evaluates from the top down. In other words, you must first define intermediate variables and then use them lower down. The last line must define Y.  This follows the conventions of all computer languages, but is opposite to how mathematical text books present complicated equations.

After writing the equation, don't forget to define rules for initial values. If you don't do this, you'll need to enter initial estimated values for each parameter every time you fit the model to data.

When you enter a new equation, Prism also lets you define default constraints and transforms to report. These features are optional, so you can skip them when first learning about user-defined equations.