IGLib  1.7.2
The IGLib base library EXTENDED - with other lilbraries and applications.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros
IG.Lib.MathematicaInterface Class Reference

Interface with Mathematica. More...

+ Inheritance diagram for IG.Lib.MathematicaInterface:
+ Collaboration diagram for IG.Lib.MathematicaInterface:

Public Member Functions

 MathematicaInterface ()
 Constructs a new Mathematica interface object, without initializing a Mathematica link. More...
 
 MathematicaInterface (IKernelLink ml)
 Constructs a new Mathematica interface object, initialized with the specified Mathematica link. More...
 
 MathematicaInterface (MathKernel kernel)
 Constructs a new Mathematica interface object, initialized with the specified Mathematica link. More...
 
virtual void Init (MathKernel kernel)
 Initializes the current Mathematica interface object. More...
 
double EvaluateScalarFunction (string functionName, double functionArgument)
 Evaluates mathematica function that takes one numerical argument and returns a number. More...
 
double EvaluateScalarFunction (string functionName, double[] functionArguments)
 Evaluates mathematica function that takes one array argument and returns a number. More...
 
double EvaluateScalarFunction (string functionName, IVector functionArguments)
 Evaluates mathematica function that takes one array argument and returns a number. More...
 
string EvaluateExpression (string expression)
 Evaluates the specified expression in Mathematica and returns the result in output form as string. More...
 
int EvaluateIntegerExpression (string expression)
 Evaluates an integer-valued expression in Mathematica and returns its value. More...
 
double EvaluateDoubleExpression (string expression)
 Evaluates an real (double)-valued expression in Mathematica and returns its value. More...
 

Static Public Member Functions

static void ExampleCalculator ()
 Example use of Mathematica interface - a simple calculator. More...
 
static void ExampleCalculator (bool wrapNumerical)
 Example use of Mathematica interface - a simple calculator. More...
 

Protected Member Functions

virtual void Init ()
 Initializes the current Mathematica interface object. More...
 
virtual void Init (IKernelLink ml)
 Initializes the current Mathematica interface object. More...
 

Protected Attributes

IKernelLink _mathLink
 
Wolfram.NETLink.MathKernel _mathKernel
 

Static Protected Attributes

static MathematicaInterface _global
 

Properties

object Lock [get]
 Object's lock More...
 
static MathematicaInterface Global [get]
 Gets the global Mathematica interface. More...
 
IKernelLink MathLink [get, protected set]
 Mathematica's link object. More...
 
MathKernel MathKernel [get, protected set]
 Mathematica kernel. More...
 
- Properties inherited from IG.Lib.ILockable
object Lock [get]
 

Private Attributes

readonly object _lock = new object()
 

Detailed Description

Interface with Mathematica.

Constructor & Destructor Documentation

IG.Lib.MathematicaInterface.MathematicaInterface ( )
inline

Constructs a new Mathematica interface object, without initializing a Mathematica link.

Link is initialized the first time it is used.

IG.Lib.MathematicaInterface.MathematicaInterface ( IKernelLink  ml)
inline

Constructs a new Mathematica interface object, initialized with the specified Mathematica link.

Parameters
mlThe Mathematica link which is assigned to the object for communication with Mathematica. If null then no link is assigned and a link will be created the first time it is used.
IG.Lib.MathematicaInterface.MathematicaInterface ( MathKernel  kernel)
inline

Constructs a new Mathematica interface object, initialized with the specified Mathematica link.

Parameters
kernelThe Mathematica kernel which is assigned to the object for communication with Mathematica.

Member Function Documentation

virtual void IG.Lib.MathematicaInterface.Init ( )
inlineprotectedvirtual

Initializes the current Mathematica interface object.

virtual void IG.Lib.MathematicaInterface.Init ( IKernelLink  ml)
inlineprotectedvirtual

Initializes the current Mathematica interface object.

This sets the mathematica link if the specified link (argument ml ) is not null.

