Home
Random example
Search
Applications
Chemistry
Economy
Famous theorems
Geography
Physics
Sports
Test
Assessment
Calculus
3D
Applied calculus
Basic calculus
Differential equations
Function plotting
Implicit plotting
Sequences and series
Charts and data
Charts
Statistics
Curves
Interpolation
Intersection, Union, Difference
Lindenmayer Systems
Splines
Geometry
3D
Analytic
Euclidean
Basic constructions
Mappings
Non-Euclidean
Projective
Symmetry
Technical
Animation
Roulettes
Board options
First steps
Images
JSXGraph objects
Arcs and angles
Axes
Circles
Groups
Lines and arrows
Point
Polygons
Slider
Turtle
Vectors
JessieCode
Texts
Transformations
Video
jsxgraph.org
JSXGraph logo
JSXGraph
JSXGraph share

Share

Lagrange multiplier
Show plain example
QR code
<iframe 
    src="http://jsxgraph.uni-bayreuth.de/share/iframe/lagrange-multiplier" 
    style="border: 1px solid black; overflow: hidden; width: 550px; aspect-ratio: 55 / 65;" 
    name="JSXGraph example: Lagrange multiplier" 
    allowfullscreen
></iframe>
This code has to
    <div id="divexamples">
        <strong>Objective functions:</strong><br />
        <select id="examples" onchange="setText();" style="max-width: 600px; font-size: 80%">
            <option>x**2 - 6*x + y**2 - 4*y + 13</option>
            <option>x^2+y^2+x*y*2-2</option>
            <option>x^2 + y^2 + 2*x*y</option>
            <option selected="selected">sin(PI*(x**2 + y)) + cos(PI*y)</option>
            <option>1 / 9 * x ** 2 + y ** 2 - 1</option>
        </select><br />
        <strong>Constraints (function equals 0):</strong><br />
        <select id="examples2" onchange="setText2();" style="max-width: 600px; font-size: 80%">
            <option>-x^2-y+1</option>
            <option selected="selected">x^2+y-1</option>
            <option>-y+1</option>
            <option>y-0.1</option>
            <option>y-0.001</option>
            <option>4*(x-7)**2 + 4*(y-4)**2 - 5</option>
            <option>-x+y</option>
            <option>x + y - 2</option>
            <option>x^2 + y^2 + 2*x*y</option>
            <option>1 / 16 * x ** 2 + y ** 2 - 1</option>
            <option>x</option>
        </select>
    </div>
    <div id="divequation">
        <strong>Equation:</strong><br />

        0 =
        <input id="function" type="text" value="sin(PI*(x**2 + y)) + cos(PI*y)" style="font-size: 80%; width: 480px" />
        <button onClick="setObjective();plot();">select</button><br />
        0 =
        <input id="function2" type="text" value="x^2+y-1" style="font-size: 80%; width: 480px" />
        <button onClick="setConstraint();plot();">select</button><br />
        <strong>Kontourlinien</strong><br />
        <input id="niveauline" type="text" value="[-1.5,-0.5,0,0.5,1.5]" style="font-size: 80%; width: 480px" />
        <button onClick="setContour();plot();">set</button><br />

    </div>

<div id="board-0-wrapper" class="jxgbox-wrapper " style="width: 100%; ">
   <div id="board-0" class="jxgbox" style="aspect-ratio: 1 / 1; width: 100%;" data-ar="1 / 1"></div>
</div>

<script type = "text/javascript"> 
    /*
    This example is licensed under a 
    Creative Commons Attribution ShareAlike 4.0 International License.
    https://creativecommons.org/licenses/by-sa/4.0/
    
    Please note you have to mention 
    The Center of Mobile Learning with Digital Technology
    in the credits.
    */
    
    const BOARDID = 'board-0';

    var board = JXG.JSXGraph.initBoard(BOARDID, {
        boundingbox: [-2, 1.5, 2, -2.5],
        axis: true,
        showFullscreen: true,
    });
 </script> 
/*
This example is licensed under a 
Creative Commons Attribution ShareAlike 4.0 International License.
https://creativecommons.org/licenses/by-sa/4.0/

Please note you have to mention 
The Center of Mobile Learning with Digital Technology
in the credits.
*/

const BOARDID = 'your_div_id'; // Insert your id here!

var board = JXG.JSXGraph.initBoard(BOARDID, {
    boundingbox: [-2, 1.5, 2, -2.5],
    axis: true,
    showFullscreen: true,
});

Lagrange multiplier

Calculus
Famous theorems
Implicit plotting
Given are the contour lines of an objective function (red) and a constraint equation (blue). In order to find a maximum or minimum value of the objective function that simultaneously fulfills the constraint equation, the task is to find a point on the constraint curve fulfilling the necessary optimality condition. This is equivalent to find a point where the gradients of the objective function and of the constraint function are linearly dependent. That approach is known as the *method of Lagrange multipliers*.
Web references
  • Lagrange multiplier
Objective functions:

Constraints (function equals 0):
Equation:
0 =
0 =
Kontourlinien

    <div id="divexamples">
        <strong>Objective functions:</strong><br />
        <select id="examples" onchange="setText();" style="max-width: 600px; font-size: 80%">
            <option>x**2 - 6*x + y**2 - 4*y + 13</option>
            <option>x^2+y^2+x*y*2-2</option>
            <option>x^2 + y^2 + 2*x*y</option>
            <option selected="selected">sin(PI*(x**2 + y)) + cos(PI*y)</option>
            <option>1 / 9 * x ** 2 + y ** 2 - 1</option>
        </select><br />
        <strong>Constraints (function equals 0):</strong><br />
        <select id="examples2" onchange="setText2();" style="max-width: 600px; font-size: 80%">
            <option>-x^2-y+1</option>
            <option selected="selected">x^2+y-1</option>
            <option>-y+1</option>
            <option>y-0.1</option>
            <option>y-0.001</option>
            <option>4*(x-7)**2 + 4*(y-4)**2 - 5</option>
            <option>-x+y</option>
            <option>x + y - 2</option>
            <option>x^2 + y^2 + 2*x*y</option>
            <option>1 / 16 * x ** 2 + y ** 2 - 1</option>
            <option>x</option>
        </select>
    </div>
    <div id="divequation">
        <strong>Equation:</strong><br />

        0 =
        <input id="function" type="text" value="sin(PI*(x**2 + y)) + cos(PI*y)" style="font-size: 80%; width: 480px" />
        <button onClick="setObjective();plot();">select</button><br />
        0 =
        <input id="function2" type="text" value="x^2+y-1" style="font-size: 80%; width: 480px" />
        <button onClick="setConstraint();plot();">select</button><br />
        <strong>Kontourlinien</strong><br />
        <input id="niveauline" type="text" value="[-1.5,-0.5,0,0.5,1.5]" style="font-size: 80%; width: 480px" />
        <button onClick="setContour();plot();">set</button><br />

    </div>
// Define the id of your board in BOARDID

var board = JXG.JSXGraph.initBoard(BOARDID, {
    boundingbox: [-2, 1.5, 2, -2.5],
    axis: true,
    showFullscreen: true,
});

license

This example is licensed under a Creative Commons Attribution ShareAlike 4.0 International License.
Please note you have to mention The Center of Mobile Learning with Digital Technology in the credits.