MathSBML

MathSBML Home Page MathSBML Site Map

MathSBML Model Builder: functionToSBML


functionToSBML[options] returns a single SBML <functionDefinition.../>;

functionToSBML[{{options},{options},...}] returns an SBML <listOfFunctionDefinitions.../>;

functionToSymbolicSBML[arguments] returns Symbolic SBML for a single <functionDefinition.../>;

New in version 2.1.4. Revised in 2.6.0.

Options

Option Default Description
arguments generated* Single argument or list of arguments, as in arguments->x or arguments->{x, y, z}. If not specified, a dummy variable is generated.
id generated* Value of SBML id. *If not specified, an id of the form functionn, where n is an integer, is generated.
math 1 Expression giving function value in terms of the arguments.
name Uses id* Value of SBML name. *If not specified, the value of the id is used.
sboTerm No default sboTerm for this function
metaid No default metaid for this function
notes No default notes for this function
annotation No default annotation for this function

Example 1: Single function, <function .. /> definition

The following input expression (optional line-feeds added to emphasize syntactical nesting):

	functionToSBML[id->alfafa,
	               arguments->{horse, grass},
	               math->(1/(horse*grass))]

will produce the following output:

	<functionDefinition id="alfafa"
	    name="alfafa">
	 <math xmlns="http://www.w3.org/1998/Math/MathML">
	  <lambda>
	   <bvar>
	    <ci>horse</ci>
	   </bvar>
	   <bvar>
	    <ci>grass</ci>
	   </bvar>
	   <apply>
	    <times/>
	    <cn type="integer">1</cn>
	    <apply>
	     <power/>
	     <apply>
	      <times/>
	      <ci>grass</ci>
	      <ci>horse</ci>
	     </apply>
	     <cn type="integer">-1</cn>
	    </apply>
	   </apply>
	  </lambda>
	 </math>
	</functionDefinition>

Example 2: Multiple functions, <listOfFunctionDefinitions .. /> definition

The following input expression (optional line-feeds added to emphasize syntactical nesting):

	functionToSBML[
	  { {id->QRT, arguments->{x}, math->x^(1/4)},
	    {id->sinc, arguments->{x}, math->Sin[x]/x}
	  }]

will produce the following output:


	<listOfFunctionDefinitions>
	 <functionDefinition id=\"QRT\"
	     name=\"QRT\">
	  <math xmlns=\"http://www.w3.org/1998/Math/MathML\">
	   <lambda>
	    <bvar>
	     <ci>x</ci>
	    </bvar>
	    <apply>
	     <power/>
	     <ci>x</ci>
	     <cn type=\"rational\">1<sep/>4</cn>
	    </apply>
	   </lambda>
	  </math>
	 </functionDefinition>
	 <functionDefinition id=\"sinc\"
	     name=\"sinc\">
	  <math xmlns=\"http://www.w3.org/1998/Math/MathML\">
	   <lambda>
	    <bvar>
	     <ci>x</ci>
	    </bvar>
	    <apply>
	     <times/>
	     <apply>
	      <sin/>
	      <ci>x</ci>
	     </apply>
	     <apply>
	      <power/>
	      <ci>x</ci>
	      <cn type=\"integer\">-1</cn>
	     </apply>
	    </apply>
	   </lambda>
	  </math>
	 </functionDefinition>
	</listOfFunctionDefinitions>

Go to the top of this page