Mth3007 Lecture 2

How Do We Program a Systems of Equations Solver?

For this program we don’t want to rely on any dependencies, as the idea is to do everything from first principles. So, we’ll jump straight into the function!

Python
Output

This is fairly readable and follows the logic we’ve learned, but just to verify I also made a matrix vector multiplication function…

Python
Output

However, we run into the issue of floating point accuracy when comparing answers! So for this I made a tolerant vector comparison function:

Python
Output

With this we’re done! All that’s left is to test:

Python
Output

All good :)