Solution (source code)

= Solution

Either essay option suffices; both are developed here to make the two mathematical constructions available.

\b[Diffusion for images.] Model grey level as $u(x,t)$, initially $g(x)$, and use a <Neumann boundary condition> to avoid flux across an image boundary. The linear <heat equation> $u_t=\Delta u$ smooths the data. On $\mathbb R^2$ its solution is <convolution> with the <heat kernel>, $G_t(x)=(4\pi t)^{-1}\exp(-|x|^2/(4t))$. Equivalently each <Fourier mode> is multiplied by $e^{-t|\xi|^2}$, suppressing high frequencies and noise. With no flux, the mean is conserved and
$$
\frac d{dt}\frac12\int u^2=-\int|\nabla u|^2\le0.
$$
The drawback is that sharp edges also contain high frequencies: a step becomes a transition of width comparable to $\sqrt t$. Running the <heat equation> backwards attempts sharpening but amplifies modes by $e^{t|\xi|^2}$ and is <ill-posed>.

The <Perona-Malik equation> instead uses a decreasing diffusivity,
$$
u_t=\operatorname{div}(c(|\nabla u|)\nabla u),\qquad
c(r)=\frac1{1+(r/K)^2},\quad K>0.
$$
Small gradients are smoothed strongly and large ones less strongly. If $n=\nabla u/|\nabla u|$ and $t$ is a unit tangent to a level curve, then away from zero gradient,
$$
u_t=[c(r)+rc'(r)]u_{nn}+c(r)u_{tt},\qquad r=|\nabla u|.
$$
The derivative of the flux, rather than just $c(r)>0$, controls forward parabolicity. Here $c(r)+rc'(r)=[1-(r/K)^2]/[1+(r/K)^2]^2$ becomes negative for $r>K$: smoothing remains tangential but the normal direction can sharpen. This formal edge enhancement comes with forward-backward <ill-posedness>, so existence and stability of the unregularized continuum equation must not be presumed. One regularization uses $c(|\nabla(G_\varepsilon*u)|)$ as a smoothed edge detector while keeping the flux proportional to $\nabla u$. For fixed positive $\varepsilon$, the coefficient is controlled by the smoothed data; under suitable bounds it stays positive and gives a regularized forward equation. It preserves edges through reduced cross-edge transport, without the same local backward-diffusion calculation.

<Diffusion from a gradient energy> connects these equations with <variational regularization>. If $E(u)=\int\Phi(|\nabla u|)$, its formal $L^2$ <gradient flow> is $u_t=\operatorname{div}(\Phi'(r)\nabla u/r)$. Linear diffusion corresponds to $\Phi(r)=r^2/2$. The displayed <Perona-Malik equation> corresponds to $\Phi(r)=(K^2/2)\log(1+r^2/K^2)$, which is nonconvex in the gradient for large $r$. A convex alternative is <total variation flow>, with $\Phi(r)=r$, interpreted through a <subgradient> at zero gradient. Adding squared data fidelity gives the formal evolution $u_t=\operatorname{div}(\nabla u/|\nabla u|)-(u-g)$, whose equilibrium is the unique <total variation denoising> minimizer. Convex TV preserves sharp interfaces more effectively than the heat energy, but it may produce piecewise constant plateaux, known as <staircasing in total variation denoising>. A stopping time or fidelity weight controls the smoothing scale. \b[Linear diffusion is stable but blurs edges; nonlinear diffusion must balance edge selectivity with parabolicity and regularization.]

\b[Wavelets on an interval.] Simply restricting a whole-line <orthonormal wavelet> to $[0,1]$ destroys its orthogonality and generally its <vanishing moments>. Periodizing the basis restores orthogonality on the circle, but treats the two endpoints as neighbors. This is suitable for periodic data and can create an artificial endpoint jump for nonperiodic data.

A localized <interval-adapted wavelet basis> instead uses unchanged interior functions and finitely many special <boundary wavelets> at each endpoint. Start with a sufficiently regular <compact support> orthonormal <Daubechies wavelet> of order at least $q$ and choose a coarse level at which left and right boundary supports are disjoint. At each boundary, take appropriate finite combinations of the scaling functions that meet the endpoint, restricted to the interval. Choose these combinations to reproduce <polynomials> of degrees $0,\ldots,q-1$, remove dependencies, and orthonormalize the finite boundary <Gram matrix>. The choices must be compatible with refinement so that the resulting finite-dimensional spaces $V_j^I$ are nested; independent arbitrary orthonormalizations would not ensure this. Interior functions retain their whole-line filters, while the boundary functions use finite boundary refinement matrices.

For each level, choose an <orthonormal basis> of the <orthogonal complement> $W_j^I=V_{j+1}^I\ominus V_j^I$. It consists of interior wavelets and a bounded number of left and right <boundary wavelets>. Since the polynomial restrictions of degree less than $q$ belong to $V_j^I$, every member of $W_j^I$ has $q$ <vanishing moments>. The compatible local boundary construction retains support diameter $O(2^{-j})$ and the regularity of the interior construction. Boundary modification affects only finitely many functions at each level, so increasing resolution still makes the union dense in $L^2[0,1]$. Consequently, for a fixed coarse level $J$,
$$
\boxed{L^2[0,1]=V_J^I\oplus\mathop{\bigoplus}_{j\ge J}W_j^I.}
$$
The coarse <scaling functions> together with all these <wavelets> form an <orthonormal basis>. This construction is the <Cohen-Daubechies-Vial interval wavelet construction>. It preserves localization, polynomial cancellation and stable coefficient extraction without imposing periodic or zero boundary data. The finite boundary refinement matrices also permit a fast transform; a mere restriction followed by one unrelated <Gram-Schmidt process> at each scale does not establish all these properties.