Loading [MathJax]/jax/output/HTML-CSS/jax.js
Ask Your Question
0

Help with defining constraints in Lagrangian

asked 7 years ago

ds22 gravatar image

I am trying to maximize the function P, with constraints of x >= 75,000 and y >= 200,000. However, I do not think I am defining them correctly. I attempt to define them as arguments of the solve() function.

var('x','y', 'lam')

P = (0.05*x*(1-(x/150000) - 0.0000008*x*y)) + (0.08*y*(1-(y/200000) - 0.0000008*x*y))

diff(P, x)
-(4.00000000000000e-8)*x*y - (6.40000000000000e-8)*y^2 - (3.33333333333333e-7)*x*(0.120000000000000*y + 1) - (3.33333333333333e-7)*x + 0.0500000000000000

diff(P, y)
-(4.00000000000000e-8)*x^2 - (6.40000000000000e-8)*x*y - (4.00000000000000e-7)*(0.160000000000000*x + 1)*y - (4.00000000000000e-7)*y + 0.0800000000000000

solve([diff(P,x) == 0, diff(P,y) == 0, x >= 75000, y >= 200000], x, y, lam)
[[75000 < x, 200000 < y, -(4e-08)*x*y - (6.4e-08)*y^2 - (3.33333333333333e-07)*x*(0.12*y + 1) - (3.33333333333333e-07)*x + 0.05 == 0, -(4e-08)*x^2 - (6.4e-08)*x*y - ((6.4e-08)*x + 4e-07)*y - (4e-07)*y + 0.08 == 0], [x == 75000, 200000 < y, -(6.4e-08)*y^2 - 0.006*y == 0, -0.0096008*y - 224.92 == 0], [x == 75000, y == 200000, -3760.0 == 0, -2145.08 == 0], [y == 200000, 75000 < x, -0.01600066666666667*x - 2559.949999999999 == 0, -(4e-08)*x^2 - 0.0256*x - 0.08 == 0]]
Preview: (hide)

Comments

Do we really need lambda above? Where?

Please describe mathematically the problem...

dan_fulea gravatar imagedan_fulea ( 7 years ago )

@dan_fulea, No we do not. I wasn't sure.

ds22 gravatar imageds22 ( 7 years ago )

1 Answer

Sort by » oldest newest most voted
1

answered 7 years ago

dan_fulea gravatar image

We write x=75000+X ,y=200000+Y , and the new function to maximize on X,Y0 is the following function Q(X,Y):

sage: var( 'x,y,X,Y' );
sage: P(x,y) = 5/100*x*(1-x/150000-8/10^7*x*y) + 8/100*y*(1-y/200000-8/10^7*x*y)
sage: Q(X,Y) = P(X+75000, Y+200000).expand()
sage: Q(X,Y)
-1/25000000*X^2*Y - 1/15625000*X*Y^2 - 24001/3000000*X^2 - 79/2500*X*Y - 12001/2500000*Y^2 - 3760*X - 53627/25*Y - 236998125

The maximal value for Q is taken at the "corner" (X,Y)=(0,0), because all monomials appearing in total degree 1 have negative coefficients, so the maximal value for both P and Q is - 236998125, taken at "the one or the other corner".

Note: The theory tells us to search for the absolute extremal values

  • in the inner of the closed definition domain, by searching all local extremal values, obtained as a solution of Px=Py=0, and

  • at the (finite and/or infinite) boundary of it, by setting x=75000, x=, y=200000, y=, and computing here, in each of the four cases the supremum.

In our case there are no inner extremal points:

sage: for sol in solve( [diff(P,x) == 0, diff(P,y) == 0], [x,y] ):
....:     print sol
....:     
[x == 816.8214285714286, y == 506.0324074074074]
[x == -816.2645502645503, y == -514.5402298850574]
[x == (13.33265402759081 + 1414.015105182754*I), y == (3.906674551362281 - 883.7900965450355*I)]
[x == (13.33265402759081 - 1414.015105182754*I), y == (3.906674551362281 + 883.7900965450355*I)]

and no solution is in the inner domain.

Also there are no maximal values at the infinite boundaries, since P for either x or y going to +.

For the remained boundaries, we can set x=75000, respectivel y=200000, getting two new maximization problems in the simpler lower dimension...

Preview: (hide)
link

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 7 years ago

Seen: 415 times

Last updated: Feb 01 '18