<SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
 Computing for Mathematics - Mock individual coursework
This jupyter notebook contains questions that will resemble the questions in your individual coursework.
Important Do not delete the cells containing
Step1:  b. \((2 ^ {\frac{1}{2}} + 2) ^ 2 - 2 ^ {\frac{5}{2}}\)
Step2:  \((\frac{1}{8}) ^ {\frac{4}{3}}\)
Step3:  Question 2
Write a function expand that takes a given mathematical expression and returns the expanded expression.
Step4:  Question 3
The matrix \(D\) is given by \(D = \begin{pmatrix} 1& 2 & a\ 3 & 1 & 0\ 1 & 1 & 1\end{pmatrix}\) where \(a\ne 2\).
a. Create a variable D which has value the matrix \(D\).
Step5:  b. Create a variable D_inv with value the inverse of \(D\).
Step6:  c. Using D_inv output the solution of the following system of equations
Step8:  Question 4
During a game of frisbee between a handler and their dog the handler chooses to randomly select if they throw using a backhand or a forehand
Step9:  b. Using 1,000,000 samples create a variable probability_of_catch which has value an estimate for the probability of the frisbee being caught.
Step10:  c. Using the above, create a variable probability_of_forehand_given_drop which has value an estimate for the probability of the frisbee being thrown with a forehand given that it was not caught.
<ASSISTANT_TASK:>
Python Code:
### BEGIN SOLUTION
### END SOLUTION
Explanation: Computing for Mathematics - Mock individual coursework
This jupyter notebook contains questions that will resemble the questions in your individual coursework.
Important Do not delete the cells containing: 
```
BEGIN SOLUTION
END SOLUTION
```
write your solution attempts in those cells.
If you would like to submit this notebook:
Change the name of the notebook from main to: &lt;student_number&gt;. For example, if your student number is c1234567 then change the name of the notebook to c1234567.
Write all your solution attempts in the correct locations;
Save the notebook (File&gt;Save As);
Follow the instructions given in class/email to submit.
Question 1
Output the evaluation of the following expressions exactly.
a. \(\frac{(9a^2bc^4) ^ {\frac{1}{2}}}{6ab^{\frac{3}{2}}c}\)
End of explanation
### BEGIN SOLUTION
### END SOLUTION
Explanation: b. \((2 ^ {\frac{1}{2}} + 2) ^ 2 - 2 ^ {\frac{5}{2}}\)
End of explanation
### BEGIN SOLUTION
### END SOLUTION
Explanation: \((\frac{1}{8}) ^ {\frac{4}{3}}\)
End of explanation
def expand(expression):
    ### BEGIN SOLUTION
### END SOLUTION
Explanation: Question 2
Write a function expand that takes a given mathematical expression and returns the expanded expression.
End of explanation
### BEGIN SOLUTION
### END SOLUTION
Explanation: Question 3
The matrix \(D\) is given by \(D = \begin{pmatrix} 1& 2 & a\ 3 & 1 & 0\ 1 & 1 & 1\end{pmatrix}\) where \(a\ne 2\).
a. Create a variable D which has value the matrix \(D\).
End of explanation
### BEGIN SOLUTION
### END SOLUTION
Explanation: b. Create a variable D_inv with value the inverse of \(D\).
End of explanation
### BEGIN SOLUTION
### END SOLUTION
Explanation: c. Using D_inv output the solution of the following system of equations:
\[
\begin{array}{r}
    x + 2y + 4z = 3\
    3x + y = 4\
    x + y + z = 1\
\end{array}
\]
End of explanation
import random
def sample_experiment():
    
    Returns the throw type and whether it was caught
    
    ### BEGIN SOLUTION
### END SOLUTION
    return throw, caught
Explanation: Question 4
During a game of frisbee between a handler and their dog the handler chooses to randomly select if they throw using a backhand or a forehand: 25% of the time they will throw a backhand.
Because of the way their dog chooses to approach a flying frisbee they catch it with the following probabilities:
80% of the time when it is thrown using a backhand
90% of the time when it is thrown using a forehand
a. Write a function sample_experiment() that simulates a given throw and returns the throw type (as a string with value "backhand" or "forehand") and whether it was caught (as a boolean: either True or False).
End of explanation
### BEGIN SOLUTION
### END SOLUTION
Explanation: b. Using 1,000,000 samples create a variable probability_of_catch which has value an estimate for the probability of the frisbee being caught.
End of explanation
### BEGIN SOLUTION
### END SOLUTION
Explanation: c. Using the above, create a variable probability_of_forehand_given_drop which has value an estimate for the probability of the frisbee being thrown with a forehand given that it was not caught.
End of explanation
<END_TASK>