LagrangeMultipliers - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

Online Help

All Products    Maple    MapleSim


Student[MultivariateCalculus]

  

LagrangeMultipliers

  

solve types of optimization problems using the method of Lagrange multipliers

 

Calling Sequence

Parameters

Description

Examples

Calling Sequence

LagrangeMultipliers(f(x,y,..), [g(x,y,..), h(x,y,..),..], [x,y,..], opts)

Parameters

f(x, y, ..)

-

algebraic expression; objective function

[g(x, y, ..), h(x, y, ..), ..]

-

algebraic expression; constraint functions, assumed equal to 0

[x, y, ..]

-

list of names; independent variables

opts

-

(optional) equation(s) of the form option=value where option is one of constraintoptions, levelcurveoptions, pointoptions, output, showconstraints, showlevelcurves, showpoints, or view; output options

Description

• 

The LagrangeMultipliers command returns the local minima, maxima, or saddle points of the objective function f subject to the conditions imposed by the constraints, using the method of Lagrange multipliers. The output option can also be used to obtain a detailed list of the critical points, Lagrange multipliers, and function values, or the plot showing the objective function, the constraints, the solution points, and the level curves of the objective function through those solution points.

• 

The output=plot option is only available for functions of 2 variables.

• 

The opts argument can contain any of the following equations that set output options.

  

 

  

constraintoptions = list

  

Specifies the plot options for plotting the constraint functions. For more information on plotting options, see plot/options.

  

 

  

levelcurveoptions = list

  

Specifies the plot options for plotting the level curves of where the (constrained) extrema are located. For more information on plotting options, see plot/options.

  

 

  

pointoptions = list

  

Specifies the plot options for plotting the extrema. For more information on plotting options, see plot/options.

  

 

  

output = value, detailed, or plot

  

This option controls the return value of the function.

  

* output = value specifies that the minimum and maximum points are returned. Plot options are ignored if output = value. The default is output = value.

  

* output = detailed specifies that the minimum and maximum points, the Lagrange multipliers, and the function values at the critical points are returned. Plot options are ignored if output = detailed.

  

* output = plot specifies that a plot displays, which shows the function and the points.

  

 

  

showconstraints = true or false

  

Determines whether the constraint functions are plotted. The default is true.

  

 

  

showlevelcurves = true or false

  

Determines whether the level curves are plotted. The default is true.

  

 

  

showpoints = true or false

  

Determines whether the points are plotted. The default is true.

  

 

  

view = [realcons..realcons, realcons..realcons, realcons..realcons]

  

Specifies the plot view.

  

 

  

caption = anything

  

A caption for the plot.

  

The default caption is constructed from the parameters and the command options. caption = "" disables the default caption. For more information about specifying a caption, see plot/typesetting. For more information, see plot/options.

• 

For information on changing the default colors, see the Student[SetColors] help page.

Examples

withStudentMultivariateCalculus:

LagrangeMultipliersxy,x28+y221,x,y

2,1,2,−1,−2,1,−2,−1

(1)

The LagrangeMultipliers command can also handle symbolic parameters in the objective function or in the constraints:

LagrangeMultipliersyx,r2+x2+y2,x,y

2r2,2r2,2r2,2r2,2r2,2r2,2r2,2r2

(2)

LagrangeMultipliersyx2+a2,r2+x2+y2,x,y

0,r,0,r,a2+2r2,a2r2,a2+2r2,a2r2,a2+2r2,a2r2,a2+2r2,a2r2

(3)

The output option detailed can be used to return a detailed list of the critical points, Lagrange multipliers, and function values.

LagrangeMultipliersxy,x28+y221,x,y,output=detailed

x=2,y=1,λ1=2,xy=2,x=2,y=−1,λ1=−2,xy=−2,x=−2,y=1,λ1=−2,xy=−2,x=−2,y=−1,λ1=2,xy=2

(4)

LagrangeMultipliersxy,x28+y221,x,y,output=plot

The command to create the plot from the Plotting Guide is:

LagrangeMultipliersxy,x28+y221,x,y,output=plot,showlevelcurves=false

See Also

plot/options

Student

Student[MultivariateCalculus]