Skip to main content

calculus and analysis - Maximize violating constraints


I have


Maximize[{(h*10)/(300*(100 - (l^.5 + d^.4 + H^.6))), (l + d + H + h) == 669,      
l > 0, d > 0, H > 0, h > 0}, {h, l, d, H}]

I believe this should maximize my formula, but when I run it, I get



The function value 12073.4 -0.284149 I is not a real number at {d,h,H,l} = {-28.781, 682.337, 2.43779, 13.006}




Can anyone help me figure out how to enter this problem so I get the correct answer? I thought I'd explicitly made it not evaluate the formula for any variable less than 0, but it seems to be trying to do that.



Answer



I suspect you are correct in your assessment. Since there are approximate numbers in the input, Maximize punts to NMaximize, which uses penalty methods to enforce some constraints (not sure why it needs them here for linear constraints; I need to check into that).


You can get better behavior by forcing real values.


NMaximize[{Re[(h*10)/(300*(100 - (l^.5 + d^.4 + H^.6)))], (l +
d + H + h) == 669, l > 0, d > 0, H > 0, h > 0}, {h, l, d, H}]

(* Out[2]= {0.2386596519573097, {h -> 612.1588854816083,
l -> 12.8156550218952, d -> 5.775648336504858,

H -> 38.24981115999163}} *)

Comments