Skip to content

Latest commit

 

History

History
66 lines (39 loc) · 4.12 KB

File metadata and controls

66 lines (39 loc) · 4.12 KB

How to evaluate functions

Overview

The Symja constants are implemented in the package:

The Symja functions are implemented in the packages:

Built-in functions must implement the interface ICoreFunctionEvaluator and evaluate the arguments in a non standard way.

System functions must implement the interface IFunctionEvaluator and are evaluated according to the assigned function symbol attributes defined in the IFunctionEvaluator#setUp() method. A lot of system functions have associated pattern matching rule files in the folder:

These rules are converted by the class org.matheclipse.core.preprocessor.RulePreprocessor into the package org.matheclipse.core.reflection.system.rules

A new function name should be added to org.matheclipse.core.convert.AST2Expr#FUNCTION_STRINGS String[] array, with a leading upper case character in its name.

Example evaluating D(<expression>, x)

In the following section the evaluation and implementation of the partial derivative function is described.

Example usage:

>> D(sin(x)^3 + x, x)
1+3*Sin(x)^2*Cos(x)

To see the intermediate evaluation steps you can use the Trace( ) function

>> Trace(D(sin(x)^3 + x, x)) 

Internally the D(<expression>, x) function uses the Derivative( ) function. Both function names are defined in

Both of these built-in functions are defined in the org.matheclipse.core.reflection.system package:

The Derivative( ) rules are converted by the class org.matheclipse.core.preprocessor.RulePreprocessor into the rules java file org.matheclipse.core.reflection.system.rules.DerivativeRules.

To use these functions (or other built-in constants and functions) from within other java sources you can import org.matheclipse.core.expression.F

For D and Derivative there are two static methods defined:

public static IAST D(final IExpr a0, final IExpr a1)

public static IAST Derivative(final IExpr... a)