### Search

### Blogroll

### Web

### Subscribe via reader

### Subscribe via email

### Blog Stats

- 712,399 hits

### Top Posts

- How do I display the data of an array in MATLAB?
- How do I do polynomial interpolation in MATLAB
- MATLAB code for bubble sort
- Finding the length of curve using MATLAB
- How do I differentiate in MATLAB?
- LU Decomposition takes more computational time than Gaussian Elimination! What gives?
- Largest integer that can be represented in a n-bit integer word
- How do I do spline interpolation in MATLAB?
- How do I integrate a discrete function in MATLAB?
- Time of death - a classic ODE problem

### Pages

- abuses of regression audiovisual lectures automatic integrator bubble sort buckling central divided difference champagne glass chess chopping coefficient of determination cofactor college football computational time convection coefficient experiment decimal to binary conversion derivatives determinant diagonal matrix Differentiation error excel Experiments for Numerical Methods extrapolation fixed point register floating point FLOPS Forensic Science height of atmosphere higher order interpolation improper integral Integration Interpolation Introduction to Numerical Methods inverse error function Inverse of a Matrix inverse of matrix least squares regression length of curves linear regression loops lotto LU Decomposition machine epsilon matlab MATLAB solve Matrix Algebra MOOC nonlinear equation nonlinear equations numerical integration Numerical Methods open courseware optimum polynomial ordinary differential equation Ordinary Differential Equations patriot missile programming quadratic spline Regression Round off error runge runge-kutta 2nd order method significant digits simpson's 1/3 rule Simultaneous Linear Equations spline interpolation Taylor Series taylors theorem Time of Death Trapezoidal rule true error truncation error unique line unique polynomial video lectures of numerical methods
### Numerical Methods Guy

- Join me and sign the petition to help End #SurpriseMedBills! d.shpg.org/153589971t 1 day ago
- Why multiply next independent particular solution form by a power of the independent variable when solving an… autarkaw.wordpress.com/2015/10/05/why… 3 days ago
- Good advice for students writing emails to professor bit.ly/1VAK8hm 3 days ago
- While top schools don't accept AP courses for credit, pushing competency based education is questioned bit.ly/1hldIKd 3 days ago
- Their gall - mixing free form and guided instruction in Finland!!! theatlantic.com/education/arch… 3 days ago

# Category Archives: Simultaneous Linear Equations

## Computational Time to Find Determinant Using Gaussian Elimination

The time it would take to find the determinant of a matrix using the Gaussian Elimination is many-many orders less than when the cofactor method is used. In this blog, we derive the formula for a typical amount of computational time it would take to find the determinant of a nxn matrix using the forward elimination part of the Naive Gauss Elimination method. The time is compared with that using the cofactor method.

This post is brought to you by Holistic Numerical Methods: Numerical Methods for the STEM undergraduate at http://numericalmethods.eng.usf.edu, the textbook on Numerical Methods with Applications available from the lulu storefront, the textbook on Introduction to Programming Concepts Using MATLAB, and the YouTube video lectures available at http://numericalmethods.eng.usf.edu/videos. Subscribe to the blog via a reader or email to stay updated with this blog. Let the information follow you.

## Computational Time to Find Determinant Using CoFactor Method

The time it would take to find the determinant of a matrix using the cofactor method can be daunting. A student may not realize this as they may be limited to finding determinants of matrices of order 4×4 or less by hand. In this blog, we derive the formula for a typical amount of computational time it would take to find the determinant of a nxn matrix using the cofactor method.

This post is brought to you by Holistic Numerical Methods: Numerical Methods for the STEM undergraduate at http://numericalmethods.eng.usf.edu, the textbook on Numerical Methods with Applications available from the lulu storefront, the textbook on Introduction to Programming Concepts Using MATLAB, and the YouTube video lectures available at http://numericalmethods.eng.usf.edu/videos. Subscribe to the blog via a reader or email to stay updated with this blog. Let the information follow you.

Posted in Numerical Methods, Simultaneous Linear Equations

Tagged cofactor, computational time, determinant

## Computational Time for Forward Substitution

In the previous blog, we found the computatational time for back substitution. This is a blog that will show you how we can find the approximate time it takes to conduct forward substitution, while solving simultaneous linear equations. The blog assumes a AMD-K7 2.0GHz chip that uses 4 clock cycles for addition, subtraction and multiplication, while 16 clock cycles for division. Note that we are making reasonable approximations in this blog. Our main motto is to see what the computational time is proportional to – does the computational time double or quadruple if the number of equations is doubled.

The pdf file of the solution is also available.

This post is brought to you by

