MathLib.Functn is MathLib's implementation of mathematical functions.

Unlike all other MathLib constructors MathLib.Functn is called without the new keyword, due to technical limitations in JavaScript. Most of the times however you probably don't need to call MathLib.Functn directly, since MathLib has very many predefined functions.


Lets say we want to implement the Fermi rounding, which is used in Fermi estimates: Fermi(x)=10round(log10x) First we have to create the JavaScript function like this: var fermi = function (x) { return Math.pow(10, Math.round(Math.log(x) / Math.LN10)) } Next we decide what our bound variable should be. Lets choose x like in the formula above. var args = [MathLib.Expression.variable('x')]; Since MathLib also works with functions that have more then one variable we have to put the variable in an array. Now we can generate the mathematical expression which is describing the function. This is important when modifying the function later. var expr = new MathLib.Expression({ subtype: 'functionDefinition', args: args, content: [new MathLib.Expression({ subtype: 'functionCall', content: args, value: 'Fermi' }) ] }) Finally we can construct the Functn: MathLib.Functn(fermi, { name: 'Fermi', expression: expr });


The function MathLib.Functn
The string "functn"


Numeric derivative at a given point.
Numeric evaluation of an integral.
Returns a content MathML representation of the function as string.
Returns a LaTeX representation of the function as string.
Returns a presentation MathML representation of the function as string.
Returns a representation of the function as string.