## Lab 7, CSC430, Spring 2022

### 1` `Developing Functions

In the exercises below, any instruction to "develop a function" implies the following steps:

Deciding what kind of data the function will accept,

Writing the first line of the function including the function name and parameter names,

Adding a docstring that indicates the purpose of the function,

Writing test cases for the function using assert (except when indicated below), and finally

Writing the body of the function.

### 2` `SymPy + NumPy

Consider the following set of linear equations:

3x + y - z = 9 x + 2y + z = 4 4x - 7y + 0z = 1

First, develop three functions, eq1, eq2, and eq3 that represent the three equations above. Specifically, they should accept values for x, y, and z, and return true if the computed left side of the equation is within 10^{-9} of the right side. Then, develop the eq123 function that accepts values for x, y, and z and returns true if all three of the equations are satisfied (use the functions you just developed for this!). You do not need to write a test case for the eq123 function.

Next, use sympy to solve these three sets of equations. Print out the generated solution. Then, write a test case that supplies the given values of x, y, and z to all3 to see whether the given solution actually works.

Finally, use numpy to solve these equations using linalg.solve, as in earlier labs. Check that these solutions are the same.

### 3` `SymPy

For each of the following, use sympy to determine a set of solutions. For each set of solutions, provide at least two examples of solutions when there is more than one possible.

x = 3x + 4y + z 4z^2 = 9x + y

\frac{x^6 + 9y}{z + x} = 44z^8 e^x = 9