TComplexValue *DefineComplex(const DewString &AVarName);
Defines new complex variable.
| # | Name | Type | Description |
|---|---|---|---|
| 1 | AVarName | const DewString & |
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
#include "Math387.h"
#include "MtxParseClass.h"
#include "MtxParseExpr.h"
#include "Units.Math387.h"
using namespace Dew;
using namespace Dew::Math;
using namespace Dew::Math::Units;
void Example()
{
TMtxExpression* MyParser = new TMtxExpression();
// 1. Define variables
TComplexValue* z = MyParser->DefineComplex("z");
// 2. Set values
z->ComplexValue = Math387::Cplx(-2, 3);
// 3. Add formula and evaluate,
MyParser->AddExpr("2i*z");
TCplx res = MyParser->EvaluateComplex();
// res = -6-4*i
delete MyParser;
}
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
Declared in Dew::Math::TMtxExpression · Dew.Math/MtxParseExpr.h · Cross-compiler