MathSBML

MathSBML Home Page MathSBML Site Map

getInterpolatingFunction


getInterpolatingFunction returns a list of InterpolatingFunctions from an InterpolationSet.

In general the end times of the InterpolatingFunctions will exceed the end time of the InterpolationSet. This is because the InterpolatingFunction returned by NDSolve will always end after the StoppingTest and SBMLNDSolve must interpolate backwards to find the actual event occurance time. The actual event time is the end time of the InterpolationSet.

getInterpolatingFunction is new in MathSBML 2.3.0


Example

To see the file simpleevent.xml scroll down beyond the plot.

Input:   s=SBMLRead["simpleevent.xml"];
         num=SBMLNDSolve[s, 25];
Output:  {InterpolationSet[0, 6.00982, {SBMLModel`A[t] -> InterpolatingFunction[{{0., 6.02959}}, <>][t], 
                                   SBMLModel`B[t] -> InterpolatingFunction[{{0., 6.02959}}, <>][t], 
                                   SBMLModel`void[t] -> InterpolatingFunction[{{0., 6.02959}}, <>][t],
                                   SBMLModel`C[t] -> InterpolatingFunction[{{0., 6.02959}}, <>][t]}], 
          InterpolationSet[6.00982, 9.78006, {SBMLModel`A[t] -> InterpolatingFunction[{{6.00982, 9.86153}}, <>][t], 
                                   SBMLModel`B[t] -> InterpolatingFunction[{{6.00982, 9.86153}}, <>][t], 
                                   SBMLModel`void[t] -> InterpolatingFunction[{{6.00982, 9.86153}}, <>][t],         
                                   SBMLModel`C[t] -> InterpolatingFunction[{{6.00982, 9.86153}}, <>][t]}], 
          InterpolationSet[9.78006, 13.195, {SBMLModel`A[t] -> InterpolatingFunction[{{9.78006, 13.2362}}, <>][t], 
                                   SBMLModel`B[t] -> InterpolatingFunction[{{9.78006, 13.2362}}, <>][t], 
                                   SBMLModel`void[t] -> InterpolatingFunction[{{9.78006, 13.2362}}, <>][t], 
                                   SBMLModel`C[t] -> InterpolatingFunction[{{9.78006, 13.2362}}, <>][t]}], 
          InterpolationSet[13.195, 18.195, {SBMLModel`A[t] -> InterpolatingFunction[{{13.195, 18.2802}}, <>][t], 
                                   SBMLModel`B[t] -> InterpolatingFunction[{{13.195, 18.2802}}, <>][t], 
                                   SBMLModel`void[t] -> InterpolatingFunction[{{13.195, 18.2802}}, <>][t], 
                                   SBMLModel`C[t] -> InterpolatingFunction[{{13.195, 18.2802}}, <>][t]}], 
          InterpolationSet[18.195, 19.5601, {SBMLModel`A[t] -> InterpolatingFunction[{{18.195, 19.8012}}, <>][t], 
                                   SBMLModel`B[t] -> InterpolatingFunction[{{18.195, 19.8012}}, <>][t], 
                                   SBMLModel`void[t] -> InterpolatingFunction[{{18.195, 19.8012}}, <>][t], 
                                   SBMLModel`C[t] ->InterpolatingFunction[{{18.195, 19.8012}}, <>][t]}], 
          InterpolationSet[19.5601, 24.7862, {SBMLModel`A[t] -> InterpolatingFunction[{{19.5601, 25.}}, <>][t], 
                                   SBMLModel`B[t] -> InterpolatingFunction[{{19.5601, 25.}}, <>][t], 
                                   SBMLModel`void[t] -> InterpolatingFunction[{{19.5601, 25.}}, <>][t], 
                                   SBMLModel`C[t] -> InterpolatingFunction[{{19.5601, 25.}}, <>][t]}], 
          InterpolationSet[24.7862, 25., {SBMLModel`A[t] -> InterpolatingFunction[{{24.7862, 25.}}, <>][t],
                                    SBMLModel`B[t] -> InterpolatingFunction[{{24.7862, 25.}}, <>][t], 
                                    SBMLModel`void[t] -> InterpolatingFunction[{{24.7862, 25.}}, <>][t], 
                                    SBMLModel`C[t] -> InterpolatingFunction[{{24.7862, 25.}}, <>][t]}]}

