Overload List
| # | Signature | Description |
|---|---|---|
| 1 | function DefineVector(const AVarName: string): TVectorValue; | Use internal vector. |
| 2 | function DefineVector(const AVarName: string; const Vec: TVec): TVectorValue; | Defines new vector variable. |
Overload 1: function DefineVector(const AVarName: string): TVectorValue;
Use internal vector.
| # | Name | Type | Description |
|---|---|---|---|
| 1 | AVarName | string |
Returns: TVectorValue
Overload 2: function DefineVector(const AVarName: string; const Vec: TVec): TVectorValue;
Defines new vector variable.
| # | Name | Type | Description |
|---|---|---|---|
| 1 | AVarName | string | |
| 2 | Vec | TVec |
Returns: TVectorValue
Remarks:
If variable with name AVarName already was definded, it is redefined and all expressions which contain the symbol AVarName will be recompiled before the next evaluation. External vector may be assigned as values holder. If external vector is not assigned, internal vector will be used.
Examples
uses MtxParseExpr, MtxExpr, MtxParseClass;
procedure Example(MyParser: TMtxExpression);
var x: TVectorValue;
s: TDoubleValue;
res: Vector;
begin
// 1. Define variables
x := MyParser.DefineVector('x');
s := MyParser.DefineDouble('s');
// 2. Set values
x.Value.SetIt(false,[1,-1,1]);
s.DoubleValue := 0.5;
// 3. Add formula and evaluate,
MyParser.AddExpr('-s*x');
res := MyParser.EvaluateVector;
// res = (-0.5,0.5, -0.5)
end;
See Also: TMtxExpression.Undefine, TMtxExpression.VarByName, TMtxExpression.GetVarList, TMtxExpression.DefineVariable, TMtxExpression.DefineDouble, TMtxExpression.DefineComplex, TMtxExpression.DefineMatrix, TMtxExpression.DefineFunction, TMtxExpression.DefineVaryingFunction, TMtxExpression.DefineOperator, TMtxExpression.DefineDoubleConstant, TMtxExpression.DefineComplexConstant