- Holistic Numerical Methods: Numerical Methods for the STEM undergraduate at http://numericalmethods.eng.usf.edu,
- the textbook on Numerical Methods with Applications available from the lulu storefront,
- the textbook on Introduction to Programming Concepts Using MATLAB, and
- the YouTube video lectures available at http://numericalmethods.eng.usf.edu/videos

Subscribe to the blog via a reader or email to stay updated with this blog. Let the information follow you.

## Computational Time for Back Substitution

This is a blog that will show you how we can find the approximate time it takes to conduct back substitution, while solving simultaneous linear equations using Gaussian elimination method. The blog assumes a AMD-K7 2.0GHz chip that uses 4 clock cycles for addition, subtraction and multiplication, and 16 clock cycles for division. Note that we are making reasonable approximations in this blog. Our main motto is to find how the computational time is related to the number of equations.

The pdf file of the solution is also available.

This post is brought to you by

- Holistic Numerical Methods: Numerical Methods for the STEM undergraduate at http://numericalmethods.eng.usf.edu,
- the textbook on Numerical Methods with Applications available from the lulu storefront,
- the textbook on Introduction to Programming Concepts Using MATLAB, and
- the YouTube video lectures available at http://numericalmethods.eng.usf.edu/videos

Subscribe to the blog via a reader or email to stay updated with this blog. Let the information follow you.

## How do I solve simultaneous linear equations given in equation form?

Many students ask me how do I do this or that in MATLAB. So I thought why not have a small series of my next few blogs do that. In this blog, I show you how to solve simultaneous linear equations given in equation form.

- The MATLAB program link is here.
- The HTML version of the MATLAB program is here.
**DO NOT COPY AND PASTE THE PROGRAM BELOW BECAUSE THE SINGLE QUOTES DO NOT TRANSLATE TO THE CORRECT SINGLE QUOTES IN MATLAB EDITOR.****DOWNLOAD THE MATLAB PROGRAM****INSTEAD**

%% HOW DO I DO THAT IN MATLAB SERIES?

% In this series, I am answering questions that students have asked

% me about MATLAB. Most of the questions relate to a mathematical

% procedure.

%% TOPIC

% How do I solve a set of simultaneous linear equations

% given in equation form?

%% SUMMARY

% Language : Matlab 2008a;

% Authors : Autar Kaw;

% Mfile available at

% http://numericalmethods.eng.usf.edu/blog/sle_equations.m;

% Last Revised : August 22, 2009;

% Abstract: This program shows you how to solve a set of

% simultaneous linear equations given in equation form?

% .

clc

clear all

clf

%% INTRODUCTION

disp(‘ABSTRACT’)

disp(‘ This program shows you how to solve a’)

disp(‘ set of simultaneous linear equations given in equation form’)

disp(‘ ‘)

disp(‘AUTHOR’)

