Variational Calculus

From bio-physics-wiki

Jump to: navigation, search

This article deals with minimizing or maximizing functions. From calculus we know that the extremum of a function $P(u)$ is where its derivative is zero $P'=0$. Sometimes we want to solve a more general problem where $u$ itself is a function of $x$ and $P$ an integral. We want to find a function $u(x)$ that minimizes (or maximizes) $P[u(x)]$, rather than a particular minimum-point. Problems of this kind arise e.g. in Optimal Control, Lagrangian and Hamiltonian Mechanics as well as in Optics.

To find the function $u$ that minimizes $P$ we develop $P(u)$ into a Taylor series. \begin{align} P(u)=P(u^*+v)=P(u^*)+P'(u^*) \cdot v + O(v^2)\\ \delta P=P(u^*+v)-P(u^*)=P'(u^*) \cdot v + O(v^2)\\ \tag{1} \end{align} The second equation of (1) is called the first order variation or just first variation of $P(u)$. Suppose we are at the minimum $u^*(x)$ of a curve. To first approximation the following holds. As we perturb $u^*(x)$ a little bit by $v$ we don't change $P(u^*+v)-P(u^*)$ since $P'(u^*)$ is zero. Thus, at the minimum $P(u)$ is stationary with respect to variations in $v=\delta u$.

To remind ourselves that we are doing variational calculus, we use the symbol $\delta$ and call the first derivative of $P$ with respect to $u$ the first variation

\begin{align} \delta P=\frac{\delta P}{\delta u}\cdot v \end{align}

The problem of finding the extremum of the first variation by setting it zero leads to the Euler-Lagrange Equation

\begin{align} \frac{\delta P}{\delta u}\cdot v=0 \end{align}

The basic problem of variational calculus deals with an integral of a function of two variables $F(u,u')$. The classical example is the Lagrangian in Classical Mechanics.

\begin{align} min \, P(u)=\int F(u,u') \, dx \hspace{2cm}\text{with } \hspace{1cm}u(0)=a \hspace{1cm}\text{ and }\hspace{1cm} u(1)=b \end{align}

Developing the Taylor series in two dimensions for $F(u,u')$ we have \begin{align} F(u+v,u'+v')=F(u,u')+\frac{\partial F}{\partial u} v + \frac{\partial F}{\partial u'}v' + \dots\\ \end{align} After integrating we have \begin{align} P(u+v)=P(u)+ \int_0^1 \frac{\partial F}{\partial u} v + \frac{\partial F}{\partial u'}v' \, dx + \dots\\ \end{align} Putting $P(u)$ on the LHS we arrive at the first variation \begin{align} \frac{\delta P}{\delta u}\cdot v=P(u+v)-P(u)= \int_0^1 \frac{\partial F}{\partial u} v + \frac{\partial F}{\partial u'}v' \, dx \\ \end{align} but we want $v$ as overall factor so we integrate the second term of the RHS by parts \begin{align} \int_0^1 \frac{\partial F}{\partial u'}v' \, dx =\left[ \frac{\partial F}{\partial u'}v \right]_0^1- \int_0^1 \frac{d}{dx}\frac{\partial F}{\partial u'}v \, dx\\ \end{align} now we have \begin{align} \frac{\delta P}{\delta u}\cdot v= \int_0^1 \frac{\partial F}{\partial u} v -\frac{d}{dx}\frac{\partial F}{\partial u'}v \, dx +\left[ \frac{\partial F}{\partial u'}v \right]_0^1\\ \end{align} because of the boundary conditions $\left[ \frac{\partial F}{\partial u'}v \right]_0^1$ vanishes.

This equation is called the weak form of the Euler-Lagrange equation \begin{align} \frac{\delta P}{\delta u} \cdot v= \int_0^1 \left( \frac{\partial F}{\partial u} -\frac{d}{dx}\frac{\partial F}{\partial u'} \right) \cdot v \, dx =0 \end{align} A stronger condition is to require the above equation to be zero for every $v$. This is required in the strong form of the Euler-Lagrange equation \begin{align} \frac{\partial F}{\partial u} - \frac{d}{dx} \frac{\partial F}{\partial u'}=0 \end{align} Now we have arrived at a differential equation whose solution gives the function $u(x)$ which minimizes $P(u)$.


Find the shortest path $u(x)$ between two points $(0,a)$ and $(1,b)$.


An infinitesimal line element of the path $u(x)$ has the length $\sqrt{dx^2+du^2}$ which is the same as $\sqrt{1+(u')^2}dx$. The function $F(u,u')$ depends only on $u'$. If we plug into the formula for the weak Euler-Lagrange equation we get \begin{align} \int_0^1 -\frac{d}{dx}\frac{\partial \sqrt{1+(u')^2}dx}{\partial u'} \cdot v \, dx =0\\ \end{align} we get the weak form for our problem \begin{align} \int_0^1 \frac{u' \cdot v'}{\sqrt{1+(u')^2}} \, dx =0 \hspace{1cm} \text{for all } v \hspace{1cm}v(0)=v(1)=0\\ \end{align} The equation is satisfied if $\frac{u'}{\sqrt{1+(u')^2}}$ is constant since $v'$ is guaranteed to be zero at the boundaries because $v(0)=v(1)=0$. If we plug in for the strong form Euler-Lagrange equation we get \begin{align} \frac{\partial F}{\partial u} - \frac{d}{dx} \frac{\partial F}{\partial u'}=0\\ - \frac{d}{dx} \frac{u' }{\sqrt{1+(u')^2}}=0\\ \end{align} This forces \begin{align} \frac{u' }{\sqrt{1+(u')^2}}=c\\ \end{align} to be constant, giving a simple first order ODE. Squaring we have \begin{align} (u')^2=c^2(1+(u')^2)\\ (u')^2(1-c^2)=c^2\\ u'=\frac{c}{\sqrt{1-c^2}} \end{align} with the solution \begin{align} u=\frac{c}{\sqrt{1-c^2}} x + const. \end{align} which is of course a straight line.


Further Reading

  • Gilbert Strang - Calculus of Variations [1]
  • Courant & Hilbert - Methods of Mathematical Physics Vol. 1, S 164