1. About this manual

This file describes how to use OpenCell to edit CellML models and run simulations using them. The majority of the information contained in this manual is specific to OpenCell; for more information on CellML, please see the CellML Website at http://www.cellml.org/. For suggestions on best practices for creating CellML models, please see the best practice guide on the CellML website at http://www.cellml.org/tutorial/best_practice.

In this manual, words that appear in menus, on the GUI, or on buttons are written in italics. Words or characters that are part of editable fields such as text boxes, or are to be entered by the user, are written in monospace font. OpenCell is cross-platform software; screenshots in this document may be from the Linux, Windows™ or Mac OS X™ version. Where the words open the context menu appear, this means right-clicking to open the menu on Windows™ and Linux, or control-clicking (or right-clicking where supported) on Mac OS X™.

2. What is OpenCell?

OpenCell is a Free / Open Source environment for working with CellML. The project was started at the Auckland Bioengineering Institute (part of the University of Auckland), and since then, the team has grown to include developers from around the world. It provides a unified way to work with CellML documents, including creating new models, editing existing models, and running simulations.

3. What's new in OpenCell 0.8

New features in OpenCell 0.7:

  • IDA support: The IDA solver has been added as an option in the integration settings.

3.1 Known bugs

  • Integration button is not available for newly created/fixed model.
    There are several workarounds for this; either save and reload the model, clone the model and then close the clone, or open another model, select it in the model selector, then re-select the original model. See tracker item 1507.
  • Disabling and enabling a graph trace forces the line type back to "lines".
    There is no workaround for this. See tracker item 1431.
  • Pasting or typing multiple equations without separating semicolons into the equation editor crashes OpenCell.
    Always remember to separate (even partial) equations with semicolons. See tracker item 2396.

4. The OpenCell interface

The interface of OpenCell is divided into 5 main areas:

  • Menus and toolbar: At the top of the window are the usual menus and a toolbar containing icons to perform a selection of functions.
    • New iconNew model: creates a new model.
    • OpenOpen model file: allows the user to open a model file via a file dialogue window.
    • SaveSave selected model: saves the selected model.
    • Save asSave selected model as: allows the user to save the model under a new name, via a file dialogue window.
    • One graphOne graph view: shows one graph in the graph pane.
    • Two graphsTwo graph view: shows two graphs in the graph pane.
    • Three graphsThree graph view: shows three graphs in the graph pane.
    • Show integratorOpen integration pane: displays the integrator pane in the interaction pane.
  • The model selector: At the far left of the window is the model selector, which contains a tree view of the currently open models.
  • Tree view: At the top centre is a pane which shows the structure of the currently selected model. This pane has four view modes.
  • Interaction pane: This pane at bottom centre contains the integrator pane, as well as being where information about selected items from the tree view is displayed. For example, selecting an equation in the tree view will display it in mathematical notation here.
  • Graph pane: This pane is used to set up and display graphs. It can also display SVG diagrams.

OpenCell interface

5. Viewing models in OpenCell

OpenCell can be used to view and run existing models, such as those from the Physiome Model Repository.

5.1 Opening a model

You can open an existing CellML model from a file by using either the file menu or the open button on the toolbar. Using the menu, first go to the file menu and select open. A dialogue window will pop up; select the file you wish to open and click open. Clicking on the open button on the toolbar will pop up the same dialogue window.

