9.1: Sympy RREF function
- Page ID
- 64301
In class we talked about the Python sympy
library which has a “reduced row echelon form” (rref) function that runs a much more efficient version of the Gauss-Jordan function. To use the rref
function you must first convert your matrix into a sympy.Matrix
and then run the function. For example, lets do this for the following matrix \(B\):
This function outputs two values (a matrix and a tuple). For the purposes of this class we only care about the matrix. I generally use the following syntax when using rref()
Although we do not use it often in this course, what does the second output of the rref
mean (i.e. what does (0,1)
mean?
hint: read the documentation for rref
.
How lets consider the multi-week example from a previous assignment, where:
Week 1:
\(c + b = 30\)
\(20c + 25b = 690\)
Week 2:
\(c + b = 35\)
\(20c + 25b = 750\)
Week 3:
\(c + b = 30\)
\(20c + 25b = 650\)
Write a \(2 \times 5\) augmented matrix representing the 6 equations above. (you can just copy and paste this from the pre-class if you got it right there), Name your Matrix \(G\) to verify your answer using the checkanswer
function below.
The following function will apply the rref function to the matrix \(G\) and store it in a variable called, wait for it, rref
:
Given the above, How many hours did Giselle work as a capenter for the three weeks and how many hours did she work as a blacksmith. Fill in your answers below to check if you are correct: