Technical Documentation

Technical documentation of mozCellML.

mozCellML Technical Notes

1 - The program

mozCellML is written in the C++1 and Javascript (ECMAScript) 2 programming languages. It is built upon Mozilla3 and uses a number of technologies associated with Mozilla, including XPCOM4, XPIDL, XPConnect5, and XUL6.

mozCellML is designed to run on a number of Mozilla-based browsers, including SeaMonkey and Firefox.

2 - Processing CellML

mozCellML loads and saves models in the XML based format CellML7. The CellML format is currently processed directly using the Document Object Model level 2 core8, as implemented by Mozilla.

3 - Processing MathML

As per the CellML specification, mozCellML processes MathML9 which is embedded inside CellML documents. It does this by direct operation on the Document Object Model level 2 core.

The code does not make any assumptions about the order in which equalities are presented, as is required by the CellML specification. The code does, however, require that equations be expressed in one of several forms. mozCellML can handle equations where a variable is equated to an expression, or where a variable differentiated with respect to time is equated to an expression.

Expression in mozCellML can be constants, variables, piecewise functions, or relations between expressions using the following operators:

  • quotient
  • divide
  • minus
  • plus
  • time
  • and
  • or
  • not
  • eq
  • neq
  • gt
  • lt
  • geq
  • leq
  • xor
  • implies
  • factorial
  • exp
  • power
  • root(to any degree)
  • floor
  • ceiling
  • abs
  • ln
  • log(to any logbase)
  • rem
  • sin
  • cos
  • tan
  • csc
  • sec
  • cot
  • sinh
  • cosh
  • tanh
  • csch
  • sech
  • coth
  • arcsin
  • arccos
  • arctan
  • arccosh
  • arccot
  • arccoth
  • arccsc
  • arccsch
  • arcsec
  • arcsech
  • arcsinh
  • arctanh
  • int(only for definite integrals with an uplimit and lowlimit provided. Can be between infinity and -infinity. Can be with respect to any arbitrary bound variable).
The following built in constants, from MathML, are supported:
  • pi
  • exponentiale
  • eulergamma
  • infinity
  • notanumber
  • true
  • false
The only data type in mozCellML is a scalar double precision floating point value as provided by the host system. There is no support for matrices, vectors, or lambda functions.

4 - Numerical Solution of ODEs

mozCellML can solve ordinary differential equations. It does this by generating C code, and compiling it using the C compiler from gcc 10. The solver routine uses the algorithm from the Fortran code RADAU.F 11 of Hairer and Wanner 12. This is an implicit Runge-Kutta method13 based on the Radau quadrature14.

5 - Numerical Fitting of Experimental Data

mozCellML can fit experimental data to a model, given a set of variables to treat as parameters(with a priori estimates of their values), and a set of measurements at certain bound variable points. This is implemented using a Levenberg-Marquardt 15 fitting algorithm. The implementation is adapted from the levmar package 16. Every function evaluation for the Levenberg-Marquardt computation causes the solution of the ordinary differential equations up to the value of the bound variable for the latest measurement, as described in section 4.

6 - Numerical Solution of Definite Integrals

mozCellML can solve definite integrals. The solution is performed inside function calls in the ODE solution process. The solver routine uses the algorithm from the netlib FORTRAN algorithm 614, INTHP17, and is an implementation of the algorithm of Sikorski and Stenger 18

7 - Testing and Program Validation

mozCellML is tested by the use of models which have known or expected results. To ensure program reliability(combined with repository validation), mozCellML is regularly run against the CellML Repository19. In addition, there are a range of simple models used for testing mozCellML. These models are shipped with mozCellML, and after it has been installed can be accessed at chrome://mozcellml/content/testsuite/index.html. They are also available in the CellML Tool Test Repository 20.

The most simple test model represents an object moving in a straight line with constant velocity. Another model represents a pendulum with a joint in the middle. The state of the pendulum consists of two angles, and two angular velocities. The system is expressed in CellML as a coupled system of ODEs. There is an analytic solution to these equations, and the model computes both the analytic and differential solutions. It also computes a residual sum of squares difference between the analytic and differential solution, over all the variables.

Another model tests the computation of definite integrals. The model computes a two-tailed p-value by finding areas under the standard normal probability density function. These can also be solved within a known error by a power series, and so this model allows for the solution to be checked.

There are also a number of models designed to test various features of CellML, such as imports, and transfering initial_values from other variables.

8 - References

  1. International Standard ISO/IEC 14882:1998. Programming Languages — C++ (lst edn). ISO/IEC: Geneva, 1998
  2. International Standard ECMA-262 3rd Edition. ECMAScript Language Specification. ECMA: Geneva, 1999
  3. Website http://mozilla.org. The Mozilla Browser. Mozilla Foundation: 1998-2004
  4. Website http://mozilla.org/projects/xpcom/. The Mozilla XPCOM Project. Mozilla Foundation: 1998-2004
  5. Website http://mozilla.org/scriptable/. The Mozilla XPCOM Project. Mozilla Foundation: 1998-2004
  6. Website http://www.mozilla.org/projects/xul/. The Mozilla XUL Project. Mozilla Foundation: 1998-2004
  7. Lloyd, CM; Halstead, MDB; Nielsen, PF. CellML: its future, present and past. Prog Biophys Mol Biol. 2004 Jun-Jul;85(2-3):433-50
  8. Hors, AL; Hégaret, PL; Wood, L; Nicol, G; Robie, J; Champion, M; Byrne, S; Document Object Model Level 3 core. W3C Recommendation. World Wide Web Consortium, 2000
  9. Ausbrooks, R; Buswell, S; Carlisle, D; Dalmas, S; Devitt, S; Diaz, A; Froumentin, M; Hunter, R; Ion, P; Kohlhase, M; Miner, R; Poppelier, N; Smith, B; Soiffer, N; Sutor, R; Watt, S; Mathematical Markup Language (MathML) Version 2.0 (Second Edition). W3C Recommendation. World Wide Web Consortium, 2003
  10. Website http://gcc.gnu.org/ The GNU Compiler Collection. The Free Software Foundation: Boston, 2004
  11. Hairer, E; Wanner, G. Numerical solution of a stiff (or differential algebraic) system of first order ordinary differential equations FORTRAN code http://www.unige.ch/~hairer/prog/stiff/radau.f
  12. Hairer, E; Wanner, G. Solving Ordinary Differential Equations II. Stiff And Differential-Algebraic Problems. Springer series in computational mathematics 14, Second Edition 1996.
  13. Runge, C. Math. Ann. 46, 167, 1895.
  14. Weisstein, EW Website http://mathworld.wolfram.com/RadauQuadrature.html MathWorld.
  15. Marquardt, D. An Algorithm for Least-Squares Estimation of Nonlinear Parameters. SIAM J. Appl. Math. 11, 431-441, 1963.
  16. Lourakis, M. LEVMAR version 1.2 C code http://www.ics.forth.gr/~lourakis/levmar/levmar-1.2.tgz, 2004
  17. Sikorski, K; Stenger, F; Schwing, J. Algorithm 614: A FORTRAN Subroutine for Numerical Integration in Hp ACM Trans. Math. Soft. 10, 152-157, 1984
  18. Sikorski, K; Stenger, F. Optimal quadrature algorithms in Hp spaces Num. Math. 39, 405-410, 1982
  19. Lloyd, CM. CellML Repository. Website http://www.cellml.org/examples/repository/. Bioengineering Institute: Auckland
  20. Miller, AK. CellML Tool Test Repository. Website http://www.cellml.org/examples/repository/tooltest/. Bioengineering Institute: Auckland, 2004