TDoubleValue DefineDouble(String AVarName)
Defines new double variable.
| # | Name | Type | Description |
|---|---|---|---|
| 1 | AVarName | String |
Returns: TDoubleValue
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
using Dew.Math;
using Dew.Math.Units;
namespace Dew.Examples
{
void Example()
{
// 1. Define variables
TDoubleValue x = MyParser.DefineDouble("x");
TDoubleValue y = MyParser.DefineDouble("y");
// 2. Set values
x.DoubleValue = 3.0;
y.DoubleValue = 4.0;
// 3. Add formula and evaluate,
MyParser.AddExpr("Sqrt(x*x+y*y)");
double res = MyParser.EvaluateDouble();
// res = 5
}
}
See Also: TMtxExpression.Undefine, TMtxExpression.VarByName, TMtxExpression.GetVarList, TMtxExpression.DefineVariable, TMtxExpression.DefineComplex, TMtxExpression.DefineVector, TMtxExpression.DefineMatrix, TMtxExpression.DefineFunction, TMtxExpression.DefineVaryingFunction, TMtxExpression.DefineOperator, TMtxExpression.DefineDoubleConstant, TMtxExpression.DefineComplexConstant