Posts

Showing posts from June, 2017

mathajax

Matrix Determinant by Diagonal Matrix

Image
A matrix diagonal transformation method is preferred over minor or cofactor of matrix method while finding determinant of the matrix's size over 3x3. The matrix A is converted into Diagonal matrix D by elementary row operation or reduction and then product of main diagonal elements is called determinant of the matrix A. Read matrix A Convert matrix A into diagonal matrix D by applying Row operation or reduction technique Read Main Diagonal elements from D Determinant = product of Main Diagonal elements Algorithm steps for Determinant by Diagonal matrix Read matrix A a - element of the matrix A i,j - position of a element in the matrix for i=1 To N for j=1 To N if i not-equal j RowOperation .add(j,i ,-a ii /a ji ) end end end Determinant = a 11 x a 22 x ... x a nn Java program for a matrix Determinant by Diagonal matrix public class Determinant { Matrix mat; publ

Matrix Determinant by Lower Triangular Matrix

Image
Determinant, a properties of matrix determines the matrix is singular or not. Lower Triangular matrix transformation method is preferred over minor or cofactor of matrix method while finding determinant of the matrix's size over 3x3. The matrix A is converted into Lower triangular matrix, L by elementary row operation or reduction and then product of main diagonal elements is called determinant of the matrix A. Read matrix A Convert matrix A into L by applying Row operation or reduction technique Read Main Diagonal elements from L Determinant = product of Main Diagonal elements Algorithm steps for Determinant by Lower Triangular Matrix Read matrix A a - elements of matrix A i,j - position of a element in the matrix for i=N-1 To 1 decrement by -1 for j=i-1 To 1 decrement by -1 RowOperation.add(j,i ,-a ii /a ji ) end end Determinant = a 11 x a 22 x ... x a nn Java progr

Matrix Determinant by Upper Triangular Matrix

Image
Determinant, a properties of matrix determines the matrix is singular or not. Upper triangular method is preferred over minor or cofactor of matrix method while finding determinant of the matrix's size over 3x3. The matrix A is converted into upper triangular matrix U by elementary row operation and then multiplication of main diagonal elements is called determinant of the matrix A. Read matrix A Convert matrix A into U by applying Row operation Read Main Diagonal elements from U Determinant = product of Main Diagonal elements Algorithm steps for Determinant by Upper Triangular Matrix Read matrix A a - element of the matrix A i,j - position of a element in the matrix for i=1 To N for j=i+1 To N RowOperation.add (j,i ,-a ii /a ji ) end end Determinant = a 11 x a 22 x ... x a nn Java program for Determinant by Upper Triangular Matrix

Solving System of Linear Equations by Gauss Jordan Elimination

Image
It finds a solution vector X for solving a system of linear equations which has NxN elements using Gauss-Jordan elimination method. Gauss-Jordan elimination method matrix A has N x N elements I, Identity matrix has N x N elements b is a vector has Nx1 system of non-homogeneous elements A|b is a augmented matrix result X, is a solution vector has Nx1 elements Elementary row operation is applied to augmented matrix, until it transforms A|b into I|X Algorithm Steps for solving system of linear equations by Gauss-Jordan Elimination Read Matrix A Read vector b form Augmented matrix A|b For i=1 To N For j=1 To N IF i not-equal j apply RowOperation.add(j,i ,-a ii /a ji ) on augmented matrix A|I End End End Divide each i th row of non-zero elements in A|b by a ii Java programming code- Gauss Jordan solving Linear equations im

Inverse Matrix by Gauss Jordan Elimination

Image
It finds N x N inverse matrix for a matrix which has NxN elements by Gauss-Jordan elimination method. Gauss-Jordan elimination method A, matrix has N x N elements I, Identity matrix has N x N elements A|I is a augmented matrix Elementary row operation is applied to augmented matrix A|I and it transforms A|I into I|A -1 . Algorithm Steps for Inverse matrix by Gauss-Jordan Elimination Read Matrix A form Augmented matrix, A|I For i=1 To N For j=1 To N IF i not-equal j apply RowOperation.add(j,i ,-a ii /a ji ) on augmented matrix A|I End End End divide each row of A|I by main diagonal elements, a ii Gauss Jordan Inverse - Java programming code public class Gaussjordan { Matrix mat ; public Gaussjordan( double A[][]) { int row=A.length; int col=A[0].length; mat = new Matrix (row,

Programming Keyword Coloring

Image
To improve presentation of programming code in a post, The keywords of it is coloured by inclusion of css (casecade style sheet) by manually or automatic with help of a tool. we have coded a simple Java program to carry out colouring Java-keywords using Java regular expression. Colouring keywords - step by step explanation The following five steps are used to finish colouring keywords Keywords Collection Read Content - Source File Replace Html special character Include style sheet Write Content - Destination File Read Content - Source File The source file, programming code is read as a string object (content) by FileReader object. Replace Html special character The source content has html special characters ( < , >, & and etc. ) is to be replaced by the respe