Question
PYTHON Programming Assignment by following Written Algorithm Step-by-Step Topic: Gaus-Jordan Elimination Written Algorithm (Please follow step-by-step in the code, write comments explaining): - Given an
PYTHON Programming Assignment by following Written Algorithm Step-by-Step
Topic: Gaus-Jordan Elimination
Written Algorithm (Please follow step-by-step in the code, write comments explaining):
- Given an nn matrix A, and a n1 vector b, solve for solution vector x where Ax = b
- Create augmented matrix C = [A | b]
- Set E = 1 (this is a parameter to check if the algorithm successfully found a unique solution)
- for j = 1 to n: (iterate through columns of matrix)
---- Find largest magnitude value in columnj only looking at rowj and below. This is the pivot (p).
---- if = 0: set E = 0, exit
---- if p > j: flip rows p and j
---- Divide rowj by pivot value. This is the value at Cj,j . Before row swapping it was at Cp, j.
---- for all remaining rows, i/=j: rowi = rowi - Ci,j rowj
- if E == 1: a unique solution to the system of equations was found.
- else: the algorithm failed to find a unique solution
At the beginning, there should be a variable for the matrix. Test your code by trying different matrices. When finalizing, however, set the following values:
x + 2z = 1
2x + -y + 3z = -1
4x + y + 8z = 2
Provide screenshots of your code if you can. I will upvote if your solution helps me. Thank you! :)
Cp,j=maxi=jn{Ci,j} Cp,j
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started