When OpenCell is installed, it will also become the default file handler for .cellml files. Clicking on links to CellML models on the web (for example from the model repository at http://models.cellml.org) or opening CellML files from the operating system will therefore load them into OpenCell.

5.2 The tree view pane: view modes

At the top of the model tree view pane of OpenCell, there are four small buttons:

OpenCell buttons

These allow you to select one of the four following display modes for the tree view pane:

  • Show initial conditions/constants view: This presents a view of all the constants and initial conditions defined in the model.
  • Show complete model structure view: This shows a tree view of the entire CellML model. From this view you can explore and edit components, groups, connections and units, equations and variables. This is the primary editing view of OpenCell.
  • Edit XML view: This enables a plain text view of the XML of the model. You can edit the code directly from this view.
  • Show equations view: Selecting this view will display all of the equations in the model.

When either a variable or unit element is selected in the model structure tree, information about the attributes of that variable will appear below the model structure pane in the interaction pane. If a variable is selected, this information includes the variable's name, units, initial value (if applicable), and interface values. If a unit element is selected, the information displayed is an equation-like representation of the derivation of that unit from base units. To show the integrator in the interaction pane, either switch to another view, or click the display integration pane (Integrate button) button.

Currently, the XML view within OpenCell does not perform syntax highlighting, in order to provide usable performance. Full dynamic syntax highlighting is planned for a future release.

6. Editing models in OpenCell

OpenCell is also designed to facilitate the creation of CellML models. It is possible to create an entire CellML model using OpenCell without ever having to edit the XML code directly, although OpenCell also provides for code editing as well.

6.1 Creating a new model

To create a new model in OpenCell, either open the File menu and select New, or click on the new button on the toolbar (New icon). A window will appear prompting you to enter a name for your model, and to choose the version of CellML you wish to use. Unless you have a compelling reason not to, use CellML 1.1 to create your new model. Once created, your new model will appear in the model selector pane.

6.2 Editing a model

The primary view for editing models in OpenCell is the Show complete model structure view. This view is selected using the second button at the top of the tree view pane (structure view button)

6.2.1 Adding new components and variables

To add a new component to a model open the context menu (right-click on Windows or Linux, control-click on Mac) on the first line of the tree, titled Components, and choose New. A new component called New_component_x (where x is a number that increments upon creation of each new component) will appear at the bottom of the list. The name of this component can be changed by clicking on it and by changing the value in the text box.

To add a new variable to a component open the context menu on the component name and choose New Variable. Next, click on the '+' sign next to the component name to expand the component. Click on New_variable_x to change its name.

Always remember to set the units of each variable you create - all variables in CellML must be associated with a unit.

6.2.2 Adding mathematical equations

To add a mathematical equation to a component, open the context menu on the component name and choose New Maths. Open the context menu on Mathematics and choose New Equation. Expand Mathematics, and then Equation. The bottom middle pane of the screen will change to a mathematical editor, with a graphical display of the equation rendered below it.

Mathematical equations are entered using a simple infix notation, similar to the format for a basic command-line calculator tool; OpenCell translates between this and the MathML in a CellML file. For the most part, entering equations is fairly straightforward - mathematical operators follow their normal rules of precedence. For more information on this equation format, see Appendix 1.

It is now possible to paste a number of equations all at once into the equation editor - these will then be created as separate equation elements.

Equations must be separated by semicolons - failure to do this will crash OpenCell!

6.2.3 Creating connections

When two or more components share a particular variable it is necessary to connect those components. There are two ways to create a connection in OpenCell:

Drag & drop method:

You can connect all of the variables that are shared between two components simply by holding down the CTRL key and dragging one component onto the other in the tree view. This will cause all common variables to be connected. You will then have to edit the interfaces of each variable individually, in order to set the directions of the newly created connections.

Alternatively, you can drag and drop individual variables in the same way.

Tree view method:

To create a connection between two components, first open the context menu on Connections and choose New. Click on the '+' next to the connection at the bottom of the list, and add the components to be connected by clicking on Component 1 and choosing the appropriate component from the drop-down menu. Repeat the process for Component 2, then open the context menu on the connection and choose New Variable Mapping. In a similar way, choose the appropriate variable(s) to be connected from the drop-down menu.

The components connected by each connection are listed as the name of that connection in the tree view. When you select a connection, details of the connected components, including the directions of these connections, is displayed in the bottom panel.

New connections view

6.2.4 New units

CellML provides a dictionary of standard units that may be used in variable declarations or attached to bare numbers in mathematics. These include the SI base units and some additional units commonly used in the types of biological models likely to be defined using CellML (for a list of these units please refer to the CellML 1.1 specification). When units are required which are not included in this list, it is possible to describe them by adding a new units definition, which is based on units in the SI dictionary listed in the CellML dictionary, perhaps with a prefix (e.g. milli) or a multiplier attached.

A new unit can be added to a model in OpenCell by opening the context menu on Units in the model tree and choosing New. This new unit can be defined as either being base or derived by clicking on the drop-down menu next to the unit name. OpenCell allows components and models that declare variables with different units to be connected as long as variables that are mapped to one another have the same dimensions: for example feet and metre, or pound and kilogram.

6.2.5 Imports

CellML 1.1 allows for you to import other models. To add a new import, open the context menu on Imports, and choose New. Click on the new import row. Now type a URL for the model in the box under the Type column.

You will now be able to add in Import Components (components to import) and Import Units (units to import). To add a new import component, expand the imported model, and then choose New. You will now have a new Import Component appear. The text-box under the type column (initially New_import_component) describes the name in the importing model, and the text-box under the value column describes the name in the imported model. An exactly analogous rule applies for the import units.

You can also expand Model to view the imported model. Changing the imported model here not recommended, as there is no way to save your changes. Instead load the imported model separately in OpenCell.

6.3 Cloning a model

Cloning models allows changes to be made to a model whilst retaining the original version of a model and its results. To clone a model, open the context menu on the model name in the left hand pane and select Clone. A new model appears in the tree, underneath the original model. Initially it is named by the date it was created. To rename this new model right-click on the model name and choose Rename.

6.3.1 Cloning from output

Clone from output lets you create a clone of a model in which the state variables have an initial value equal to those that result after a period of time. If, for example, the value of variable y is 0 at time 0 and 100 at time 10, then if the model is cloned at time 10, the initial value of y will be 100 in the clone.

There are several reasons why you might want to do this:

  • You want to 'intervene' in a simulation by changing a value after the simulation has started and watching the effects. This is equivalent to cloning from output at the point you want to intervene, changing the value, and starting the simulation from there.
  • You want to run a model for a long time in the hope it will reach a steady state, and then save a model with the state variables already at their steady state values.

To Clone from Output:

  • Follow the instructions in 'Running a Model Simulation' to run your simulation up to the point you wish to clone from. You can go past the point if you want, but then there may not be a data point exactly where you want to clone from output.
  • Open the context menu on the model in the model selector to bring up the context menu.
  • Choose Clone from Output on the context menu.
  • A popup appears asking you for the point to clone at. It defaults to the end point. Press Ok to perform the clone.
  • You can now change any parameters you wish to on the cloned model.
  • If you are performing an intervention, you may wish to change the Start Time Point for the cloned model to the time of the intervention - otherwise the time start again at the original starting time (while keeping the updated state variables).

Below is an example of what cloning from output is able to achieve.


Cloning from output

6.4 Validating a model

OpenCell provides a validation service that makes it easier to find and correct errors in your XML. To start the validation service, select the model in the model selector. Open the context menu on the model and select the Validate option. The validation service will find any errors and display them in the right hand panel. Double clicking on an error message will automatically display and select the cause of the error. OpenCell will only be able to highlight the error if you are in show complete model structure view mode.

Remember to select the complete model structure tree view before using the validation service.


Validation service

If you have an error caused by a variable that occurs in an equation but has not been defined, you are now able to automatically correct this by right-clicking on the error message and selecting the Add variable to parent component option.

Automatically fix missing variable

Currently the validation service only takes you to errors in the model structure and equations views. In future versions it will also be able to also highlight errors in the XML editing view.

7. Running models

7.1 Running model simulations

In order to run a simulation, first make the integrator controls visible in the interaction pane area - do this by clicking on the display integration pane button (integrate button) in the toolbar. The integrator pane lets you set the initial conditions for a number of different parameters before starting the simulation. It is split into two tabs; Basic settings and Advanced settings.

7.1.1 Basic settings:

Parameter Description
Start point The value of the bound variable at which the initial value attributes hold. The integration will proceed from this point.
Point density The maximum number of points in the graph. Because an adaptive step size integrator is used, the actual number of points may vary. This control works by limiting the maximum density of points in any region of the graph containing two or more points.
End point The value of the bound variable at which the integration will stop.
Maximum Step Size An upper limit on the allowable step size.
Algorithm The algorithm to use for numerically solving the model. Note that some algorithms are not suitable for stiff systems, but are faster.

The following choices are available for algorithm:

Algorithm Description
BDF 1-5 with solve A Backwards Euler algorithm good for stiff problems.
Adams-Moulton 1-12 An Adams-Moulton algorithm good for non-stiff problems.
Implicit Runge-Kutta (2) with solve An alternative algorithm for stiff problems.

7.1.2 Advanced settings:

Parameter Description
Enable tabulation control This check box enables tabulation control. Tabulation provides output at fixed intervals. If left unchecked, the solver will choose intervals which may not be evenly spaced.
Tabulation interval This setting is enabled if the "Enable tabulation control" check box is checked. This is a positive real number, representing the fixed step size at which data points will be reported.
Tabulate strictly If this box is checked, OpenCell will only provide output at exact tabulation values. If unchecked, OpenCell will provide output at tabulated intervals as well as the solver's chosen intervals.
Absolute epsilon value The absolute error control parameter. This is a positive real number. As values tend to zero, the error will decrease, but the time taken to run the integration will increase.
Relative epsilon value The relative error control parameter. This is a positive real number. As values tend to zero, the error will decrease, but the time taken to run the integration will increase.
Variable Scale Factor A value controlling the relative importance of getting variable values correct (as opposed to getting rates correct).
Rate Scale Factor The corresponding scale factor for rates.

Once you are ready to run the simulation, click the Integrate button. This will run the model.

In OpenCell, there is a 1:1 relationship between integration runs and models in the model tree view. Therefore, you select previous integration runs in exactly the same way that you select models. If you want to have more than one run for the same input model, you can clone the model in the model selector. You will be prompted to do this automatically if you try to change a model after you have run it.

7.2 Viewing graphs

The graph viewer lets you plot the data from your model simulations onto a graph. This also allows you to compare graphs from two or more simulations. You can plot variables on the X and Y axes, and have an arbitrary number of traces.

To add a new trace, open the context menu in the white area at the bottom right corner of the screen and select New Trace from the popup menu. You are now able to define the different attributes of the trace by left-clicking on the appropriate column in the list, as described in the table below:

You can also create a new graph trace by dragging a variable from the tree view and dropping it on the graph pane. If other traces already exist, the new trace will plot the dragged variable against the existing X variable of any previous trace - generally, this is the time variable. If the new trace is the first trace, you will have to set its X variable manually in the trace editor.

Left click on: to change:
the coloured square the colour of the trace
model the model being plotted. The default, Link Selected, means that the trace will change models as you change the model in the model selector. However, you may want to compare one model or run against another. In this case, select the first model, and choose Copy Selected Model. The trace will now be locked on this model. Now make another trace, and select the second model
X The variable to draw on the X axis. You select a variable from the popup menu by firstly selecting a component name, and then a variable name.
Y The variable to draw on the Y axis. You select a variable from the popup menu by firstly selecting a component name, and then a variable name.
Type The style in which points are plotted, e.g., choose 'line' to do a line graph, or 'dot' for a dot plot.

You can disable, re-enable or delete traces by opening the context menu on the trace, and choosing the respective options from the popup menus.

7.2.1 Labelling graphs

To change the title of the graph, simply select Untitled in the white area above the graph and type in the new name of the plot.

7.2.2 Comparing two or more plots

To compare two plots simultaneously click on the Two graphs button which is on the toolbar beneath the main menu and is the second icon from the right. Clicking on this icon provides a two graph view. Likewise, clicking on the Three graphs button will provide a three graph view.

7.2.3 Gridlines

You can add gridlines to the graph display by selecting gridlines within the View menu.

7.2.4 Axis scaling: percentage normalisation

Both axes can be designated as either linear or percentage-normalised. Using percentage- normalisation function will cause the values along that axis to be plotted as a percentage of their maximum value. This function tends to be more useful for the Y-axis and can be very helpful for comparing traces with different scale ranges. For example the shape of a trace within the millimolar range can be compared with that of a trace within the picomolar range. Using the linear axis view, the picomolar range trace would appear as a flat line running along the bottom of the graph.

7.2.5 Zooming in and out

To zoom in on a feature of the data, click the left mouse button, drag a box over the feature, and release the mouse button. The selected box will be your new coordinate space.

You can zoom in and out on a graph by holding down the right mouse button and moving the mouse; in this case, you have independent control over the zoom in the X and Y directions by moving the mouse side to side or up and down.

To zoom out by 150%, open the context menu on a zoomed in graph, and select Zoom out. To return to the original view showing all data, open the context menu on a zoomed in graph and select Zoom full.

When you plot a graph with a large number of points, you might not always see every feature in the data from low zoom levels. The reason for this is because OpenCell will summarise data as you zoom out to make the program more responsive, and also because you have a limited number of pixels on the screen. Try zooming in on features for a clearer view.

7.3 Re-arranging the environment

OpenCell's user interface contains many different components; sometimes you may want one part of the environment to take up more or less screen space than the default. You can do this by putting the mouse over the bar that separates components of the user interface, holding down the left mouse button, and dragging the component into the part of the screen where you want it. If you try to resize a component to below the minimum size, it will fold down to zero size until you drag it back out.

To see features of your data better, try expanding your graph area to take up the whole screen.

Although only one graph panel is visible when you initially start OpenCell, there are actually two more hidden at the bottom right of the screen. This is useful if you want to compare two different graphs on separate, but lined up, axes.

8. Sessions

A session file stores the state of OpenCell, including the list of models which are open, any graphs which you may have defined, the positioning of the various sliders, and so on. Session files can also store a link to a diagram or other external content. The diagram may be set up so that clicking on components of the model in the diagram toggle specific graph traces on and off in the displayed graphs. Session files are usually used for display and dissemination purposes; models may be set up to be integrated with specific time intervals, with specific graph traces and diagrams showing. An increasing number of the models in the Physiome Model Repository have session files available for download.

For an example of what session files can do, download the session file from this model. Load the session file into OpenCell by opening it as you would a model file. Once the session file is loaded, OpenCell will be arranged quite differently to the default layout, as shown below:

Example of a OpenCell session

Clicking on the channels in the diagram will cause traces associated with them to be toggled on and off in the graph above the diagram.

In order to see the graphs when clicking on the model diagram, you must first click on the Integrate button in the integration panel.

8.1 The default session

The default session is a special session file which is stored in your OpenCell profile directory. It provides a convenient way to save what you are doing and come back to it later.

To save the default session, choose Save Default Session from the File menu.

To restore you default session saved earlier, choose Load Default Session from the File menu.

A session does not actually contain the models, it only contains links to them. It is therefore important that you save your models as well as your session. Also, because sessions need cmeta IDs on variables to properly save your mathematics (it adds them automatically when saving your session) it is important to save the models after you save your session.

8.2 Exporting and importing sessions

Sometimes, you may want to export a session to give to someone else, or to keep for a long period of time. You can create such a session by choosing Export Session from the File menu, and choosing the file to save to.

You can also import a session provided by someone else by choosing Import Session from the File menu, and choosing the file to load.

Sessions will normally refer to models by a file URL. You can edit the session file after exporting if you know of a more generally valid URL for the model, and replace the URLs.

Don't forget to share your models together with your session, because session files do not contain the model itself, only a link to them.

You can find some pre-configured session files for many of the models in the CellML repository. OpenCell will load them for you if you click on them and choose OpenCell as the program to open the file.

8.3 Graph features in sessions

There are two main graphing features that can be applied to sessions. Gridlines can be turned on, and graph axis scaling can be switched to percentage-normalised. These are described in the viewing graphs section of this manual.

8.4 Embedding diagrams in a session

You can embed an SVG or HTML diagram into a session file. To do this, you must edit the session file in a text editor. First, rename one of the graphs with no traces on it from Untitled to the final name.


Naming a graph

Next, use the Export Session command on the file menu. Open the session file in a text editor. Perform a text search for the name of the graph.
Searching for the name of the graph

After the attribute NS1:graphname="{Graph title}", add NS1:externalurl="{URL of diagram}". The string NS1 may vary - in any case you should use the same prefix on the externalurl attribute. {Graph title} refers to the title you entered for the graph, and {URL of diagram} is replaced with the URL for the diagram.
Adding in externalurl attribute

When this session is loaded, the diagram will be displayed in the place of the selected graph.
OpenCell session with diagram

9. Javascript in OpenCell

9.1 Embedding Javascript in OpenCell

OpenCell allows Javascript to be embedded in external files embedded as content in sessions (for example, SVG diagrams added as explained in the section above). Use of scripting inside SVG (or other documents) associated with a CellML model via a session file operates in exactly the same manner as when these documents are embedded in a web page, with the addition of the OpenCell Javascript API.

9.2 The OpenCell Javascript API

OpenCell exposes three methods to Javascript through the opencell object. They let you show and hide traces, and set status bar messages. These methods can be invoked from the unprivileged Javascript in an embedded diagram. To hide a trace, use the method hideTraces(graph name), where graph name is the name you have selected for the graph. To show a trace, use the method selectTrace(graph name, x variable name, y variable name, colour, style). The x and y variable names must be in the form "component/variable". Colour is either an empty string, in which case the colour of the trace is not changed, or a string of the form "#rrggbb" specifying the new colour of the trace. Style has six allowed values:

  • "" - Make no change.
  • "lines" - Draw as lines.
  • "squares" - Draw as squares.
  • "circles" - Draw as circles.
  • "diamonds" - Draw as diamonds.
  • "dots" - Draw as dots.
  • "none" - Don't draw (disable trace).

To write a message to the status bar, use the method status(message). All of these methods are invoked through the opencell object. To see an example of a session file using this api through an svg object, click here.

10. Exporting code from OpenCell

It is possible to export a model from OpenCell to other languages; C, MATLAB and Python. To export code bring up the context menu on the model you wish to export in the model list pane, and highlight the Export ► menu item. Select and click on the language you wish to export to.

10.1 Export to MATLAB

Models are exported to MATLAB code as an M-file function called solveModel that does not take any inputs. This function returns an array for the variable of integration (usually time), arrays of state and algebraic variables, and constants. The function solves the model using ODE15s and plots the results. Various subfunctions are used:

  • createLegends - creates arrays of strings that are used as a legend for the plots.
  • initConsts - initializes constants and state variables.
  • computeRates - computes the rate of change of state variables at each time step.
  • computeAlgebraic - computes all algebraic variables using element-wise operations, including those that are calculated as part of the rate calculation.

10.2 Export to Python

The Python export has the same functions as the MATLAB export, and works in much the same way. If the Python output is run as a script, it will solve the model and plot the results. Separate functions are used to solve and plot. The Python code can be imported as a module, and only the functions that are required can be used. For example, a different solving and plotting function could be written that requires only the initConsts, computeRates and computeAlgebraic functions.

To run the exported code the NumPy module for arrays is required. The matplotlib (pylab) module is required for the plot_model function and SciPy's integrate.ode solver is used in the solve_model function.

The Python modules are all widely used and are available from the package managers of nearly all Linux distributions. In Ubuntu the relevant packages are python-numpy, python-scipy and python-matplotlib. In Fedora the packages are numpy, scipy and python-matplotlib. SciPy and NumPy for Windows and Mac OSX can be downloaded from http://www.scipy.org/Download, and matplotlib from http://sourceforge.net/projects/matplotlib.

Python(x,y) and Enthought are Python distributions that come with SciPy, NumPy, matplotlib and many other modules for scientific computation built in. These provide a simple way to install everything needed with one package.

10.3 Export to FORTRAN 77

The Fortran 77 code export does not produce a stand alone program; it instead produces three subroutines, which can be used with an ODE solver library to produce code that reproduces the results of the original CellML model.

  • initConsts - initializes constants and state variables.
  • computeRates - computes the rate of change of state variables at the current time step.
  • computeVariables - computes all algebraic variables at the current time step, including those that are calculated as part of the rate calculation.

Any other non-standard functions which are needed by these subroutines are also included in the generated code; for example, a function TERNRY is included with any code that uses a ternary choice operator.

10.4 Solving DAEs

For solving DAEs the exported code uses the same method as OpenCell, which works by decoupling algebraic variables from the ODE system and using a non linear function solver to calculate them (fsolve in Matlab and scipy.optimize.fsolve in Python).

Appendix 1. Equation editing

Equations in OpenCell are entered in a plain text format which OpenCell translates into MathML. The grammar of this format is fairly straightforward for most purposes.

  • All of the normal mathematical operators (+ - * / = < > <= >= != ==) work as you would expect, with the usual order of operations. They can also be annotated with {id="some id"} to give the corresponding MathML <apply> element an id.
  • The order of operations can be specified as you would expect, using brackets.
  • Other operators are are written with function notation - see the table of available operators below.
  • The differential of a with respect to b is written d(a)/d(b). For partial differentials, use del instead of d.
  • Numbers work as you would expect, but must be annotated with {units="a unit"} to be valid in cellml.
  • Whitespace (spaces and tabs) is ignored.
  • Variable names are written as plain text unless they share the name of a defined constant, in which case prefixing them with a # will cause them to become a variable. For example pi is a constant, but #pi is a variable.
  • Quoted strings are wrapped in quotes (""), and may contain the following escapes as in C; \n, \r, \t, \f.
  • Piecewise functions are written:

         piecewise (case <condition> then <value>
                    case <condition> then <value>
                    ...
                    else <default value>
                    )

    where a <condition> takes the form of any boolean expression (ie x <= 4), and the default value is optional. An example of a piecewise equation is: d(x)/d(t) = piecewise(case x > 2 then 0 else v)

Operators

Below is a table of operators supported by OpenCell. These are entered in the format operator(operand, operand, ... operand) for as many operands as they may take. They all correspond to MathML tags.

abs and arccos arccosh arccot
arccoth arccsc arccsch arcsec arcsech
arcsin arcsinh arctan arctanh ceiling
cos cosh cot coth csc
csch diff divide eq exp
exp factorial factorof floor gcd
geq gt implies int lcm
leq ln log lt max
min minus neq not or
plus power quotient rem root
sec sech sin sinh tan
tanh times unary_minus xor

Constants

Below is a table of defined constants.

emptyset eulergamma exponentiale complexes infinity
integers imaginaryi false naturalnumbers notanumber
pi primes rationals reals true