disp(‘ Autar K Kaw of https://autarkaw.wordpress.com’)

disp(‘ ‘)

disp(‘MFILE SOURCE’)

disp(‘ http://numericalmethods.eng.usf.edu/blog/sle_equations.m’)

disp(‘ ‘)

disp(‘LAST REVISED’)

disp(‘ August 22, 2009’)

disp(‘ ‘)

%% INPUTS

% Enter the equations

eqn1=’12*a+23*b+39*c=29′;

eqn2=’13*a+17*b+19*c=37′;

eqn3=’21*a+23*b+29*c=59’;

%% DISPLAYING INPUTS

disp(‘ ‘)

disp(‘INPUTS’)

disp(‘________________________’)

disp(‘Equations’)

disp(‘________________________’)

disp(eqn1)

disp(eqn2)

disp(eqn3)

%% THE CODE

% The solution

X=solve(eqn1,eqn2,eqn3);

% Assigning the output

a=double(X.a);

b=double(X.b);

c=double(X.c);

%% DISPLAYING OUTPUTS

disp(‘ ‘)

disp(‘OUTPUTS’)

disp(‘________________________’)

disp(‘Solution Vector’)

disp(‘________________________’)

fprintf(‘\nValue of a= %g’,a)

fprintf(‘\nValue of b= %g’,b)

fprintf(‘\nValue of c= %g’,c)

disp(‘ ‘)

disp(‘________________________’)

This post is brought to you by Holistic Numerical Methods: Numerical Methods for the STEM undergraduate at http://numericalmethods.eng.usf.edu, the textbook on Numerical Methods with Applications available from the lulu storefront, and the YouTube video lectures available at http://numericalmethods.eng.usf.edu/videos and http://www.youtube.com/numericalmethodsguy

Subscribe to the blog via a reader or email to stay updated with this blog. Let the information follow you.

## How do I solve a set of simultaneous linear equations given in matrix form?

Many students ask me how do I do this or that in MATLAB. So I thought why not have a small series of my next few blogs do that. In this blog, I show you how to solve simultaneous linear equations given in matrix form.

- The MATLAB program link is here.
- The HTML version of the MATLAB program is here.
**DO NOT COPY AND PASTE THE PROGRAM BELOW BECAUSE THE SINGLE QUOTES DO NOT TRANSLATE TO THE CORRECT SINGLE QUOTES IN MATLAB EDITOR.****DOWNLOAD THE MATLAB PROGRAM****INSTEAD**

%% HOW DO I DO THAT IN MATLAB SERIES?

% In this series, I am answering questions that students have asked

% me about MATLAB. Most of the questions relate to a mathematical

% procedure.

%% TOPIC

% How do I solve a set of simultaneous linear equations?

%% SUMMARY

% Language : Matlab 2008a;

% Authors : Autar Kaw;

% Mfile available at

% http://numericalmethods.eng.usf.edu/blog/sle.m;

% Last Revised : August 12, 2009;

% Abstract: This program shows you how to solve a set of simultaneous linear

% equations?

% .

clc

clear all

clf

%% INTRODUCTION

disp(‘ABSTRACT’)

disp(‘ This program shows you how to solve a’)

disp(‘ set of simultaneous linear equations’)

disp(‘ ‘)

disp(‘AUTHOR’)

disp(‘ Autar K Kaw of https://autarkaw.wordpress.com’)

disp(‘ ‘)

disp(‘MFILE SOURCE’)

disp(‘ http://numericalmethods.eng.usf.edu/blog/sle.m’)

disp(‘ ‘)

disp(‘LAST REVISED’)

disp(‘ August 12, 2009’)

disp(‘ ‘)

%% INPUTS

% Enter the coefficient matrix of the equation [A][X]=[C]

A=[12 23 39; 13 17 19; 21 23 29];

% Enter the right hand side vector

C=[29; 37; 59];

%% DISPLAYING INPUTS

disp(‘ ‘)

disp(‘INPUTS’)

disp(‘________________________’)

disp(‘Coefficient Matrix’)

disp(‘________________________’)

dataval=[A];

disp(dataval)

disp(‘________________________’)

disp(‘Right hand side vector’)

disp(‘________________________’)

dataval=[C];

disp(dataval)

disp(‘________________________’)

%% THE CODE

% The solution

X=A\C;

%% DISPLAYING OUTPUTS

disp(‘ ‘)

disp(‘OUTPUTS’)

disp(‘________________________’)

disp(‘Solution Vector’)

disp(‘________________________’)

dataval=[X];

disp(dataval)

disp(‘________________________’)

his post is brought to you by Holistic Numerical Methods: Numerical Methods for the STEM undergraduate at http://numericalmethods.eng.usf.edu, the textbook on Numerical Methods with Applications available from the lulu storefront, and the YouTube video lectures available at http://numericalmethods.eng.usf.edu/videos and http://www.youtube.com/numericalmethodsguy

## So what does this mean that the computational time is proportional to some power of n in Gaussian Elimination method?

In a previous post, we talked about why LU Decomposition is computationally more efficient than Gaussian Elimination in some cases. The argument was based on how much computational time does each of the methods take. For example, we said that for back substitution in both methods, the computational time is approximately proportional to .

**How did we find that for back substitution the computational time is approximately proportional to ****?**

The amount of time it takes to conduct back substitution depends on the number of floating point operations (FLOPs) needed. Depending on how many FLOPs the computer can execute in a second called FLOPS (*note the upper case S to distinguish between FLOPs and FLOPS*), that will the determine the actual computational time. (A typical Pentium 4 PC conducts to the order of FLOPS; a state-of-art supercomputer conducts to the order of FLOPS; in 1983 the PC with a 8087 chip may have conducted to the order of FLOPS).

To keep things simple, let’s only count the multiplication/division FLOPs in back substitution as time used by multiplication and division is higher than addition and subtraction (*Multiplication may take twice and division as much as thrice the time it takes for addition and subtraction*).

In back substitution, we start with the last equation. The last equation involves one division, second last equation involves one multiplication and one division, the third last equation involves two multiplications and one division, and so on. So the number of multiplication/divisions FLOPs is 1 for last equation, 2 for second last equation, 3 for third last equation, that is, for all equations, . For large n, this number is approximately .

This post brought to you by Holistic Numerical Methods: Numerical Methods for the STEM undergraduate at http://numericalmethods.eng.usf.edu