INCF / nineml-spec

Specification of the NineML model description language.
http://nineml.net
14 stars 9 forks source link

Piecewise functions #74

Open tclose opened 9 years ago

tclose commented 9 years ago

In the models I am planning to port, piece-wise continuous expressions are required. The subset of MathML that SBML uses has piecewise expressions but since we are not supporting MathML at this stage I have come up with a MathML-like syntax until then, i.e.

<Piecewise name="saturatedVoltage">
  <Piece>
    <MathInline>100</MathInline>
    <Condition>
      <MathInline>v &gt; 10</MathInline>
    </Condition>
  </Piece>
  <Otherwise>
    <MathInline>v * v</MathInline>
  </Otherwise>
</Piecewise>

Within transition blocks, connection rules (see #72) and distribution components (see #63), I don't forsee any issues with piecewise functions, but I am not sure whether they should be allowed within Dynamics blocks, or whether the same functionality could and should be handled by regime changes (my feeling).

NineML-Committee commented 9 years ago

The committee agreed that piecewise functions should not be allowed in Dynamics components, except within transitions and should be allowed in connection rule and distribution components.

In addition: When using MathInline the ternary operator should be used:

<MathInline>v &gt; 10 ? 20 : v</MathInline>

and can be nested

<MathInline>v &gt; 10 ? v &gt; 20 ? 30 : v+5 : v</MathInline>

When using MathML the standard MathML tags should be used - it must be noted that within MathML blocks tag ordering is important, in contrast to NineML.