---

# Item X

Let
$$
H(x) = \begin{cases}
    1 & \text{if} -0.5 \leq x \leq 0.5
    \\ 0 & \text{otherwise}
\end{cases} \, .
$$

Compute $F(x) = \int_{-\infty}^{\infty} \tilde{H}_a(y) \tilde{H}_b(x-y) \, dx$ where $\tilde{H}_a(x) = \frac{1}{a} H\left( \frac{x}{a} \right)$.

---

We can work with the definition:
\begin{align}
\int_{-\infty}^{\infty} \tilde{H}_a(y) \tilde{H}_b(x-y) \, dx
&= \frac{1}{a} \int_{-\infty}^{\infty} H\left(\frac{y}{a}\right) \tilde{H}_b(x-y) \, dx
\\ &= \frac{1}{a} \int_{-a/2}^{a/2} \tilde{H}_b(x-y) \, dx
\\ &= \frac{1}{ab} \int_{-a/2}^{a/2} H\left(\frac{x-y}{b}\right) \, dx
\\ &= \frac{1}{ab} \int_{-a/2}^{a/2} H\left(\frac{y-x}{b}\right) \, dx
\\ &= \frac{1}{ab} \max\left( R-L, 0 \right)
\end{align}

where
$$
L = \max\left(-\frac{a}{2}, x-\frac{b}{2} \right)
$$
$$
R = \min\left(\frac{a}{2}, x+\frac{b}{2} \right)
$$


```python
def convolution(a,b):
    return lambda x: (a*b)**-1 * max(min(a/2.0,x+b/2.0)-max(-a/2.0,x-b/2.0),0)
```


```python
conv = convolution(4,3)
conv(-1.5)
```




    0.16666666666666666




```python

```

905806457c2d8308cb9849d9c45552dd8d0f3b3a
ipynb
Jupyter Notebook
t1_questions/item_10.ipynb
autopawn/cc5-works
63775574c82da85ed0e750a4d6978a071096f6e7
MIT
t1_questions/item_10.ipynb
autopawn/cc5-works
63775574c82da85ed0e750a4d6978a071096f6e7
MIT
t1_questions/item_10.ipynb
autopawn/cc5-works
63775574c82da85ed0e750a4d6978a071096f6e7
MIT
Qwen/Qwen-72B
1. YES
2. YES