Input:   SBMLPlot[num];
Output:
         


Input:   getInterpolatingFunction[num[[3]]]
Output:  {SBMLModel`A[t] -> InterpolatingFunction[{{9.78006, 13.2362}}, <>][t], 
         SBMLModel`B[t] -> InterpolatingFunction[{{9.78006, 13.2362}}, <>][t],
         SBMLModel`void[t] -> InterpolatingFunction[{{9.78006, 13.2362}}, <>][t], 
         SBMLModel`C[t] -> InterpolatingFunction[{{9.78006, 13.2362}}, <>][t]}


Input:   getInterpolatingFunction/@num
Output:  {{SBMLModel`A[t] -> InterpolatingFunction[{{0., 6.02959}}, <>][t], 
           SBMLModel`B[t] -> InterpolatingFunction[{{0., 6.02959}}, <>][t], 
           SBMLModel`void[t] -> InterpolatingFunction[{{0., 6.02959}}, <>][t], 
           SBMLModel`C[t] -> InterpolatingFunction[{{0., 6.02959}}, <>][t]
           }, 
           {
           SBMLModel`A[t] -> InterpolatingFunction[{{6.00982, 9.86153}},<>][t], 
           SBMLModel`B[t] -> InterpolatingFunction[{{6.00982, 9.86153}}, <>][t], 
           SBMLModel`void[t] -> InterpolatingFunction[{{6.00982, 9.86153}}, <>][t], 
           SBMLModel`C[t] -> InterpolatingFunction[{{6.00982,9.86153}}, <>][t]
           }, 
           {
           SBMLModel`A[t] -> InterpolatingFunction[{{9.78006, 13.2362}}, <>][t], 
           SBMLModel`B[t] -> InterpolatingFunction[{{9.78006, 13.2362}}, <>][t], 
           SBMLModel`void[t] -> InterpolatingFunction[{{9.78006, 13.2362}}, <>][t], 
           SBMLModel`C[t] -> InterpolatingFunction[{{9.78006, 13.2362}}, <>][t]
           }, 
           {
           SBMLModel`A[t] ->InterpolatingFunction[{{13.195, 18.2802}}, <>][t], 
           SBMLModel`B[t] -> InterpolatingFunction[{{13.195, 18.2802}}, <>][t],
           SBMLModel`void[t] -> InterpolatingFunction[{{13.195, 18.2802}}, <>][t], 
           SBMLModel`C[t] -> InterpolatingFunction[{{13.195, 18.2802}}, <>][t]
           }, 
           {
           SBMLModel`A[t] -> InterpolatingFunction[{{18.195, 19.8012}}, <>][t], 
           SBMLModel`B[t] -> InterpolatingFunction[{{18.195,19.8012}}, <>][t], 
           SBMLModel`void[t] -> InterpolatingFunction[{{18.195, 19.8012}}, <>][t], 
           SBMLModel`C[t] -> InterpolatingFunction[{{18.195, 19.8012}}, <>][t]
           }, 
           {
           SBMLModel`A[t] -> InterpolatingFunction[{{19.5601, 25.}}, <>][t], 
           SBMLModel`B[t] -> InterpolatingFunction[{{19.5601, 25.}}, <>][t],
           SBMLModel`void[t] -> InterpolatingFunction[{{19.5601, 25.}}, <>][t], 
           SBMLModel`C[t] -> InterpolatingFunction[{{19.5601, 25.}}, <>][t]
           }, 
           {
           SBMLModel`A[t] -> InterpolatingFunction[{{24.7862, 25.}}, <>][t], 
           SBMLModel`B[t] -> InterpolatingFunction[{{24.7862, 25.}}, <>][t], 
           SBMLModel`void[t] -> InterpolatingFunction[{{24.7862, 25.}}, <>][t], 
           SBMLModel`C[t] -> InterpolatingFunction[{{24.7862, 25.}}, <>][t]}
           }


