Variational Calculus: Difference between revisions
From biophysics wiki
No edit summary |
No edit summary |
||
| (25 intermediate revisions by the same user not shown) | |||
| Line 1: | Line 1: | ||
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 point. Problems of this kind arise e.g. in Optimal Control, Lagrangian and Hamiltonian Mechanics as well as in Optics. | 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, [[The Principle of Least Action|Lagrangian]] and [[Hamilton Function|Hamiltonian Mechanics]] as well as in Optics. | ||
To find the function $u$ that minimizes $P$ we develop $P(u)$ into a | To find the function $u$ that minimizes $P$ we develop $P(u)$ into a Taylor series. | ||
\begin{align} | \begin{align} | ||
P(u)=P(u^*+v)=P(u^*)+P'(u^*) \cdot v + O(v^2)\\ | P(u)=P(u^*+v)=P(u^*)+P'(u^*) \cdot v + O(v^2)\\ | ||
P(u^*+v)-P(u^*)=P'(u^*) \cdot v + O(v^2)\\ \label{var} | \delta P=P(u^*+v)-P(u^*)=P'(u^*) \cdot v + O(v^2)\\ \label{var} | ||
\end{align} | \end{align} | ||
The second equation of \ref{var} is called the first order ''variation'' or just first variation of $P(u)$. Suppose we are at 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 | The second equation of \ref{var} 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$''. | ||
<br\><br\> | <br\><br\> | ||
To remind | 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''' | ||
<div style="background:#FEF5CA;border:1px solid #797979;border-radius:10px;padding:5px 15px 5px 15px;"> | <div style="background:#FEF5CA;border:1px solid #797979;border-radius:10px;padding:5px 15px 5px 15px;"> | ||
\begin{align} | \begin{align} | ||
\frac{\delta P}{\delta u}\cdot v | \delta P=\frac{\delta P}{\delta u}\cdot v | ||
\end{align} | \end{align} | ||
</div> | </div> | ||
| Line 18: | Line 18: | ||
<div style="background:#FEF5CA;border:1px solid #797979;border-radius:10px;padding:5px 15px 5px 15px;"> | <div style="background:#FEF5CA;border:1px solid #797979;border-radius:10px;padding:5px 15px 5px 15px;"> | ||
\begin{align} | \begin{align} | ||
\frac{\delta P}{\delta u}=0 | \frac{\delta P}{\delta u}\cdot v=0 | ||
\end{align} | \end{align} | ||
</div> | </div> | ||
<br\><br\> | <br\><br\> | ||
The | The basic problem of variational calculus deals with an integral of a function of two variables $F(u,u')$. The classical example is the [[The Principle of Least Action|Lagrangian]] in Classical Mechanics. | ||
<div style="background:#FEF5CA;border:1px solid #797979;border-radius:10px;padding:5px 15px 5px 15px;"> | <div style="background:#FEF5CA;border:1px solid #797979;border-radius:10px;padding:5px 15px 5px 15px;"> | ||
\begin{align} | \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} | \end{align} | ||
</div> | </div> | ||
<br\><br\> | <br\><br\> | ||
Developing the | Developing the Taylor series in two dimensions for $F(u,u')$ we have | ||
\begin{align} | \begin{align} | ||
F(u+v,u'+v')=F(u,u')+\frac{\partial F}{\partial u} v + \frac{\partial F}{\partial u'}v' + \dots\\ | F(u+v,u'+v')=F(u,u')+\frac{\partial F}{\partial u} v + \frac{\partial F}{\partial u'}v' + \dots\\ | ||
| Line 40: | Line 40: | ||
Putting $P(u)$ on the LHS we arrive at the first variation | Putting $P(u)$ on the LHS we arrive at the first variation | ||
\begin{align} | \begin{align} | ||
P(u+v)-P(u)= \int_0^1 \frac{\partial F}{\partial u} v + \frac{\partial F}{\partial u'}v' \, dx | \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} | \end{align} | ||
but we want $v$ | 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. | |||
<div style="background:#FEF5CA;border:1px solid #797979;border-radius:10px;padding:5px 15px 5px 15px;"> | |||
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)$. | |||
</div> | |||
'''Example''' | |||
---- | |||
Find the shortest path $u(x)$ between two points $(0,a)$ and $(1,b)$. | |||
[[File:shortestpath.png|thumb|center|300px]] | |||
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. | |||
== Constraints == | |||
---- | ---- | ||
Further Reading | Further Reading | ||
*Gilbert Strang - Calculus of Variations [http://ocw.mit.edu/courses/mathematics/18-086-mathematical-methods-for-engineers-ii-spring-2006/readings/am72.pdf] | *Gilbert Strang - Calculus of Variations [http://ocw.mit.edu/courses/mathematics/18-086-mathematical-methods-for-engineers-ii-spring-2006/readings/am72.pdf] | ||
*Courant & Hilbert - Methods of Mathematical Physics Vol. 1, S 164 | |||
Latest revision as of 10:27, 26 May 2013
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)\\ \label{var} \end{align} The second equation of \ref{var} 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$. <br\><br\> 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}
<br\><br\> 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}
<br\><br\> 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}
<br\><br\> 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)$.
Example
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.
Constraints
Further Reading
- Gilbert Strang - Calculus of Variations [1]
- Courant & Hilbert - Methods of Mathematical Physics Vol. 1, S 164