Skip to main content
5-Regular Member
November 16, 2014
Solved

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

  • November 16, 2014
  • 13 replies
  • 3898 views

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?

Best answer by Werner_E

You may use a program with a local functiin definition:

1.png

13 replies

Werner_E
Werner_E25-Diamond IAnswer
25-Diamond I
November 16, 2014

You may use a program with a local functiin definition:

1.png

19-Tanzanite
November 16, 2014

In Mathcad 15 this is simple:

Maximize15.png

But I guess they broke it in Prime

MaximizePrime.png

19-Tanzanite
November 16, 2014

This works though.

MaximizePrime2.png

Werner_E
25-Diamond I
November 16, 2014

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.