euler_lagrange takes from one to three arguments :
If y∈ℝn is required (by default n=1), one can enter y=(y1,y2,…,yn) as a vector [y1,y2,…,yn]. In that case, y′:=(y1′,y2′,…,yn′). Alternatively, one can specify two arguments, f and either y(x) or [y1(x),y2(x),…,yn(x)].
The return value is a system of differential Euler-Lagrange equations, which represent necessary conditions for extremum of the functional
|f(x,y,y′) dx, y∈ C2[a,b]|
with boundary conditions y(a)=A and y(b)=B where A,B∈ℝ. If n=1, a single equation is returned :
If n>1, there are n Euler-Lagrange equations :
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
the Euler-Lagrange equation is simplified in case n=1 and ∂ f/∂ t=0 to :
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 simpler form of order one in the aforementioned cases. If n=1 and ∂ f/∂ t=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).
It can be proven that if f is convex (as a function of three independent variables), then a solution y to Euler-Lagrange equations minimizes the functional F.
For example, input :
We obtain a system of two differential equations of order one :
where K0,K1∈ℝ are arbitrary (these constants are generated automatically).
In the following example we find the Euler-Lagrange equation for the brachistochrone problem, in which the functional
for some function y≥ 0 such that y(0)=0 and y(x1)=h>0. It represents a curve alongside which an object travels, forced by the force of gravity (its vector pointing upwards), from the point (0,0) to the point (x1,h) in shortest possible time. To obtain the corresponding Euler-Lagrange equation, input :
It is easier to solve the first equation for y, since it is first-order and separable.
In the next example we minimize the functional F for 0<a<b and
We obtain the following Euler-Lagrange equation :
|(y−2 x y′).|
It can be solved by assuming y(x)=xr for some r∈ℝ. Input :
Note that a pair of independent solutions is also returned by kovacicsols command :
Anyway, we 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 we prove that f is convex :
Therefore, y minimizes F on [a,b].
In the example below we find the function
which minimizes the functional
To obtain the corresponding Euler-Lagrange equation, input :
The sought solution is the function of the above form which satisfies the boundary conditions. Input :
To prove that y0(x)=−√1−x2 is indeed a minimizer for F, we show that the integrand in F(y) is convex. Input :
Hence the integrand is convex for x∈[1/2,1].
Similarly, we find the minimizer for
|2 sin(x) y(x)+y′(x)2||⎞|
where y∈ C1[0,π] and y(0)=y(π)=0. Input :
The above function is the sought minimizer as the integrand f is convex :
In the next example we 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 we solve the associated Euler-Lagrange equation :
We find that the integrand in F(y) is convex :
Hence the minimizer is
|(1.52832425067−x)4/3+2.32032831141, 0≤ x≤ 1.|