## TecML ODE

- V1.0
- V2.0
- overview

Consider you have a set of ordinary differential equation as follows.

r = x * x * x;

dx/dt = x – r + z;

You have to select a numerical method such as Euler method to calculate time evolution of x in the above equations. Euler method can be denoted as follows.

x_(n+1) = x_(n) + dx/dt * dt

However, there is no corresponding equation for r = x * x * x in Euler equation, therefore, we can provide two more equations to Euler method to have correspondence with the input ODE as follows.

y_(n) = g(x_(n), y_(n))

dx_(n)/dt = f(x_(n), y_(n))

x_(n+1) = x_(n) + dx_(n)/dt * dt

Then we can obtain a set of equation which should be calculated by a simulation program. Here, we have correspondence between the Euler method variables and the ODE variables. The variable y can be considered as temporal variable which can be eliminated mathematically. We call this variable type as arithmetic variable. The variable x is a variable whose temporal change is calculated. We also have constants like z.

If we think of generating a simulation program for the above equations, we need initial values and - format

A TecML 2.0 file has four components: 1) variable definition part, 2) function definition part, 3) class definition part and 4) equation part.<tecml> <!-- variable definition --> <variable name="x" type="recurvar"/> ... <!-- function definition --> <function name="f"/> ... <!-- class definition --> <class> <variable name="x"/> <function name="f"/> </class> ... <!-- equations --> <math> <apply> ... </apply> ... </math> </tecml>

- description of each part
- variable definition part

One TecML variable corresponds to one or more variables of a model file. Thus a TecML variable can be considered as a vector variable, however, in a TecML file, variables are denoted as scalar variables. In the variable definition part, every variable appears in the equation part are defined by “**variable**” tag with their “**name**” and “**type**” attributes. “**name**” attribute defines the variable name which must be unique in the file. “**type**” attribute defines the variable type where one of the following five types is specified for each variable.**type**meanings **recurvar**variables whose values are calculated by recurrence relation equations **arithvar**temporal variables (which can be mathematically eliminated) **constvar**constants **condition**termination conditions of recurrence relations **stepvar**variables for time step - function definition part

The names of functions used in the TecML file are declared with “**function**” tag. All the function names have to be declared here. “**function**” tag have “**name**” attribute only. - class definition part

If the number of dimension of variables or functions are the same, they are called to be in the same class. In the class definition part, all the variables and the functions are listed up in each class definition. - equation part
- Equations are provided with MathML. The variables in the next time step is described by the equations with the variables in the current time step and functions. Note that the left hand side of each equations have to be the variable which are derived by each equation.
- The variables are vectors of cell model variables. Only the identical dimension vectors can be added or subtracted, while the vectors can be multiplied or divided by scalar variables.

- variable definition part
- XMLschema
<?xml version="1.0" encoding="utf-8"?> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"xmlns:mathml="http://www.w3.org/1998/Math/MathML"> <xsd:import namespace="http://www.w3.org/1998/Math/MathML" schemaLocation="http://www.w3.org/Math/XMLSchema/mathml2/mathml2.xsd"/> <xsd:element name="tecml" /> <xsd:complexType> <xsd:sequence> <xsd:element name="variable" type="variableTemplate" maxOccurs="unbounded" /> <xsd:element name="function" type="xsd:sting" maxOccurs="unbounded" /> <xsd:element name="class" type="classTemplate" maxOccurs="unbounded"/> <xsd: element ref="mathml:math" maxOccurs="unbounded"/> </xsd:sequence> </xsd:complexType> </xsd:element> <xsd:complexType name="variableTemplate"> <xsd:sequence> </xsd:sequence> <xsd:attribute name="name" type="xsd:string" use="required" /> <xsd:attribute name="type" type="variableType" use="required" /> </xsd:complexType> <xsd:simpleType name="variableType"> <xsd:restriction base="xsd:string"> <xsd:enumeration value="recurvar"> <xsd:enumeration value="arithvar"> <xsd:enumeration value="constvar"> <xsd:enumeration value="condition"> <xsd:enumeration value="stepvar"> </xsd:sequence> </xsd:simpleType> <xsd:complexType name="classTemplate"> <xsd:sequence> </xsd:sequence> <xsd:element name="variable" type="xsd:string" maxOccurs="unbounded"/> <xsd:element name="function" type="xsd:string" maxOccurs="unbounded"/> </xsd:complexType> <!-- MathML apply tag attribute modification --> <xsd:complexType name="apply.type"> <xsd:extension base="mathml:apply.type"> <xsd:sequence> <xsd:attribute name="type" type="applyType" use="optional"/> </xsd:sequence> </xsd:extension> </xsd:complexType> </xsd:redefine> <xsd:simpleType name="applyType"> <xsd:restriction base="xsd:string"> <xsd:enumeration value="initend"> <xsd:enumeration value="final"> <xsd:enumeration value="condition"> </xsd:sequence> </xsd:simpleType> </xsd:schema>

- examples

Many ODE calculation schemes are provided as TecML 2.0 files which are included in the zip file below.- explicit single step methods

Euler, Modified Euler, 4th Runge Kutta, 6th Runge Kutta - explicit multi step methods

two step Adams, two step Predictor Corrector - implicit single step methods

backward Euler, implicit Runge Kutta - implicit multi step methods

two step Adams Moulton, two step BDF

- explicit single step methods
- Notes

- overview