1
$\begingroup$

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.

$\endgroup$
  • $\begingroup$ You can use for example Sobel filters to approximate derivative. But what does that directional derivative have to do with gradient? $\endgroup$ – mathreadler Oct 24 '18 at 12:42
  • $\begingroup$ 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? $\endgroup$ – user8469759 Oct 24 '18 at 12:44
  • $\begingroup$ $\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. $\endgroup$ – mathreadler Oct 24 '18 at 12:49
  • $\begingroup$ A gradient takes d/dx and d/dy separately on u and creates a vector field from them, not adding them together. $\endgroup$ – mathreadler Oct 24 '18 at 12:51
  • $\begingroup$ 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? $\endgroup$ – user8469759 Oct 24 '18 at 12:51
1
$\begingroup$

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)$

$\endgroup$
  • $\begingroup$ I was about to end up with the same conclusion, if you could derive the boundary term properly so I can see my mistake that would be awesome. $\endgroup$ – user8469759 Oct 24 '18 at 13:27
  • $\begingroup$ And the boundary isn't rectangular unfortunately $\endgroup$ – user8469759 Oct 24 '18 at 13:33
  • $\begingroup$ Also, shouldn't you get $n\cdot \nabla u = 0$? (normal instead of tangent) $\endgroup$ – user8469759 Oct 24 '18 at 13:36
  • $\begingroup$ You are right about the normal vs tangent. I have edited the answer. $\endgroup$ – Vasily Mitch Oct 24 '18 at 14:11
  • $\begingroup$ Great! thank you $\endgroup$ – user8469759 Oct 24 '18 at 14:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.