CAMsymbolicFunction Class

Include File : symfun.h
An instance of class CAMsymbolicFunction implements a double valued function (of an arbitrary number of
double arguments) as specified by an initialization character string (i.e. symbolic initialization). The syntax
for the initialization string is that of general C++ expressions. The initialization string can contain references
to C++ math functions (those in math.h) as well as symbolic constants. The () operator is overloaded so the standard
functional evaluation syntax, e.g. f(x), is used to evaluate the CAMsymbolicFuntion instance.
Chris Anderson (C) UCLA 7/21/97
CAMsymbolicFunction Class Reference
Include file : symfun.h
Constructors/Initializers
CAMsymbolicFunction()
CAMsymbolicFunction(const CAMsymbolicFunction& F)
CAMsymbolicFunction(char** V, int Vcount, char* S)
CAMsymbolicFunction(char** V, int Vcount, char** C, int Ccount, double* Cvalues, char* S)
int initialize()
int initialize(char** V, int Vcount, char* S)
int initialize(char** V, int Vcount, char** C, int Ccount, double* Cvalues, char* S)
Member Functions
Evaluation
double operator()(double x)
double operator()(double x1, double x2)
double operator()(double x1, double x2, double x3)
double operator()(double x1, double x2, double x3, double x4)
double operator()(double* x, int n)
Input/output
operator <<(CAMsymbolicFunction& F)
Get/Set
char* getConstructorString()
int getVariableCount()
char* getVariableName(int i)
int getConstantCount()
char* getConstantName(int i)
double getConstantValue(int i)
void setConstantValue(char* Cname,double x)
Constructors
CAMsymbolicFunction() |
Creates a "null" CAMsymbolicFunction. The CAMsymbolicFunction is initialized with the initialize
member functions. |
CAMsymbolicFunction (const CAMsymbolicFunction& F) |
Copy constructor. |
CAMsymbolicFunction(char** V, int Vcount, char* S) |
Creates a CAMsymbolicFunction of Vcount variables from the initialization string S. S is a null terminated character
string. The names of the variables in the function are specified by the array of null terminated character strings
V. V has length Vcount. If the construction process fails, an exception is thrown. |
CAMsymbolicFunction(char** V, int Vcount, char** C, int Ccount, double* Cvalues, char*
S) |
Creates a CAMsymbolicFunction of Vcount variables and Ccount symbolic constants from the initialization string
S. S is a null terminated character string. The names of the variables in the function are specified by the array
of character strings V. V has length Vcount. The names of the symbolic constants are specified in the array of
strings C, and the values of the symbolic constants are specified in the array Cvalues. Both C and Cvalues have
length Ccount. If the construction process fails, an exception is thrown. |
Initialize
int initialize() |
Deletes the existing data associated with the CAMsymbolicFunction and resets the CAMsymbolicFunction to a "null"
instance. Returns 0 if initialization is successful. |
int initialize(char** V, int Vcount, char* S) |
Deletes the existing data associated with the CAMsymbolicFunction and initializes the CAMsymbolicFunction to a
function of Vcount variables from the initialization string S. S is a null terminated character string. The names
of the variables in the function are specified by the array of character strings V. V has length Vcount. Returns
0 if initialization is successful, 1 otherwise. (Unsuccessful initialization is not handled with exceptions because
of the desire to support intra-language use of this class). |
int initialize(char** V, int Vcount, char** C, int Ccount,double* Cvalues, char* S) |
Deletes the existing data associated with the CAMsymbolicFunction and initializes the CAMsymbolicFunction to a
function of Vcount variables from the initialization string S. S is a null terminated character string. The names
of the variables in the function are specified by the array of character strings V. V has length Vcount. The names
of the symbolic constants are specified in the array of strings C, and the values of the symbolic constants are
specified in the array Cvalues. Both C and Cvalues have length Ccount. Returns 0 if initialization is successful,
1 otherwise. (Unsuccessful initialization is not handled with exceptions because of the desire to support intra-language
use of this class). |
Input/Output
operator <<(CAMsymbolicFunction& F) |
Outputs the initialization string, the variable names, the symbolic constant names and the symbolic constant values. |
Evaluation
double operator()(double x) |
Returns the value of the CAMsymbolicFunction using the variable value x. If the CAMsymbolicFunction is not a function
of one variable an exception is thrown. |
double operator()(double x1, double x2) |
Returns the value of the CAMsymbolicFunction using the two variable values x1 and x2. If the CAMsymbolicFunction
is not a function of two variables an exception is thrown. |
double operator()(double x1, double x2, double x3) |
Returns the value of the CAMsymbolicFunction using the three variable values x1,x2, and x3. If the CAMsymbolicFunction
is not a function of three variables an exception is thrown. |
double operator()(double x1, double x2, double x3, double x4) |
Returns the value of the CAMsymbolicFunction using the four variable values x1, x2, x3 and x4. If the CAMsymbolicFunction
is not a function of four variables an exception is thrown. |
double operator()(double*x, int n) |
Returns the value of the CAMsymbolicFunction using the n variable values in the double array x. If the CAMsymbolicFunction
is not a function of n variables an exception is thrown. |
Get/Set Methods
char* getConstructorString() |
Returns the string used to initialize the CAMsymbolicFunction. |
int getVariableCount() |
Returns the number of variables associated with the CAMsymbolicFunction. |
char* getVariableName(int i) |
Returns the name of the ith variable associated with the CAMsymbolicFunction. |
int getConstantCount() |
Returns the number of symbolic constants associated with the CAMsymbolicFunction. |
char* getConstantName(int i) |
Returns the name of the ith symbolic constant associated with the CAMsymbolicFunction. |
double getConstantValue(int i) |
Returns the value of the ith symbolic constant associated with the CAMsymbolicFunction. |
void setConstantValue(char* Cname, double x) |
The value of the symbolic constant Cname associated with the CAMsymbolicFunction initialization string is set to
x. |