function DefineComplex(const AVarName: string): TComplexValue;
Defines new complex variable.
| # | Name | Type | Description |
|---|---|---|---|
| 1 | AVarName | string |
Returns: TComplexValue
Remarks:
If variable with name AVarName already was definded, it will be redefined and all expressions which contain the symbol AVarName will be recompiled before the next evaluation.
Examples
uses MtxParseExpr, MtxParseClass;
procedure Example(MyParser: TMtxExpression);
var z: TComplexValue;
res: TCplx;
begin
// 1. Define variables
z := MyParser.DefineComplex('z');
// 2. Set values
z.ComplexValue := Cplx(-2,3);
// 3. Add formula and evaluate,
MyParser.AddExpr('2*i*z');
res := MyParser.EvaluateComplex;
// res = -6-4*i
end;
See Also: TMtxExpression.Undefine, TMtxExpression.VarByName, TMtxExpression.GetVarList, TMtxExpression.DefineDouble, TMtxExpression.DefineVariable, TMtxExpression.DefineVector, TMtxExpression.DefineMatrix, TMtxExpression.DefineFunction, TMtxExpression.DefineVaryingFunction, TMtxExpression.DefineOperator, TMtxExpression.DefineDoubleConstant, TMtxExpression.DefineComplexConstant