Can i make this better? yes.
will i do it? nahhh...
Diagonalisation of a matrix is the process of reduction of a matrix to diagonal form. The process of reduction of a matrix to diagonal form is as follows: A square matrix of order n with n linearly independent eigen vectors can be diagonalised by a similarity transformations D = (B-)AB where B is the modal matrix whose columns are the eigen vecors of the matrix and (B-) is the inverse of B.
Live on Github Pages here.
Or download Source code directly form here.
This project is licensed under The MIT License.
Note: The diagonalised form of a symmetric matrix (D) can also be obtained using the formula used for skew-symmetric matrix i.e. [(B-)AB]. Therefore, using a normalised matrix may not always be necessary.
three()
andtwo()
functions control the visibility of matrix elements on a webpage.- For a 3x3 matrix, it makes the elements visible and hides the elements of a 2x2 matrix, and vice versa.
- Reads input values from HTML input elements representing a 2x2 matrix.
- Calculates the determinant of the matrix (
twdet
variable). - Computes eigenvalues and eigenvectors using the
math.eigs()
function. - Determines if the matrix is symmetric or skew-symmetric.
- Calculates the inverse of the eigenvectors and diagonalizes the matrix.
- Displays the results in the console and updates the webpage with the results.
- Similar to
calculate2()
, but for 3x3 matrices. - Reads input values from HTML input elements representing a 3x3 matrix.
- Calculates the determinant, eigenvalues, and eigenvectors.
- Determines if the matrix is symmetric or skew-symmetric.
- Calculates the inverse of the eigenvectors and diagonalizes the matrix.
- Displays the results in the console and updates the webpage with the results.
- The visibility functions (
three()
andtwo()
) manipulate the visibility of matrix elements on the webpage. - The calculated results are displayed in an output box on the webpage, particularly in an HTML element with the ID
textarea
.
- There are numerous
console.log
statements for debugging purposes, helping developers understand the intermediate values and steps in the calculations.
- The code involves operations such as finding determinants, eigenvalues, eigenvectors, matrix transposition, matrix types (symmetric or skew-symmetric), and diagonalization.
- The code relies on an external library named
math
(math.js) for mathematical
In summary, this code enables users to input 2x2 or 3x3 matrices on a webpage, performs various linear algebra operations on them, and displays the results interactively.
- Understanding of diagonalization of matix in linear algebra Chapter 13 by Weijie Chen.
- Idea and some parts of code for Matrix Selection is from ElenaChes's "JavaScript-HTML-Matrix-Calculator". Check out his/her's project on matrix determinant (solution) calculator.
- Website design inspo and some styles form John doe. Here's his toutrial and the website preview.
- Idea of using Textbox(textarea) as a output display in html is from LuisBoto's poject "JSMatrixCalculator".
Math js
An extensive math library for JavaScript and Node.js. you can find it here!.
math.round()
math.eigs() //for Eigen values and Eigen vectors
math.transpose() //to find the transpose of matrix
math.det() //to find the determinant of matrix
math.inv() //to find the inverse of matrix
math.multiply() //to multiply matrices
This README was last updated on Jul 7, 2024.