1

Suppose $$\mathcal{L} =\mathcal{L}(x,y,u,u_x,u_y) = \frac{1}{2} \lVert \nabla u \rVert^2$$

and I want to find $u$ such that the functional

$$ E(u)=\int_{\Omega} \mathcal{L}dxdy $$

is minimized, computing the variational derivative leads me to

$$ \frac{\delta E}{\delta u} = \int_{\partial \Omega}(u_y - u_x)h d\gamma -\int_{\Omega} \Delta u h dxdy $$

therefore the $u$ function I'm looking for is given by

$$ \left\{ \begin{array}{ll} \left(\frac{\partial}{\partial y} - \frac{\partial}{\partial x}\right) u = 0 & u (x,y) \in \partial \Omega \\ \Delta u = 0 & (x,y) \in \text{Int}(\Omega) \end{array} \right. $$

Though the question might be silly, I wonder how the operator

$$ A =\frac{\partial}{\partial y} - \frac{\partial}{\partial x} $$

might be discretized, my attempt would be using be applying the Sobel masks in pixels at $\partial \Omega$ and adding the results, would this be correct? Or is that operator something know that I'm missing? I thought at the beginning it was the divergence operator, but I was wrong since $u$ is a real valued function.

Update (Full derivation of the integral)

We have $$ \frac{E(u + \alpha h) - E(u)}{\alpha} = \frac{1}{\alpha}\int_{\Omega} \mathcal{L}(x,y,u+\alpha h,u_x+\alpha h_x, u_y+\alpha h_y) -\mathcal{L}(x,y,u,u_x, u_y)dxdy = \\ \int_{\Omega} \frac{\partial \mathcal{L}}{\partial u}h + \frac{\partial \mathcal{L}}{\partial u_x}h_x + \frac{\partial \mathcal{L}}{\partial u_y}h_y dxdy = \int_{\Omega} \frac{\partial \mathcal{L}}{\partial u}h dxdy + \int_{\Omega}\frac{\partial \mathcal{L}}{\partial u_x}h_x + \frac{\partial \mathcal{L}}{\partial u_y}h_y dxdy. $$

Consider the integral

$$ \int_{\Omega}\frac{\partial \mathcal{L}}{\partial u_x}h_x + \frac{\partial \mathcal{L}}{\partial u_y}h_y dxdy $$

observing

$$ \frac{\partial \mathcal{L}}{\partial u_x}h_x = \frac{d}{dx}\left(\frac{\partial \mathcal{L}}{\partial u_x}h\right) - \frac{d}{dx} \frac{\partial \mathcal{L}}{\partial u_x} h $$

and likewise for $\frac{\partial \mathcal{L}}{\partial u_y}h_y$ we have $$ \int_{\Omega}\frac{\partial \mathcal{L}}{\partial u_x}h_x + \frac{\partial \mathcal{L}}{\partial u_y}h_y dxdy = \int_{\partial \Omega} \left(\frac{\partial \mathcal{L}}{\partial u_y} - \frac{\partial \mathcal{L}}{\partial u_x}\right)h d\gamma - \int_{\Omega} \left( \frac{d}{dx} \frac{\partial \mathcal{L}}{\partial u_x} + \frac{d}{dy} \frac{\partial \mathcal{L}}{\partial u_y}\right)h dxdy $$

Taking the limit for $\alpha \to 0$ yields

$$ \frac{\delta E}{\delta u} = \int_{\Omega} \left(\frac{\partial \mathcal{L}}{\partial u} - \frac{d}{dx} \frac{\partial \mathcal{L}}{\partial u_x} - \frac{d}{dy} \frac{\partial \mathcal{L}}{\partial u_y}\right)h dxdy + \int_{\partial \Omega} \left(\frac{\partial \mathcal{L}}{\partial u_y} - \frac{\partial \mathcal{L}}{\partial u_x}\right)h d\gamma $$

And explicit computation of the partial derivatives of $\mathcal{L}$ yields to expression above.

user8469759
  • 5,285
  • You can use for example Sobel filters to approximate derivative. But what does that directional derivative have to do with gradient? – mathreadler Oct 24 '18 at 12:42
  • I might be missing something, where do you see the directional derivative? I want to minimize the squared norm of the gradient, I haven't used directional derivative. Or are you talking about the variational derivative? – user8469759 Oct 24 '18 at 12:44
  • $\frac{\partial}{\partial x} + \frac{\partial}{\partial y}$ will act as a directional derivative 45% degrees. Just try adding two Sobel filters together and you will see. – mathreadler Oct 24 '18 at 12:49
  • A gradient takes d/dx and d/dy separately on u and creates a vector field from them, not adding them together. – mathreadler Oct 24 '18 at 12:51
  • Ah ok, I see what you mean. Basically that equation comes from minimizing the boundary term, where I assume $h$ (the increment) isn't necessarily $h = 0$, hence that quantity is minimized when $$u_x + u_y = \left(\frac{\partial}{\partial x} + \frac{\partial}{\partial y}\right)u = 0.$$ Is this wrong? – user8469759 Oct 24 '18 at 12:51
  • I am more used to solving these in terms of big block matrices, i.e. assume outer product with $\nabla$ is performed by some matrix $\bf M$ and then express solution as equation system involving such $\bf M$ matrices. I don't know where the sum comes from in this derivation. – mathreadler Oct 24 '18 at 12:56
  • I'm deriving the equation, but I want to end up with the a linear system as well. – user8469759 Oct 24 '18 at 13:05
  • It is good you show what you tried, it makes it much easier for people to help. – mathreadler Oct 24 '18 at 13:11
  • I think the operator $A$ was wrong, I think the correct one is $$A = \frac{\partial}{\partial y} - \frac{\partial}{\partial x}$$ – user8469759 Oct 24 '18 at 13:13
  • Probably the boundary conditions should be interpreted as the whole integral $$\int_{\partial \Omega} \left(\frac{\partial \mathcal{L}}{\partial u_y} - \frac{\partial \mathcal{L}}{\partial u_x} \right) h d\gamma = \int_{\partial \Omega} \left(\frac{\partial \mathcal{u}}{\partial x} - \frac{\partial \mathcal{u}}{\partial x} \right) h d\gamma$$ – user8469759 Oct 24 '18 at 13:25

1 Answers1

2

The variation should be: $$ \delta\int_\Omega \frac12|\boldsymbol{\nabla} u|^2 = -\int_\Omega\Delta u\ \delta u + \int_{\partial\Omega}\boldsymbol{\nabla} u\cdot\boldsymbol n\ \delta u $$

So the second equation is $$ \left.\boldsymbol{n}\cdot\boldsymbol{\nabla} u = 0 \right|_{\partial\Omega}, $$ where $\boldsymbol n$ is a normal vector to $\partial\Omega$. Or in other words that gradient flow $\boldsymbol{\nabla} u$ should be perpendicular to the boundary $\partial\Omega$.

Discretization of this depends on many things. If boundary is simple (rectangular), you can just set one of the sobel values to zero. If the boundary is complex, you might try to detect pixels of boundaries, calculate the tangent there and write linear equations on sobel values.

Edit

Consider your integral $$ I = \int_\Omega\left(\frac{\partial\mathcal L}{\partial u_x}h_x+\frac{\partial\mathcal L}{\partial u_y}h_y\right)dx\,dy = \int_\Omega (F\,h_x+G\,h_y)\,dx\,dy =\\ \int_\Omega\left(\frac\partial{\partial x}(F h)-F_xh+\frac\partial{\partial y}(G h)-G_yh\right)dx\,dy = \\ -\int_\Omega h\left(F_x+G_y\right)dx\,dy + \int_\Omega\left(\frac\partial{\partial x}(F h)+\frac\partial{\partial y}(G h) \right)dx\,dy. $$

Green's theorem for second integral gives $$ \int_{\partial\Omega}-Ghdx+Fhdy = \int_{\partial\Omega}h(F\,dn_x + G\,dn_y). $$ where $\boldsymbol{dn} = (dy, -dx)$

Vasily Mitch
  • 10,129