The Euler-Lagrange equations for a Lagrangian function f(x,y,y′) are differential equations which must be satisfied by extrema of the functional F(y).
The euler_lagrange command finds the Euler-Lagrange equations for a Lagrangian f. The function f can be given in one of two ways. For the first way:
| = |
|
| . (1) |
| = |
|
| , k=1,2,…,n. |
The degrees of these differential equations are kept as low as possible. If, for example, ∂ f/∂ y=0, the equation ∂ f/∂ y′=K is returned, where K∈ℝ is an arbitrary constant. Similarly, using the Hamiltonian
H(x,y,y′)=y′ |
| f(x,y,y′)−f(x,y,y′) |
the Euler-Lagrange equation is simplified in the case n=1 and ∂ f/∂ t=0 to:
H(x,y,y′)=K, (2) |
since it can be shown that d/dx H(y,y′,x)=0. Therefore the Euler-Lagrange equations, which are generally of order two in y, are returned in a simpler form of order one in the aforementioned cases. If n=1 and ∂ f/∂ x=0, then both equations (1) and (2) are returned, each of them being sufficient to determine y (one of the returned equations is usually simpler than the other).
Example.
Input:
Output
⎡ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎣ |
| =K0, |
| =K1 | ⎤ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎦ |
where K0,K1∈ℝ are arbitrary (these constants are generated automatically).
It can be proven that if f is convex (as a function of three independent variables, see Section 6.21.8), then a solution y to the Euler-Lagrange equations minimizes the functional F.
Example.
Minimize the functional F for 0<a<b and
f(x,y,y′)=x2 y′(x)2+y(x)2. |
Input:
Output:
| y | ⎛ ⎝ | x | ⎞ ⎠ | = |
|
This can be solved by assuming y(x)=xr for some r∈ℝ.
Input:
Output:
⎡ ⎢ ⎢ ⎣ | − |
| ,− |
| ⎤ ⎥ ⎥ ⎦ |
Note that a pair of independent solutions is also returned by
the kovacicsols command (see Section 6.57.3):
Input:
assume(x>=0):; |
kovacicsols(y’’=(y-2x*y’)/x^2,x,y) |
Output:
⎡ ⎢ ⎢ ⎢ ⎣ |
|
| , |
|
| ⎤ ⎥ ⎥ ⎥ ⎦ |
You can conclude that y=C1 x−√5+1/2+C2 x√5+1/2.
The values of C1 and C2 are determined from the boundary conditions.
Finally, to prove that f is convex:
Input:
Output:
true |
Therefore, y minimizes F on [a,b].
Example.
Find the function y in
⎧ ⎪ ⎨ ⎪ ⎩ | y∈ C1 | ⎡ ⎢ ⎢ ⎣ |
| ,1 | ⎤ ⎥ ⎥ ⎦ | :y | ⎛ ⎜ ⎜ ⎝ |
| ⎞ ⎟ ⎟ ⎠ | =− |
| , y(1)=0 | ⎫ ⎪ ⎬ ⎪ ⎭ |
which minimizes the functional
F(y)= | ∫ |
|
| dx. |
To obtain the corresponding Euler-Lagrange equation:
Input:
Output:
| =K2 |
Input:
Output:
⎡ ⎢ ⎢ ⎣ | − |
| +c0 | ⎤ ⎥ ⎥ ⎦ |
The sought solution is the function of the above form which satisfies
the boundary conditions.
Input:
y0:=sol[0]:; |
c:=[K_3,c_0]:; |
v:=solve([subs(y0,x=1/2)=-sqrt(3)/2,subs(y0,x=1)=0],c) |
Output:
⎡ ⎣ |
| ⎤ ⎦ |
Input:
Output:
− | √ |
|
To prove that y0(x)=−√1−x2 is indeed a minimizer for F,
you need to show that the integrand in F(y) is convex.
Input:
Output:
⎡ ⎣ | x≥ 0 | ⎤ ⎦ |
You can similarly find the minimizer for
F(y)= | ∫ |
| ⎛ ⎝ | 2 sin(x) y(x)+y′(x)2 | ⎞ ⎠ | dx |
where y∈ C1[0,π] and y(0)=y(π)=0.
Input:
Output:
| y | ⎛ ⎝ | x | ⎞ ⎠ | =sinx |
Input:
Output:
−sinx |
The above function is the sought minimizer as the integrand
2 sin(x) y(x)+y′(x)2
is convex:
Input:
Output:
true |
Example.
Minimize the functional F(y)=∫01(y′(x)4−4 y(x)) dx
on C1[0,1] with boundary conditions y(0)=1 and y(1)=2.
First, solve the associated Euler-Lagrange equation:
Input:
Output:
⎡ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎣ | 3 | ⎛ ⎜ ⎜ ⎝ |
| y | ⎛ ⎝ | x | ⎞ ⎠ | ⎞ ⎟ ⎟ ⎠ |
| +4 y | ⎛ ⎝ | x | ⎞ ⎠ | =K6, |
| y | ⎛ ⎝ | x | ⎞ ⎠ | =− |
| ⎤ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎦ |
Input:
Output:
⎡ ⎢ ⎢ ⎣ | − |
| ⎛ ⎝ | −x+1.52832425067 | ⎞ ⎠ |
| +2.32032831141 | ⎤ ⎥ ⎥ ⎦ |
Next, check if the integrand in F(y) is convex:
Input:
Output:
true |
Hence the minimizer is
y0(x)=− |
| (1.52832425067−x)4/3+2.32032831141, 0≤ x≤ 1. |