Coder Social home page Coder Social logo

linear-equations-solver's Introduction

Linear Equations Solver

Description

This implementation tries to solve given system Ax = b and outputs its unique solution if it exists. Else, it provides the null space of the matrix along with the complete solution. Feel free to open a pull request/issue in case the code doesn't work for a particular case.

Instructions

  • Clone this repository
git clone https://github.com/PrayagS/Linear-Equations-Solver.git
  • Change into the directory
cd Linear-Equations-Solver
  • Execute the script to compile and execute the program
./execute

How it works

  • The main function obtains the input matrix.
  • Gaussian elimination performed on that matrix. Rows are swapped when pivots are not found. If no pivots are found, the program exits there itself with corresponding null space.
  • Then, back substitution is performed (separately for tall and square matrices) and infinite solutions/no solution is detected differently for fat matrices and tall matrices.
  • Now that solutions are calculated, null space calculation starts.
  • Before converting the matrix into RREF (row reduced echelon form), zero rows are moved to the bottom and columns are exchanged such that the matrix can be divided into two submatrices, one being the identity matrix and the other called F such that the original matrix can be represented as [ I F ] (zero rows ignored here).
  • Then, Gaussian elimination is performed again to convert the upper triangular matrix to RREF.
  • After that, matrix F is extracted from the main matrix and null space matrix i.e. the matrix with -F as one submatrix and an identity matrix with the same no. of columns as F appended below it, is formed.
  • Once the null space is calculated, the particular solution is calculated and subsequently, the complete solution is calculated.

linear-equations-solver's People

Contributors

prayags avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.