Code for Chapter 4: Solving Ax = b