| MathSBML Home Page | MathSBML Site Map |
addFunction[options] adds a <functionDefinition> to the current model. Options are the same as functionToSBML.
If an id is not specified for the function, one is automatically generated.
addFunction[f,options] is the same as addFunction[id->f, options].
modifyFunction[options] modifies the specified <functionDefinition>. Options are the same as functionToSBML.
modifyFunction[f,options] is the same as modifyFunction[id->f, options].
removeFunction[options] removes the specified <functionDefinition>
addFunction, modifyFunction, and removeFunction are new in 2.2.0.The following example creates a new model funct, and adds two functions to it: f(x,y,z)=x+y*z and g(x)=x^(1/3), and then displays the SBML. Then the function f(x,y,z) is modified to f(x,y,z)=x+y+z, and the modified SBML is shown. Finally, the function f is removed, and the final SBML is shown.
Input: newModel["funct", name -> "Example with Functions"]; addFunction[f, name -> "x plus y times z", arguments -> {x, y, z}, math -> x + y *z]; Output: Function f added. Input: addFunction[id -> g, name -> "cuberoot", arguments -> x, math -> x^(1/3)]; Output: Function g added. Input: createModel[] Output: <?xml version="1.0" encoding="UTF-8"?> <!-- Generated 27-September-2003 15:48:40.051773 --> <!-- Generated by MathSBML 2.1.5b13 (27 Sept 2003) --> <sbml xmlns="http://www.sbml.org/sbml/level2" level="2" version="1"> <model id="funct" name="Example with Functions"> <listOfFunctionDefinitions> <functionDefinition id="f" name="x plus y times z"> <math xmlns="http://www.w3.org/1998/Math/MathML"> <lambda> <bvar> <ci>x</ci> </bvar> <bvar> <ci>y</ci> </bvar> <bvar> <ci>z</ci> </bvar> <apply> <plus/> <ci>x</ci> <apply> <times/> <ci>y</ci> <ci>z</ci> </apply> </apply> </lambda> </math> </functionDefinition> <functionDefinition id="g" name="cuberoot"> <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/>3</cn> </apply> </lambda> </math> </functionDefinition> </listOfFunctionDefinitions> <listOfUnitDefinitions/> <listOfCompartments/> <listOfSpecies/> <listOfParameters/> <listOfRules/> <listOfReactions/> <listOfEvents/> </model> </sbml> Input: modifyFunction[f, name -> "x plus y plus z", math -> x + y + z]; Output: Previous occurance of function f removed. Function f added. Input: createModel[] Output: <?xml version="1.0" encoding="UTF-8"?> <!-- Generated 27-September-2003 15:48:57.227498 --> <!-- Generated by MathSBML 2.1.5b13 (27 Sept 2003) --> <sbml xmlns="http://www.sbml.org/sbml/level2" level="2" version="1"> <model id="funct" name="Example with Functions"> <listOfFunctionDefinitions> <functionDefinition id="g" name="cuberoot"> <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/>3</cn> </apply> </lambda> </math> </functionDefinition> <functionDefinition id="f" name="x plus y plus z"> <math xmlns="http://www.w3.org/1998/Math/MathML"> <lambda> <bvar> <ci>x</ci> </bvar> <bvar> <ci>y</ci> </bvar> <bvar> <ci>z</ci> </bvar> <apply> <plus/> <ci>x</ci> <ci>y</ci> <ci>z</ci> </apply> </lambda> </math> </functionDefinition> </listOfFunctionDefinitions> <listOfUnitDefinitions/> <listOfCompartments/> <listOfSpecies/> <listOfParameters/> <listOfRules/> <listOfReactions/> <listOfEvents/> </model> </sbml> Input: removeFunction[f]; Output: Function f removed. Input: createModel[] Output: <?xml version="1.0" encoding="UTF-8"?> <!-- Generated 27-September-2003 16:14:32.486646 --> <!-- Generated by MathSBML 2.1.5b13 (27 Sept 2003) --> <sbml xmlns="http://www.sbml.org/sbml/level2" level="2" version="1"> <model id="funct" name="Example with Functions"> <listOfFunctionDefinitions> <functionDefinition id="g" name="cuberoot"> <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/>3</cn> </apply> </lambda> </math> </functionDefinition> </listOfFunctionDefinitions> <listOfUnitDefinitions/> <listOfCompartments/> <listOfSpecies/> <listOfParameters/> <listOfRules/> <listOfReactions/> <listOfEvents/> </model> </sbml>