Plot a smoothed "hat" function.
The "hat" function \(N(x)\) defined by (3.5) on page 109 has a discontinuity in
the derivative at \(x=1\). Suppose we want to "round" this function such that it
looks smooth around \(x=1\). To this end, replace the straight lines in the
vicinity of \(x=1\) by a (small) cubic curve
$$
y=a(x-1)^{3}+b(x-1)^{2}+c(x-1)+d
$$
for \(x \in[1-\epsilon, 1+\epsilon]\), where \(a, b, c\), and \(d\) are parameters
that must be adjusted in order for the cubic curve to match the value and the
derivative of the function \(N(x)\). The new rounded functions has the
specification
$$
\tilde{N}(x)= \begin{cases}0, & x<0 \\ x, & 0 \leq x<1-\epsilon \\\
a_{1}(x-1)^{3}+b(x-1)+c(x-1)+d_{1}, & 1-\epsilon \leq x<1 \\\
a_{2}(x-1)^{3}+b(x-1)+c(x-1)+d_{2}, & 1 \leq x<1+\epsilon \\ 2-x, &
1+\epsilon \leq x<2 \\ 0, & x \geq 2\end{cases}
$$
with \(a_{1}=\frac{1}{3} \epsilon^{-2}, a_{2}=-a_{1}, d_{1}=1-\epsilon+a_{1}
\epsilon^{3}, d_{2}=1-\epsilon-a_{2} \epsilon^{3}\), and \(b=c=0 .\) Plot this
function. (Hint: Be careful with the choice of \(x\) coordinates!) Name of
program file: plot_hat.py.