Site Statistics  |   Contact  |   About Us       Saturday, January 25, 2020

HOME › AREAS OF EXPERTISE › Vectors and Matrices › ~ Number Matrix Manipulation

 "Number Matrix Manipulation" Matrix Manipulator Method
 Results = matrix: m1 = (1, 1, 1 1, 2, 3 1, 3, 6) matrix: m2 = (8, 1, 6 3, 5, 7 4, 9, 2) vector: v = (2, 0, 1) m1 + m2 = (9, 2, 7 4, 7, 10 5, 12, 8) m1 - m2 = (-7, 0, -5 -2, -3, -4 -3, -6, 4) m1 * m2 = (15, 15, 15 26, 38, 26 41, 70, 39) m2 * m1 = (15, 28, 47 15, 34, 60 15, 28, 43) m1 * v = (3, 5, 8) v * m1 = (20, 11, 14) Inverse of m1 = (3, -3, 1 -3, 5, -2 1, -2, 1) Inverse of m2 = (0.147222222222222, -0.144444444444444, 0.0638888888888889 -0.0611111111111111, 0.0222222222222222, 0.105555555555556 -0.0194444444444444, 0.188888888888889, -0.102777777777778) Determinant of m1 = 1 Determinant of m2 = -360

 Matrix m1 = { , , },{ , , }, , , } Matrix m2 = { , , },{ , , }, , , } Vector v = ( , , )

IMPLEMENTATION
Matrix Manipulation

A matrix can be used to describe linear equations, to keep track of the coefficients of the linear transformations and also to record data that depend on two parameters. Matrices can be added, multiplied and decomposed in many ways. Our sample involve square matrices. Although no details are given regarding the various operations, we do the following:

• Vector from Matrix - in some instances we extract a vector from a row or column of a matrix.

• Swap, Transpose and Trace - interchange two rows or two columns of a matrix as needed.

• Transformations - often used when performing operations on graphic objects. In our case we implement matrix transformation for n-dimensional vectors and n by n matrices (squared matrices).

• Matrix Multiplication - in our case the number of columns of the first matrix is the same as the number of rows of the second matrix.

• Mathematical Operators - we implement various mathematical operations (see results above).

• Determinant and Inverse - important qualities associated with square matrices.

Testing Matrix Operator Method

In order to test the Matrix Operator Method, a new TestMatrixOperators() static method has been added and executed. Supporting code and methods are not shown.

static void TestMatrixOperators();
{
ListBox1.Items.Clear();
MatrixR m1 = new MatrixR(new double[3, 3] { {t1, t2, t3}, {t4, t5, t6},
{t7, t8, t9}});
MatrixR m2 = new MatrixR(new double[3, 3] { {8, 1, 6}, {3, 5, 7},
{4, 9, 2}});
VectorR v = new VectorR(new double[] { t19, t20, t21 });
ListBox1.Items.Add(" matrix: m1 = " + m1);
ListBox1.Items.Add(" matrix: m2 = " + m2);
ListBox1.Items.Add(" vector: v = " + (v));
ListBox1.Items.Add("m1 + m2 = " + (m1 + m2));
ListBox1.Items.Add("m1 - m2 = " + (m1 - m2));
ListBox1.Items.Add("m1 * m2 = " + (m1 * m2));
ListBox1.Items.Add("m2 * m1 = " + (m2 * m1));
ListBox1.Items.Add("m1 * v = " + MatrixR.Transform(m1, v));
ListBox1.Items.Add("v * m1 = " + MatrixR.Transform(v, m2));
ListBox1.Items.Add("Inverse of m1 = " + MatrixR.Inverse(m1));
ListBox1.Items.Add("Inverse of m2 = " + MatrixR.Inverse(m2));
ListBox1.Items.Add("Determinant of m1 = " + MatrixR.Determinant(m1));
ListBox1.Items.Add("Determinant of m2 = " + MatrixR.Determinant(m2));
}

As a sample we provide the input data points using double arrays for matrix m1, matrix m2 and vector v. Results of the various mathematical operators are shown on the screen above.

The user can manipulate matrix m1 and vector v values and try variations on the arrays themselves by specifying new matrix and vector values.

 Other Implementations...

 Object-Oriented Implementation Graphics and Animation Sample Applications Ore Extraction Optimization Vectors and Matrices Complex Numbers and Functions Ordinary Differential Equations - Euler Method Ordinary Differential Equations 2nd-Order Runge-Kutta Ordinary Differential Equations 4th-Order Runge-Kutta Higher Order Differential Equations Nonlinear Systems Numerical Integration Numerical Differentiation Function Evaluation

 You are viewing this tab ↓

Math, Analysis & More,
established expertise..."

EIGENVALUE SOLUTIONS...
Eigen Inverse Iteration
Rayleigh-Quotient Method

INTERPOLATION APPLICATIONS...
Cubic Spline Method
Newton Divided Difference

 Applied Mathematical Algorithms
 Complex Functions A complex number z = x + iy, where... Complex Functions Non-Linear Systems Non-linear system methods... Non Linear Systems Differentiation Construction of differentiation... Differentiation Integration Consider the function where... Integration