Here is the file simpleevent.xml (Click here to download the file, zipped):
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated 15-March-2004 13:13:58.541588 -->
<!-- Generated by MathSBML 2.2.1-beta-18 (02-March-2004) -->
<sbml xmlns="http://www.sbml.org/sbml/level2"
    level="2"
    version="1">
 <model id="SBMLModel"
     name="SBMLModel">
  <listOfFunctionDefinitions/>
  <listOfUnitDefinitions/>
  <listOfCompartments>
   <compartment id="Compartment1"
       name="Compartment1"/>
  </listOfCompartments>
  <listOfSpecies>
   <species id="A"
       name="A"
       compartment="Compartment1"
       boundaryCondition="false"
       constant="false"
       initialAmount="5"/>
   <species id="B"
       name="B"
       compartment="Compartment1"
       boundaryCondition="false"
       constant="false"
       initialAmount="0"/>
   <species id="void"
       name="void"
       compartment="Compartment1"
       boundaryCondition="true"
       constant="false"/>
  </listOfSpecies>
  <listOfParameters>
   <parameter id="C"
       name="C"
       value="0.5"
       constant="false"/>
  </listOfParameters>
  <listOfRules>
   <rateRule variable="C"
       metaid="rule1">
    <math xmlns="http://www.w3.org/1998/Math/MathML">
     <apply>
      <times/>
      <cn type="real">0.4</cn>
      <ci>C</ci>
     </apply>
    </math>
   </rateRule>
  </listOfRules>
  <listOfReactions>
   <reaction id="reaction1"
       name="reaction1"
       reversible="true"
       fast="false">
    <listOfReactants>
     <speciesReference species="A"/>
    </listOfReactants>
    <listOfProducts>
     <speciesReference species="B"/>
    </listOfProducts>
    <listOfModifiers/>
    <kineticLaw timeUnits="time"
        substanceUnits="substance">
     <math xmlns="http://www.w3.org/1998/Math/MathML">
      <apply>
       <times/>
       <ci>A</ci>
       <ci>k</ci>
      </apply>
     </math>
     <listOfParameters>
      <parameter id="k"
          value="1"/>
     </listOfParameters>
    </kineticLaw>
   </reaction>
   <reaction id="reaction2"
       name="reaction2"
       reversible="true"
       fast="false">
    <listOfReactants>
     <speciesReference species="void"/>
    </listOfReactants>
    <listOfProducts>
     <speciesReference species="A"/>
    </listOfProducts>
    <listOfModifiers/>
    <kineticLaw timeUnits="time"
        substanceUnits="substance">
     <math xmlns="http://www.w3.org/1998/Math/MathML">
      <ci>k</ci>
     </math>
     <listOfParameters>
      <parameter id="k"
          value="1"/>
     </listOfParameters>
    </kineticLaw>
   </reaction>
  </listOfReactions>
  <listOfEvents>
   <event id="split"
       name="split B">
    <trigger>
     <math xmlns="http://www.w3.org/1998/Math/MathML">
      <apply>
       <geq/>
       <ci>B</ci>
       <cn type="integer">10</cn>
      </apply>
     </math>
    </trigger>
    <listOfEventAssignments>
     <eventAssignment variable="B"
         metaid="">
      <math xmlns="http://www.w3.org/1998/Math/MathML">
       <apply>
        <times/>
        <ci>B</ci>
        <apply>
         <power/>
         <cn type="integer">2</cn>
         <cn type="integer">-1</cn>
        </apply>
       </apply>
      </math>
     </eventAssignment>
    </listOfEventAssignments>
   </event>
   <event id="Csplit"
       name="split C">
    <trigger>
     <math xmlns="http://www.w3.org/1998/Math/MathML">
      <apply>
       <geq/>
       <ci>C</ci>
       <cn type="integer">25</cn>
      </apply>
     </math>
    </trigger>
    <listOfEventAssignments>
     <eventAssignment variable="C"
         metaid="">
      <math xmlns="http://www.w3.org/1998/Math/MathML">
       <cn type="real">0.5</cn>
      </math>
     </eventAssignment>
     <eventAssignment variable="B"
         metaid="">
      <math xmlns="http://www.w3.org/1998/Math/MathML">
       <apply>
        <times/>
        <cn type="real">0.75</cn>
        <ci>B</ci>
       </apply>
      </math>
     </eventAssignment>
    </listOfEventAssignments>
   </event>
  </listOfEvents>
 </model>
</sbml>

[rev 03-15-04]