Variational Methods
The basic problem of the calculus of variations is to determine the function that extremizes a functional . In general, there can be more than one independent variable and the integrand f can depend on several functions and their higher derivatives.
The extremal functions are solutions of the Euler(Lagrange) equations that are obtained by setting the first variational derivatives of the functional F with respect to each function equal to zero. Since many ordinary and partial differential equations that occur in physics and engineering can be derived as the Euler equations for appropriate functionals, variational methods are of general utility.
VariationalD[f,u[x],x],VariationalD[f,u[x,y,...],{x,y,...}] 
 give the first variational derivative of the functional F defined by the integrand f, where f depends on one function u and one independent variable x or several independent variables 
VariationalD[f,{u[x,y,...],v[x,y,...],...},{x,y,...}] 
 give a list of the first variational derivatives of the functional F defined by the integrand f, where f depends on several functions and several independent variables 
EulerEquations[f,u[x],x],EulerEquations[f,u[x,y,...],{x,y,...}] 
 give the Euler equation for the integrand f, where f depends on one function u and one independent variable x or several independent variables 
EulerEquations[f,{u[x,y,...],v[x,y,...],...},{x,y,...}] 
 give a list of the Euler equations for the integrand f, where f depends on several functions and several independent variables 
First variational derivatives and Euler equations.
VariationalD gives the first variational derivatives of a functional F defined by the integrand f. f may depend on several functions ; their derivatives of arbitrary order; and variables . EulerEquations returns the Euler(Lagrange) equations given the integrand f. Again f may depend on several functions ; their derivatives of arbitrary order; and variables .
This is the first variational derivative of .
Out[2]=  
Here f is the Lagrangian for the simple pendulum and EulerEquations gives the pendulum equation.
Out[3]=  
This package defines several coordinate systems as well as the Grad function.
The default coordinate system is set to Cartesian and the coordinates are set to x, y, and z.
This generates Laplace's equation.
Out[6]=  
First integrals.
When there is only one independent variable x, FirstIntegrals gives conserved quantities in the following cases: (1) if f does not depend on a coordinate u explicitly, it is referred to as an ignorable coordinate and the corresponding Euler equation possesses an obvious first integral (a conserved generalized momentum), and (2) if f depends on and their first derivatives only and has no explicit x dependence, FirstIntegrals also returns the first integral corresponding to the Hamiltonian.
The Lagrangian for central force motion has an ignorable coordinate (angular momentum conservation) and is independent of time t (energy conservation). FirstIntegrals yields both the first integral corresponding to coordinate and the first integral corresponding to the Hamiltonian.
Out[7]=  
The Ritz variational principle affords a powerful technique for the approximate solution of (1) eigenvalue problems where A is an operator and is a weight function and (2) problems of the form where B is a positive definite operator and h is given. A judicious choice for the trial function that satisfies boundary conditions and depends on variational parameters must be given in both cases. For (1) VariationalBound extremizes where and . The result is an upper bound on the corresponding eigenvalue and optimal values for the parameters. For (2) VariationalBound extremizes the functional with and yields the value of the functional and the optimal parameters. VariationalBound can also be used to extremize general functionals given appropriate trial functions. NVariationalBound performs the same functions as VariationalBound numerically. It uses the internal function FindMinimum and has the same options and input format for parameters.
VariationalBound[{f,g},u[x,y,...],{{x,x_{min},x_{max}},{y,y_{min},y_{max}},...},u_{t},{a,a_{min},a_{max}},{b,b_{min},b_{max}},...] 
 give an upper bound for the eigenvalue and the optimal values of in the range 
VariationalBound[f,u[x,y,...],{{x,x_{min},x_{max}},{y,y_{min},y_{max}},...},u_{t},{a,a_{min},a_{max}},{b,b_{min},b_{max}},...] 
 give the value of the functional and optimal values of 
NVariationalBound[{f,g},u[x,y,...],{{x,x_{min},x_{max}},{y,y_{min},y_{max}},...},u_{t},{a,a_{0},a_{min},a_{max}},{b,b_{0},b_{min},b_{max}},...] 
 evaluate numerically an upper bound for the eigenvalue and the optimal values of in the range given initial values 
NVariationalBound[f,u[x,y,...],{{x,x_{min},x_{max}},{y,y_{min},y_{max}},...},u_{t},{a,a_{0},a_{min},a_{max}},{b,b_{0},b_{min},b_{max}},...] 
 evaluate numerically the value of the functional and optimal values of given initial values 
Ritz variational bounds.
A trial (wave) function for the 2s state of the hydrogen atom with one node at yields the exact energy in units of Rydberg. Note that the volume element is included in functional parameters f and g, and the default range for the parameters is .
Out[8]=  
The problem of the torsion of a rod of square cross section involves solving where u vanishes on the boundary. VariationalBound gives optimal values of parameters for the approximate solution.
Out[9]=  
The ground state energy of the onedimensional quantum anharmonic oscillator is determined for the given trial (wave) function by NVariationalBound. Note that the default range for the parameters is and the initial values are specified.
Out[10]=  






