<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 - 2020/2021 individual coursework
Important Do not delete the cells containing
Step1:  b. $1/2$
Available marks
Step2:  c. $3/4$
Available marks
Step3:  d. $1$
Available marks
Step4:  Question 2
(Hint
Step5:  b. Create a variable direct_number_of_permutations that gives the number of permutations of pets of size 4 by direct computation.
Available marks
Step6:  Question 3
(Hint
Step7:  b. Create a variable equation that has value the equation $f'(0)=0$.
Available marks
Step8:  c. Using the solution to that equation, output the value of $\int_{0}^{5\pi}f(x)dx$.
Available marks
Step9:  Question 4
(Hint
Step10:  b. Given that $c=2$ output $\frac{df}{dx}$ where
Step11:  c. Given that $c=2$ output $\int f(x)dx$
Available marks
<ASSISTANT_TASK:>
Python Code:
import random
def sample_experiment():
    ### BEGIN SOLUTION
### END SOLUTION
Explanation: Computing for Mathematics - 2020/2021 individual coursework
Important Do not delete the cells containing: 
```
BEGIN SOLUTION
END SOLUTION
```
write your solution attempts in those cells.
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;
Do not delete any code that is already in the cells;
Save the notebook (File&gt;Save As);
Follow the instructions given in class/email to submit.
Question 1
(Hint: This question is similar to the first exercise of the Probability chapter of Python for mathematics.)
For each of the following, write a function sample_experiment, and repeatedly use it to simulate the probability of an event occurring with the following chances.
For each chance output the simulated probability.
a. $0$ 
Available marks: 2
End of explanation
def sample_experiment():
    ### BEGIN SOLUTION
### END SOLUTION
Explanation: b. $1/2$
Available marks: 2
End of explanation
def sample_experiment():
    ### BEGIN SOLUTION
### END SOLUTION
Explanation: c. $3/4$
Available marks: 2
End of explanation
def sample_experiment():
    ### BEGIN SOLUTION
### END SOLUTION
Explanation: d. $1$
Available marks: 2
End of explanation
import itertools
pets = ("cat", "dog", "fish", "lizard", "hamster")
### BEGIN SOLUTION
### END SOLUTION
Explanation: Question 2
(Hint: This question is similar to the second exercise of the Combinatorics chapter of Python for mathematics.)
a. Create a variable number_of_permutations that gives the number of permutations of pets = ("cat", "dog", "fish", "lizard", "hamster) of size 4. Do this by generating and counting them.
Available marks: 2
End of explanation
import scipy.special
### BEGIN SOLUTION
### END SOLUTION
Explanation: b. Create a variable direct_number_of_permutations that gives the number of permutations of pets of size 4 by direct computation.
Available marks: 1
End of explanation
import sympy as sym
x = sym.Symbol("x")
c1 = sym.Symbol("c1")
### BEGIN SOLUTION
### END SOLUTION
Explanation: Question 3
(Hint: This question uses concepts from the Algebra and Calculus chapters of Python for mathematics.)
Consider the second derivative $f''(x)=4 x + \cos(x)$.
a. Create a variable derivative which has value $f'(x)$ (use the variables x and c1 if necessary):
Available marks: 3
End of explanation
### BEGIN SOLUTION
### END SOLUTION
Explanation: b. Create a variable equation that has value the equation $f'(0)=0$.
Available marks: 4
End of explanation
### BEGIN SOLUTION
### END SOLUTION
Explanation: c. Using the solution to that equation, output the value of $\int_{0}^{5\pi}f(x)dx$.
Available marks: 4
End of explanation
c = sym.Symbol("c")
### BEGIN SOLUTION
### END SOLUTION
Explanation: Question 4
(Hint: This question uses concepts from the Calculus and Sequences chapters of Python for mathematics.)
Consider this recursive definition for the sequence $a_n$:
$$
a_n = \begin{cases}
        c & \text{ if n = 1}\
        3a_{n - 1} + \frac{c}{n}
      \end{cases}
$$
a. Output the sum of the 15 terms.
Available marks: 5
End of explanation
### BEGIN SOLUTION
### END SOLUTION
Explanation: b. Given that $c=2$ output $\frac{df}{dx}$ where:
$$
f(x) = a_1 + a_2 x + a_3 x ^ 2 + a_4 x ^ 3
$$
Available marks: 4
End of explanation
### BEGIN SOLUTION
### END SOLUTION
Explanation: c. Given that $c=2$ output $\int f(x)dx$
Available marks: 4
End of explanation
<END_TASK>