Skip to main content
1-Visitor
Jan 24, 2015 1:25 AM UTC
Solved

Help with Minimize optimization

Hello,

Attached is a short sheet with a Minimize function. I'm getting a "variable undefined" error.

Can anyone help?

TIA

Werner_E
Werner_EAnswer
25-Diamond I
Jan 24, 2015 1:46 AM UTC

The problem is the inline evaluation after minimize() in combination with different units. This would force Mathcad to display a vector with two values of different dimensions and unfortunately thats something Mathcad is not capable of.

You have to assign the result of minimize a 2x1 vector of two variables ro make it work:

1.png

3 replies

Werner_E
Werner_E25-Diamond IAnswer
25-Diamond I
Jan 24, 2015 1:46 AM UTC

The problem is the inline evaluation after minimize() in combination with different units. This would force Mathcad to display a vector with two values of different dimensions and unfortunately thats something Mathcad is not capable of.

You have to assign the result of minimize a 2x1 vector of two variables ro make it work:

1.png

Translate
JasonC1-VisitorAuthor
1-Visitor
Jan 27, 2015 2:20 AM UTC

Thanks!!

Now for the next step, I want to plot Vscc (which Minimize finds), vs. Vor.

Attached is my attempt to create a function that calls Minimize... it doesn't work.

Translate
Werner_E
25-Diamond I
Jan 27, 2015 5:25 AM UTC

You can't use a solve block in a program. You'd rather turn the solve block into a function.

As this function would have to return a vector with two different dimensions (which is not possible im Mathcad) we have to get rid of the units here. Furthermore turning minimize and maximize into a function with a variable argument of the objective function can be quite tricky. The order of the arguments matters and in the objective function the parameter to be varied (V.or) must be the first argument - have no clue why.

Guess the attached does what you wanted.

1.png

Translate