Parameters
mlThe Mathematica link which is assigned to the object for communication with Mathematica.
virtual void IG.Lib.MathematicaInterface.Init ( MathKernel  kernel)
inlinevirtual

Initializes the current Mathematica interface object.

This sets the mathematica kernel if the specified kernel (argument ml ) is not null.

Parameters
kernelThe Mathematica kernel which is assigned to the object for communication with Mathematica.
double IG.Lib.MathematicaInterface.EvaluateScalarFunction ( string  functionName,
double  functionArgument 
)
inline

Evaluates mathematica function that takes one numerical argument and returns a number.

Example: double res = EvaluateDoubleFunction("Sin",0.5);

Parameters
functionNameName of the function.
functionArgumentArgument of function.
Returns
Function value.
double IG.Lib.MathematicaInterface.EvaluateScalarFunction ( string  functionName,
double[]  functionArguments 
)
inline

Evaluates mathematica function that takes one array argument and returns a number.

Example: double res = EvaluateDoubleFunction("Plus",0.5,0.2);

Parameters
functionNameName of the function.
functionArgumentsArguments of function.
Returns
Function value.
double IG.Lib.MathematicaInterface.EvaluateScalarFunction ( string  functionName,
IVector  functionArguments 
)
inline

Evaluates mathematica function that takes one array argument and returns a number.

Example: double res = EvaluateDoubleFunction("Plus",0.5,0.2);

Parameters
functionNameName of the function.
functionArgumentsArguments of function.
Returns
Function value.
string IG.Lib.MathematicaInterface.EvaluateExpression ( string  expression)
inline

Evaluates the specified expression in Mathematica and returns the result in output form as string.

Parameters
expressionMathematical expression to be evaluated.
Returns
Result of evaluation in string form.
int IG.Lib.MathematicaInterface.EvaluateIntegerExpression ( string  expression)
inline

Evaluates an integer-valued expression in Mathematica and returns its value.

Parameters
expressionInteger-valued expression to be evaluated.
Returns
V of the expression.
double IG.Lib.MathematicaInterface.EvaluateDoubleExpression ( string  expression)
inline

Evaluates an real (double)-valued expression in Mathematica and returns its value.

Parameters
expressionExpression to be evaluated.
Returns
Value of the expression.
static void IG.Lib.MathematicaInterface.ExampleCalculator ( )
inlinestatic

Example use of Mathematica interface - a simple calculator.

Expressions are evaluated to rounded numerical values when possible (i.e. they are wrapped in 'N[...]' before sent to evaluation.

Referenced by IG.Script.AppTestShellExt.MathematicaFunctionTestApp().

static void IG.Lib.MathematicaInterface.ExampleCalculator ( bool  wrapNumerical)
inlinestatic

Example use of Mathematica interface - a simple calculator.

Parameters
wrapNumericalSpecifies whether expressions should return rounded numerical values when possible (i.e. they are wrapped in 'N[...]' before sent to evaluation).

References IG.Lib.UtilConsole.Read().

Member Data Documentation

readonly object IG.Lib.MathematicaInterface._lock = new object()
private
MathematicaInterface IG.Lib.MathematicaInterface._global
staticprotected
IKernelLink IG.Lib.MathematicaInterface._mathLink
protected
Wolfram.NETLink.MathKernel IG.Lib.MathematicaInterface._mathKernel
protected

Property Documentation

object IG.Lib.MathematicaInterface.Lock
get

Object's lock

MathematicaInterface IG.Lib.MathematicaInterface.Global
staticget

Gets the global Mathematica interface.

IKernelLink IG.Lib.MathematicaInterface.MathLink
getprotected set

Mathematica's link object.

Getter always returns a valid link object, creating a new one if not yet created.

MathKernel IG.Lib.MathematicaInterface.MathKernel
getprotected set

Mathematica kernel.


The documentation for this class was generated from the following file: