AngouriMath
Matrix
Method with 2 overloads
Matrix(AngouriMath.Entity[0:,0:])
Summary
Creates an instance of Matrix.Parameter "values"
A two-dimensional array of values.
The first dimension is the row count, the second one is for columns.
Returns
A two-dimensional Matrix which is a matrixExample
using System; using AngouriMath; using static AngouriMath.Entity; using static AngouriMath.MathS; var A = Matrix(new Entity[,] { { 1, 2, 3 }, { 4, 5, 6 } } ); Console.WriteLine(A.ToString(multilineFormat: true)); var B = Vector(1, 2, 3, 4); Console.WriteLine(B.ToString(multilineFormat: true)); Matrix C = @" [[1, 2], [3, 4], [5, 6]] "; Console.WriteLine(C.ToString(multilineFormat: true)); Matrix D = "[1, 2, 3, 4]"; Console.WriteLine(D.ToString(multilineFormat: true));
Prints
Matrix[2 x 3] 1 2 3 4 5 6 Matrix[4 x 1] 1 2 3 4 Matrix[3 x 2] 1 2 3 4 5 6 Matrix[4 x 1] 1 2 3 4
Matrix(System.Int32,System.Int32,System.Func{System.Int32,System.Int32,AngouriMath.Entity})
Summary
Creates an instance of matrix, where each cell's
index is mapped to a value with the help of the
mapping function.
Parameter "rowCount"
The number of rows (corresponds to the first index).
Parameter "colCount"
The number of columns (corresponds to the second index).
Parameter "map"
The first argument of the mapping function
function is the index of row, the second one for the
column index.
Indexing starts from 0.
Returns
A newly created matrix of the given size.
Example
using System; using AngouriMath.Extensions; using static AngouriMath.MathS; var expr = "sin(x) + cos(y)"; var vars = new[] { Var("x"), Var("y") }; var A = Matrix(2, 2, (i1, i2) => expr .Differentiate(vars[i1]) .Differentiate(vars[i2]) .Simplify()); Console.WriteLine(A.ToString(multilineFormat: true)); Console.WriteLine(ZeroMatrix(3)); Console.WriteLine(ZeroMatrix(3, 4)); Console.WriteLine(ZeroVector(3));
Prints
Matrix[2 x 2] -sin(x) 0 0 -cos(y) [[0, 0, 0], [0, 0, 0], [0, 0, 0]] [[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]] [0, 0, 0]
Angouri © 2019-2023 · Project's repo · Site's repo · Octicons · Transparency · 1534 pages online