Code Monkey home page Code Monkey logo

gaussian-elimination-with-partial-pivoting's Introduction

You should compile the cpp file with writing into terminal "g++ ozgur-kara-main.cpp -o main.exe". It makes an exe file of the cpp. Then you can run this exe file, command line arguments are "main.exe input_A_filename.txt input_b_filename.txt" and output will be "X.txt" (you should write in this form to terminal)

This program is basically read the A matrix and b vector from files whose names are given. Then solves Ax=b system using "gaussian elimination with partial pivotting". It means that, while making forward substitution, the program must use the pivot as the value which is the absolute maximum of this column.

When reading A matrix from input_A_filename.txt , I dynamically create A matrix. (I reallocate the matrix's size when new row has appeared)

If given matrix is 2x2 matrix, then it prints out the condition number of (one and infinity which are the same actually) this matrix.

If given matrix is singular matrix, then the output will be writing "singular matrix" in "X.txt" file.

If we look on that problem in procedure: A b1 b2 1.000 1.000 2.000 2.000 1.000 1.001 2.000 2.001

I have solved this equation and the outputs x1 and x2 like this:

x1 x2 2 1 0 1

It is clear that x vector has extremely changed (2,0 to 1,1) because the condition number is very large (4004) so it's nearly singular matrix. so when b vector changes a little bit, x vector will change a large value.

gaussian-elimination-with-partial-pivoting's People

Contributors

ozgurkara99 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

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