Question: Implement a set of functions in python to analyze and solve linear systems. Before starting, read the document on Piazza Linear Algebra in Python. Solving
Implement a set of functions in python to analyze and solve linear systems. Before starting, read the
document on Piazza Linear Algebra in Python.
Solving a linear system using Gaussian Elimination requires implementing three functions:
a forward elmination Stage
b testing for consistency
c backsubstitution Stage
I have written the code for forward elimination. Your job is to provide the rest of the code and use the resulting
set of functions to analyze some linear systems. In case it helps, the code you have to write is quite a bit
shorter than the code I have already supplied!
In hwGECode.py I have provided the function:
forwardEliminationB
which takes a matrix numpy array B and returns a new matrix that is the row echelon form of B There are also
helper functions in that file, for doing things like swapping rows of a matrix, doing row reduction, etc.
You need two write two functions:
inconsistentSystemB
which takes a matrix B in echelon form, and returns True if it represents an inconsistent system, and False
otherwise; and
backsubstitutionB
which returns the reduced row echelon form matrix of B
Using these, you should be able to analyze a matrix representing a linear system as follows:
AEchelon forwardEliminationA
if inconsistentSystemAEchelon:
AReducedEchelon backsubstitutionAEchelon
and then by inspecting AReducedEchelon you should be able to write down the solution set for the linear
system.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
