cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Need help navigating or using the PTC Community? Contact the community team. X

Maximize/minimize

ptc-5053189
1-Newbie

Maximize/minimize

We are now starting on some of the more advanced features and have been playing around with Maximize and Minimize. I found the minimise not to want to solve and playing around further I cam across the interesting conclusion that Mathcad cannot accommodate multiple accurences of maximize or minimize in the same document.

I duplicated this into a simple sheet duplicating the exact same command next to each other except that the answer is stored into different variables. When moving the one above the other they alternate in solving. This is rather irritating as our model needs to use the data generated to in one case maximize a value and in another case minimize another, but the second one simply does not want to solve.

Has anyone come across the same. Are we doing something wrong or is this a problem in Mathcad.

Please assist

BWB

38 REPLIES 38

OK, I have recreated the worksheet and set it up to be able to compare results with and without units for different values of CTOL with the exact solutions derived symbolically. The solutions depend rather heavy on the guess value, better guesses give better solutions. If we look at the 3D-plot we see that the area around the minimum is rather flat, so small steps will not change the surface area much and the algorithm stops (too soon) according to the convergence tolerance set. Given that 1cm^3 = 10^-6 m^3 I would have expected the same results for (no_units & CTOL=10^-3) and (units cm & CTOL=10^-9). This is pretty much true, but not exactly. Also for (no_units & CTOL=10^+3) I get similar results as with (cm units & CTOL=10^-3) which is also as expected. So far no bug, just a word of caution when using those numeric approximation algorithms with units different from the base units.

But .... from the previous posts it looks like different people get different results from the very same sheet. Can anybody confirm that with this sheet and post screenshots if he/she gets different results? The screenshots below are the result of using Mathcad 15 M030 under Win XP.

Minimize_Unit_Bug_1.png

Minimize_Unit_Bug_2.png

Werner

For CTOL = 10^-3 I get the same, however, for 10^-6 and 10^-9 there is no solution when the units are not included, yet the values for the other solution are different and also differs from yours.

I am using Mathcad 15 M010 on Windows 7

I just loaded the file on a different machine (but still MC15 M035 on Win XP) and got the same results as those I posted the screenshots of. However with CTOL=10^-6 I also get no soulution without units. Better guess values cure the problem of course as the problem is quite sensible to the guesses.

But the different results you get a scary. Guess its not the operating system but the MC version (M010 vs M030)?

Onr thing we haven't done is to ensure that there are three equations that need to be in the solve block for Minimize to work properly if we are solving for three variables (see the help on Minimize). It could be that the oddities we see are a result of this. Who knows what Minimize is doing when we mistreat it?!!!

Alan

Yes, but shouldn't the results, may they be odd, be the same for all of us?

The results I get from my sheet aren't that odd or surprising - they are pretty much what we have to expect given that CTOL is an absolute and not a relative value.

The oddity are the different results people report from the very same sheet.

PS: I don't think that we really need three equations and that we are mistreating Minimize(). After all we are using minimize() and not Find().

Werner Exinger wrote:

Yes, but shouldn't the results, may they be odd, be the same for all of us?

I agree this is odd, though we are probably using slightly different version (I'm still using F000).

Werner Exinger wrote:

PS: I don't think that we really need three equations and that we are mistreating Minimize(). After all we are using minimize() and not Find().

I'm merely quoting the help file!

Alan

Yes, but shouldn't the results, may they be odd, be the same for all of us?

I agree this is odd, though we are probably using slightly different version (I'm still using F000).

Yes, I think its as of different program versions, I am on M030m Berend using M010. What results do you get fro my sheet? Results different from mine or Barend's?

I'm merely quoting the help file!

I see, I just looked it up.

"If you are solving for n variables, the solve block must have n equations."

I think thats an error in the help file because

  • we can use minimize() also unconstrained withou a solve block
  • the help distinguishes between equations and constraints later and all nonlinear examples are using no equation at all but just 2 constraints and also the last example in the linear programming quicksheet contains no equations, 9 constraints and 6 variables to "solve" for
  • n equations for n variables may fix those variables and leave no room at all for optimization
  • Prime's help states differently: "When you add constraints to an optimization problem, you must have fewer equality constraints than optimization variables."

Werner Exinger wrote:

Yes, I think its as of different program versions, I am on M030m Berend using M010. What results do you get fro my sheet? Results different from mine or Barend's?

This is what I get when I run your sheet:

Wernerfile.PNG

Alan

Wow! So the winner is ... F000!

What did they change in the later releases?

Top Tags