Skip to content
This repository has been archived by the owner on Jul 19, 2024. It is now read-only.

Latest commit

 

History

History
88 lines (66 loc) · 4.79 KB

README.md

File metadata and controls

88 lines (66 loc) · 4.79 KB

Dev notes

Can i make this better? yes.
will i do it? nahhh...

Diagonalisation Of Matrix

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.

Try It!

Live on Github Pages here.
Or download Source code directly form here.

License

License: MIT

This project is licensed under The MIT License.

How it Works?

Steps involved in DM

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.

1. Matrix Visibility Functions:

  • three() and two() 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.

2. Matrix Calculation Functions:

2.1 calculate2() Function (for 2x2 matrices):

  • 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.

2.2 calculate3() Function (for 3x3 matrices):

  • 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.

3. Webpage Interaction:

  • The visibility functions (three() and two()) 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.

4. Console Logging:

  • There are numerous console.log statements for debugging purposes, helping developers understand the intermediate values and steps in the calculations.

5. Matrix Operations:

  • The code involves operations such as finding determinants, eigenvalues, eigenvectors, matrix transposition, matrix types (symmetric or skew-symmetric), and diagonalization.

6. External Library:

  • 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.

References and Credits:

  • 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

Last Updated

This README was last updated on Jul 7, 2024.