# Exercise 0

Let's perform a row reduction operation by hand. 

Suppose we have the intermediate matrix:

\begin{equation}
A = \begin{bmatrix} \hphantom{-}2 & \hphantom{-}3 & -4 & \hphantom{-}2 \\ \hphantom{-}0 & \hphantom{-}1 & -2 & \hphantom{-}1 \\ \hphantom{-}0 & -1 & \hphantom{-}5 & -2 \\ \hphantom{-}0 & \hphantom{-}2 & \hphantom{-}2 & \hphantom{-}2 \end{bmatrix}
\end{equation}

Perform the next row reduction operation yourself.

# Exercise 1

Thinking about what you did above, write a specification for a function that performs row reduction.

- *what should be the inputs?*
- *what should be the outputs?*
- *are there preconditions?*


```python
""" *short description*

    Parameters
    ----------
    
    Returns
    -------
    
    Notes
    -----

"""
```

### extension

Based on your specification above, write a template Python function for `row_reduction`, i.e., the function header, inputs and return BUT NOT the actual code.


```python
def *your code here*
    return *your code here*
```

# Exercise 2

Write a unit test for your (yet to be written) function `row_reduction`. Ensure that:

- *the unit test has no inputs*
- *the unit test function has test_ prepended to the name of the function for testing*
- *the unit test raises as assertion error if row-reduction is not performing as expected*


```python
def *your code here*
    # test input
    A = np.array([
        [2, 3, -4, 2],
        [0, 1, -2, 1],
        [0, -1, 5, -2],
        [0, 2, 2, 2],])
    assert
```


```python
# hint: recall that in the lab last week, you used the norm function to compare to matrices
from numpy.linalg import norm
#norm(A-B)
```

fd7e7d6536937e758764d623023942296011a560
ipynb
Jupyter Notebook
quality_control/qclec.ipynb
ddempsey/ENGSCI233_2020
0fabddaf118999a06fef36ee4cd80074b9a5f0fa
MIT
2022-02-09T02:17:00.000Z
2022-02-09T02:17:00.000Z
quality_control/qclec.ipynb
ddempsey/ENGSCI233_2020
0fabddaf118999a06fef36ee4cd80074b9a5f0fa
MIT
quality_control/qclec.ipynb
ddempsey/ENGSCI233_2020
0fabddaf118999a06fef36ee4cd80074b9a5f0fa
MIT
2020-11-25T22:25:33.000Z
2021-02-26T03:06:03.000Z
Qwen/Qwen-72B
1. YES
2. YES