Endpoint

Name: | Math Runtime |

Description: | Mathematical Engine Runtime - Full Symbolic and Numeric operations |

Id: | MathRuntime |

Category: | accessor |

Identifier Syntax

**Math Runtime** is an accessor using Active URI syntax with the following base identifiers:

Base |
---|

active:math |

and the following arguments: (for more details on argument passing details see here)

Argument | Rules | Typing | Description |
---|---|---|---|

operator | Mandatory | Representation (java.lang.Object) | expression to evaluate |

varargs
[varargs]
| Any quantity | Representation (java.lang.Object) | Varargs allows an arbitrary number of additional unspecified arguments. |

Response

The response representation of this accessor for SOURCE requests is unknown.

This accessor throws no documented exceptions.

Import Requirements

To use Math Runtime accessor you must import the module
**urn:org:netkernel:lang:math**:

<import>

<uri>urn:org:netkernel:lang:math</uri>

</import>

<uri>urn:org:netkernel:lang:math</uri>

</import>

The Math language runtime provides a rich symbolic and numeric mathematical evaluation engine.

The operator argument *must* be transreptable to java.lang.String and is the mathematical expression
to be evaluated.

The operator

Expand[(x+1)*(x-3)*(y+2)]

is evaluated to the symbolic expansion...

x^2*y-2*x*y-3*y+2*x^2-4*x-6

This is an example of calculating the symbolic derivative (with respect to x)...

D[x^2*y-2*x*y-3*y+2*x^2-4*x-6, x]

is evaluated to the symbolic expression...

2*x*y-2*y+4*x-4

Arbitrary named arguments may be supplied. Numeric arguments will be provided as numeric variables substituted into the operator expression.

For example:

operator: x^2-3*x+1

x argument value: 2

will return the numeric result *1.0*

Alternatively if the named argument is a String it will be parsed to an expression and substituted into the expression...

For example:

operator: x^2-3*x+1

x argument value: y*z+3

will return the symbolic result *(y*z+3)^2-3*(y*z+3)+1*

**Warning** be careful with symbolic arguments to avoid recursive variable references (the same symbol in the argument as the argument name itself) which will result in a stack overflow exception.

The active:math engine can be used to create very rich and powerful mathematical pipeline processes, where the symbolic or numeric response of one stage is fed into a following stage - either as the operator or as an argument.

The active:math engine uses the Symja project which in turn incorporates many powerful math functions from Apache Commons-Math and JSA. A small set of examples are provided on the Symja site here.

A reference list is provided here.