kill(all)$
load(lrats)$

Lagrange multiplier  and extrema ,version 1.0
peter.vlasschaert@gmail.com,01/08/2018.

Lagrange multiplier   ?
===================
Answer : solve minima or maxima of function with constraints.
----------------------------------------------------------------------------------------------
rem : multiplier  ' = λ'

depends(f,[x,y]);

function :  ? ,     u= f(x,y)

p1: u =f;

constraint : ?,  φ(x,y) =0

depends(φ,[x,y]);

p1a:φ = 0;

dφ= total differential = ∂φ/∂x*dx +∂φ/∂y*dy =0
rem : φ =constant = 0.

p1b:diff(φ,x) +diff(φ,y)*dy/dx = 0;

du = total differential = ∂u/∂x*dx +∂u/∂y*dy

p2: 'diff(lhs(p1),x)=diff(rhs(p1),x)+diff(rhs(p1),y)*dy/dx;

point of extrema ( minima or maxima)
rem : total differential zero only at the extrema.

p2a:(rhs(p2) )=0;

combine, 'p1b' and 'p2a'
====================
p2a : function with extrema.
p1b : constraint on the function

p3:lhs(p2a)+λ*lhs(p1b)=0;

p3a:expand(p3);

1e)  find coef : dy/dx ?

p3b:ratcoeff(lhs(p3a),dy/dx) ;

2e) other part without : dy/dx

p3c:subst([dy=0],lhs(p3a));

from 'p3a = 0 ' when  'p3b' =0  and  'p3c' = 0
rem : dy/dx ≠ 0 without any problem.

result : we have 'three' unknowns {x,y,λ}
=========================================================
Answer : to find x,y,λ we have needed three equations . ' see below '
-------------------------------------------------------------------------------------------------------

p4:p3b =0;
p4a:p3c = 0;
p4b:p1a;

λ : called the unknown lagrange multiplier.

----------------------------------------------------------------------------------------------------------------------------------------