You are here: Symbol Reference > Dew Namespace > Dew.Math Namespace > Classes > TMtxExpression Class > TMtxExpression Methods > EvaluateMatrix Method > TMtxExpression.EvaluateMatrix Method ()
Dew Math for .NET
ContentsIndexHome
PreviousUpNext
TMtxExpression.EvaluateMatrix Method ()

Evaluates all expressions from the list.

Syntax
C#
Visual Basic
public TMtx EvaluateMatrix();

result of the latest expression as matrix value.

Use parser to evaluate the "A+2*B" formula where A=(2,1; 3, 0) B=(1,0; 1,1) are 2x2 matrices. 

 

using Dew.Math; using Dew.Math.Units; namespace Dew.Examples() { void Example(TMtxExpression MyParser) { // 1. Define variables TMatrixValue A = MyParser.DefineMatrix("A"); TMatrixValue B = MyParser.DefineDouble("B"); // 2. Set values A.Value.SetIt(2,2, false,new double[] {2,1,3,0}); B.Value.SetIt(2,2, false,new double[] {1,0,1,1}); // 3. Add formula and evaluate, MyParser.AddExpr("A+2*B"); Matrix res = new Matrix(false,0,0) res = MyParser.EvaluateMatrix; // res = (4,1; 5,2) } }
Copyright (c) 1999-2024 by Dew Research. All rights reserved.
What do you think about this topic? Send feedback!