| Author |
Comment/Response |
Bill Simpson
|
07/04/12 4:08pm
In Response To 'Re: Re: Re: Re: NMaximize with constraints' --------- Please excuse my mangling this into ascii text. See if you can reproduce what I see.
Working strictly with only your first cell,
Temporarily modify your LambdaIP definition to be
LambdaIP:=Piecewise[
{{Print[{"LIP 0 ", t Alpha MuIP MuT}];1,t Alpha MuIP MuT==0}},
<<youroriginalLambdaIPdefinition>>];
Temporarily modify your LambdaT definition to be
LambdaT:=Piecewise[
{{Print[{"LT 0 ", 2t^2(-1+Alpha)Alpha^2 MuIP^3 MuT}];1, 2t^2 (-1+Alpha)Alpha^2 MuIP^3 MuT==0}},
<<your originalLambdaTdefinition>>];
What that is trying to do is "guard" your two denominators. It tests each denominator to see if they are zero and if so prints a warning 0 and substitutes a meaningless 1 instead of your original expression, otherwise it just uses your original expression.
All that should do is just use up cycles if neither denominator were ever zero.
But what I am seeing in
From In[14]:= {LIP 0, 600. MuIP MuT}
From In[14]:= {LT 0, -288000. MuIP^3 MuT}
From In[14]:= {LT 0, -288000. MuIP^3 MuT}
From In[14]:= {LIP 0, 600. MuIP MuT}
From In[14]:= {LT 0, -288000. MuIP^3 MuT}
So it looks like your denominators equal zero and are not numeric values all at the same time.
The reason I did all this was because I was seeing the warning messages about values not being Real in NMinimize. I suspected this was because of a negative value inside your Sqrt and wanted to verify this with a Piecewise guard.
If you very carefully construct a similar Piecewise guard around your Sqrt argument you may see similar warnings that the argument appears to be both less than zero and not numeric all at the same time.
Note: substituting those senseless 1's for the original senseless values does generate a few spurious warnings that need to be ignored.
If there are no mistakes in this then this may provide some clues to track down the source of your concerns that your constraints are not being respected.
Perhaps this is just one more pitfall of the widespread overwhelming compulsion to use subscripts. Perhaps not.
URL: , |
|