Release 1.0 . University of Houston. 

UHMath

Inherits From:	Object

Declared In:	UHMath.h

Class Description

UHMath object communicates with Mathematica using MathLink.   The user can send any valid Mathematica expression  to it via evaluateExpression: toString: or  plotExpression: toPSView:. These two  general methods will  message Mathematica's kernel to carry out the computations.  The method  evaluateExpression: toString: should be used if  text output is expected.  If  the expected  output is a graph, use plotExpression: toPSView:.  These methods  use the same link to Mathematica; therefore, as long as the link is not closed,  the connection to the kernel remains open and Mathematica overhead is reduced.

Instance Variables

int code;
MLINK mlp;
char * plotErrorText;
NXStream *stream;
id resultText;
id resultPSView;

code 	An integer describing the type of packet sent by Mathematica.

mlp	Link to Mathematica.

*plotErrorText 	Pointer to a text string containing the most recent plotting errors.

*stream 	Pointer to a stream  which  contains output sent by Mathematica.

resultText 	The outlet for evaluateExpressionFrom:. It must be a scrollView or a Text object.

resultPSView 	The outlet for plotExpressionFrom:. It must be a PSView.

Method Types

Initializing a new UHMath object	- init

Opening and closing a link	- openLink
	- closeLink

Mathematica  requests	± evaluateExpression: toString:
	± evaluateExpressionFrom:
	± evaluateExpression: toText:
± plotExpression: toPSView:
± plotExpressionFrom:
 
Errors 	- plotError

Instance Methods

closeLink:
- closeLink

 Closes the link to Mathematica.  Returns self if successful, otherwise returns nil.

See also:  - openLink.

evaluateExpression: toString:
- evaluateExpression:(char *)exp toString:(char **)string

It evaluates the expression in exp and places the result in string.  Returns self.

 See also: ± evaluateExpressionFrom:, ± evaluateExpression: toText:,- plotExpression: toPSView:, ± plotExpressionFrom:.

evaluateExpression: toText:
- evaluateExpression:(char *)exp toText:(id)aText

It evaluates the expression in exp and places the result in aText, which must be a Text object.  Returns self.
 See also: ± evaluateExpressionFrom:, ± evaluateExpression: toString:,- plotExpression: toPSView:, ± plotExpressionFrom:.

evaluateExpressionFrom:
- evaluateExpressionFrom:sender

It takes the expression from sender and places the result in resultText, which must be a Text or a ScrollView object.  The sender must be a subclass of  Control.  Returns self if successful, otherwise returns nil.

 See also: ± evaluateExpression: toText, ± evaluateExpression: toString:,- plotExpression: toPSView:, ±plotExpressionFrom:.

init
- init

Returns self.

openLink
- openLink

 Opens a link to Mathematica.  Returns self if successful, otherwise returns nil.

See also:  - closeLink.

plotError
-(char *) plotError

Returns the most recent plotting error. 

See also:  - plotExpression: toPSView:.

plotExpression: toPSView:
- plotExpression:(char *)exp toPSView: aView

 It plots the expression in exp to  aView,  which must be a  PSView.  Returns self if successful, otherwise returns  nil.

See also:  - evaluateExpression: toString:, ± evaluateExpressionFrom:, ± evaluateExpression: toText:, ±plotExpressionFrom:.

plotExpressionFrom:
- plotExpressionFrom:sender 

It takes the plot expression from sender and plots it to  reusltPSView,  which must be a  PSView.  The sender must be a subclass of  Control.  Returns self if successful, otherwise returns  nil.

See also:  - evaluateExpression: toString:, ± evaluateExpression: toText:, ± evaluateExpressionFrom:,  
± plotExpression: toPSView:.