# Mandatory exercises

1. Consider the ODE
\begin{equation}
    \begin{split}
        y'(t)+1000y(t)=0,\quad 0\leq t\leq2\\
        y(0)=0.5,
    \end{split}
\end{equation}
solved numerically by a numerical method with a step size $h$.

    1. What is the step size restriction by stability if we use the forward Euler method?
    2. What is the step size restriction by stability if we use the backward Euler method? What other factors should we consider when choosing the step size?
    

2. The numerical scheme
\begin{equation}
    \begin{split}
        y_{i+1}=y_i-hky_i,
    \end{split}
\end{equation}
is used to approximate the differential equation $y'(t)=-ky(t)$ with step size $h$. What is the order of accuracy for this approximation? Motivate your answer by the analysis of the local truncation error.

3. Heun’s method can be written as
\begin{equation}
    y_{i+1}=y_i+\frac{h}{2}(f(t_i,y_i)+f(t_{i+1},\tilde{y}_{i+1})),
\end{equation}
where $\tilde{y}_{i+1}=y_i+hf(t_i,y_i)$. Is Heun’s method an explicit method or an implicit method? Is it unconditionally stable? Motivate your answer by the stability analysis of the test equation
\begin{equation}
    \begin{split}
        y'(t) = -\lambda y,\, \mathcal{R}(\lambda)>0\\
        y(0)=y_0.
    \end{split}
\end{equation}

# Non-mandatory exercises

4. The following is a model for how an infectuous disease spreads in a population:
\begin{equation}
    P'=(k+0.1\sin(t))P(C-P).
\end{equation}
Here, $P(t)$ represents the total number of individuals who have had the infection at time $t$ and $C$ is the total number of individuals in the population. The parameter $k$ represents the risk of becoming infected and the sinus function models seasonal variation in susceptibility to infection.

    1. Let $g(t,P)$ denote the right-hand side in the differential equation above. Then, a family of numerical methods for solving the equation can be expressed as:\begin{equation}P_{k+1}=P_k+h(c_1g(t_k,P_k)+c_2g(t_{k+1},P_{k+1})).\end{equation} Each specific choice of values $c_1$ and $c_2$ yields a specific method within this family. For what values of $c_1$ and $c_2$ , respectively, will you get (i) an explicit method; (ii) an implicit method.
    2. What values of $c_1$ and $c_2$, respectively, will yield a consistent method?
    3. There is a limit to the order of accuracy that can be obtained within this family of methods. What is the best order of accuracy and what values of $c_1$ and $c_2$ are required to obtain it?

5. Suppose that you are to solve an ODE problem by means of the Explicit Euler method, and that you choose a step size $h = h_0$ that is too large, so that the approximate solution obtained is not sufficiently accurate compared to the tolerance level you have set for this problem. You should now consider the following alternative strategies to improve the accuracy:
    1. Reduce the step size to $h = ch_0$ , where $0 < c < 1$, so that Explicit Euler will give sufficient accuracy.
    2. Keep the step size $h = h_0$ but change to Heun’s method, assuming that Heun’s method is sufficiently accurate with that step size.
    
Since both alternatives will give a solution within the given tolerance,
you should use the strategy that results in the shortest execution time.
Which alternative will you then choose? (There is no exact answer
to this question, but you could make a rough analysis to find out
approximately how small c would have to be in order for the second
alternative to be preferable.)

f81dfec01e3df4373e4fb8aa41a990558c7a9b9b
ipynb
Jupyter Notebook
Workouts/Workout3.ipynb
enigne/ScientificComputingBridging
920f3c9688ae0e7d17cffce5763289864b9cac80
MIT
2021-05-04T01:15:32.000Z
2021-11-08T15:08:27.000Z
Workouts/Workout3.ipynb
enigne/ScientificComputingBridging
920f3c9688ae0e7d17cffce5763289864b9cac80
MIT
Workouts/Workout3.ipynb
enigne/ScientificComputingBridging
920f3c9688ae0e7d17cffce5763289864b9cac80
MIT
Qwen/Qwen-72B
1. YES
2. YES