Skip to main content
1-Visitor
May 10, 2021
Question

How to find a minimum of a chain of functions

  • May 10, 2021
  • 2 replies
  • 3139 views

Take the following 2 variables:

AL_9913769_1-1620673695224.png

How do I use Mathcad to find the combination of x and y that minimizes g? Is it possible to do this while keeping a and g separate?

Please try to make a solution easy for a Mathcad newbie to understand

 

2 replies

24-Ruby IV
May 10, 2021

gxy.png

1-Visitor
May 10, 2021

How do you insert that colored contour plot?

The textbox containing "Minimize(g,x,y)" doesn't seem to do anything. What is its purpose?

Could you generate the colored contour plot while keeping "a" and "g" separate?

23-Emerald IV
May 10, 2021

1. How do you insert that colored contour plot?

On the ribbon, choose 'plots', then use the rightmost icon to insert a contour or 3D plot. See examples in the help info.

 

2. The textbox containing "Minimize(g,x,y)" doesn't seem to do anything. What is its purpose?

That isn't a text box, but an attempt to use the built-in Minimize function to find the minimum of the function, with guess values for x and y each 1. The function produces an error, indicated by the red box, because the minimum is reached for x= minus infinity.

Here's another attempt:

LucMeekes_1-1620681695893.png

Also fails, but with another function a :

LucMeekes_2-1620681730356.png

 

3. Could you generate the colored contour plot while keeping "a" and "g" separate?

How would you like to keep a and g separate?

You could plot two surfaces as a function of x and y, one for a, the other for g (including a), is that what you want?

LucMeekes_0-1620682249611.png

 

 

Success!
Luc

 

25-Diamond I
May 10, 2021

Luc already explained why there can't be a solution if x and y are unconstrained.

In case you have additional constraints (like x and y being non-negative), you may use a solve block:

Werner_E_0-1620685151037.png

I guess the solution to "keep a and g separate" is to turn both into functions of x and y, right?