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

Community Tip - Did you get an answer that solved your problem? Please mark it as an Accepted Solution so others with the same problem can find the answer easily. X

Optimize a function with parameters - Including Constraints Given

jroth
4-Participant

Optimize a function with parameters - Including Constraints Given

Hello,

I was able to do this in 15 very easily, and that file is attached. However, I was unable to get the routine to work in Prime (unsurprisingly). As my university has removed the old mathcad program (and it will be dropped from support before long according to PTC) I was trying to atleast understand how to get the answer in Prime.

I'm afraid the way in my earlier post of using a programming block didn't work as expected, and thus I'm unsure how to be able to get the maximum or minimum of an objective function in terms of varying parameters WITH constraints given that can over define the problem.

1 ACCEPTED SOLUTION

Accepted Solutions
Fred_Kohlhepp
23-Emerald I
(To:jroth)

Took some hacking around!

View solution in original post

3 REPLIES 3
Fred_Kohlhepp
23-Emerald I
(To:jroth)

Took some hacking around!

Werner_E
24-Ruby V
(To:jroth)

Its a shame that they have broken in Prime the way we could have easily done this in Mathcad.

You are right, the method given here http://communities.ptc.com/message/263632#263632 does not work because you have constraints and so we need to use a solve block. On the other hand, the function to be maximized (the auxiliary function with just two arguments) changes dynamically depending on a and b and so cannot be used before or in the solve block.

The solution here is to turn the solve block into a function which is dependent on an argument function. We don't pass the constants a and b to the solve block but the function itself.

1.png

EDIT: Just noticed that Fred has beaten me with a less elaborate variant. If for some reason you need to use an already defined function with four arguments and don't want to retype the expression in the solve block, you may modify Fred's approach like this:

2.png

jroth
4-Participant
(To:Werner_E)

Thank you to both of you. I was getting rather frustrated at Prime as I believe I had done this before, but we are currently going through an optimizing thermal systems class and as such, I believed mathcad would be a good tool.

Werner, I also agree that it is disappointing that what worked in 15 doesn't work in Prime as intuitivly as it should. It is also disappointing to see 15 getting phased out has it has greater utility than Prime does in my opinion.

Top Tags