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

Community Tip - Help us improve the PTC Community by taking this short Community Survey! X

Optimizing (max / min) of a function in terms of parameters given:

jroth
4-Participant

Optimizing (max / min) of a function in terms of parameters given:

Hello,

I'm wondering if it is possible for MathCad to do an optimizing routine using max or min but with a given set of parameters. An example is one of the attached in where I use u(x) and g(x,r), where I want to allow for the input of r during the optimization. Additionally, would it be possible to graph the optimized set as a function as well in terms of a variable x & r. (for any given r, the maximum x is a set value as the rest of parameters are just scalar values, thus I would like to get the optimized value of x as a function of r) I'm assuming the opt x for a given r can be done via a vector output from a solve block routine as a function?

1 ACCEPTED SOLUTION

Accepted Solutions
Werner_E
24-Ruby V
(To:jroth)

You may use a program with a local functiin definition:

1.png

View solution in original post

13 REPLIES 13
Werner_E
24-Ruby V
(To:jroth)

You may use a program with a local functiin definition:

1.png

RichardJ
19-Tanzanite
(To:jroth)

In Mathcad 15 this is simple:

Maximize15.png

But I guess they broke it in Prime

MaximizePrime.png

RichardJ
19-Tanzanite
(To:RichardJ)

This works though.

MaximizePrime2.png

You are right - the guess value must not be hard coded in the function as in my approach but can be provided as a normal worksheet variable (or even as a second argument of the function max_x / x.opt.

RichardJ
19-Tanzanite
(To:Werner_E)

I didn't even notice your reply when I posted my second reply

It would be easier if they just made it work as it does in Mathcad 15 though

Richard Jackson wrote:

I didn't even notice your reply when I posted my second reply

It would be easier if they just made it work as it does in Mathcad 15 though

I fully agree. It is very convenient in many situations.

jroth
4-Participant
(To:Werner_E)

Part of issue with 15 is the graph displays. It is very slow when I scroll, especially if I have multiple lines on the same graph. Might be some setting I can alter to change that I am unaware of or some partial display incompatiblity with my OS or display drivers. However prime has major limitations regarding many of the things I would expect to work that do in 15 such as the above.

Edit: It appears to happen greatly on any zoom that isn't the defualt of 100%. However, my monitor resolution is defualtly very high; and thus is difficult to see the sheet without a zoom.

Thank you both for the quick and helpful responses.

Werner_E
24-Ruby V
(To:jroth)

Part of issue with 15 is the graph displays. It is very slow when I scroll, especially if I have multiple lines on the same graph.

I guess this is only the case when you open the sheet the first time or change a parameter which forces a recalculation. MC15 beahves differently whne autocalc is on than Prime. When you open a Prime sheet you see the results of the last calculation before saving the sheet. MC 15 will automatically recalculate a sheet (when autocalc is set on) when you open it, but it only calculates up to the part of the sheet which is shown. So when you scroll down further, recalculation continues and this sometimes feels slow. A general advice for an extensive and complex sheet is to immedeatly scroll down to the end when you opened it and wait until the complete sheet finished calculating.

Generally it would be hard to believe that MC15 is slower than Prime.

RichardJ
19-Tanzanite
(To:Werner_E)

Correction:

Generally it would be hard impossible to believe that MC15 is slower than Prime.

jroth
4-Participant
(To:RichardJ)

Actually, the problem only really appears when I have the zoom at say 200% or 150% and have scrolled to the bottom, and then start scrolling up, it acts like it is replotting the graphs for each 'scroll line' gone up. At 100% standard view, there is no problem. Odd...

Werner_E
24-Ruby V
(To:jroth)

Jake Roth wrote:

Actually, the problem only really appears when I have the zoom at say 200% or 150% and have scrolled to the bottom, and then start scrolling up, it acts like it is replotting the graphs for each 'scroll line' gone up. At 100% standard view, there is no problem. Odd...

Odd, indeed.

Nothing that I would ever have experienced.

jroth
4-Participant
(To:Werner_E)

It has to be something with the display drivers and the resolution settings then and compatibility of the OS or something along those lines. Calculation wise, 15 has NEVER been slower than Prime.

Richard Jackson wrote:

Correction:

Generally it would be hard impossible to believe that MC15 is slower than Prime.

Sorry, my fault. You are perfectly right. 🙂

Top Tags