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

Community Tip - Learn all about PTC Community Badges. Engage with PTC and see how many you can earn! X

Error in function minimize in block resolution

rhanet
7-Bedrock

Error in function minimize in block resolution

Hello, I am solving an optimization problem with the resolution block, in the solver part I got an error because the number of arguments is greater than 16. How can I correct it.

 

I read that to reduce the number of arguments I have to create a vector of arguments, is that so? How can I do it?

1 ACCEPTED SOLUTION

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

The problem seems to be easily solved.

Simply move the definition of the function f() to a place outside of the solve block (and  of course above it).

Not all results are the ones you expected, though:

Bild.PNG

 

View solution in original post

7 REPLIES 7
Werner_E
24-Ruby V
(To:rhanet)

Instead of posting a picture you should post your worksheet. Chances are that you have to zip it first because of a sever bug of the forum software.

 

It looks like you had defined your function f to be dependent on just 16 arguments but you try to use more than those 16 in minimize. Obviously this can't work. You can't use variables in minimize which are not arguments of the function and so have no influence on the outcome.

 

rhanet
7-Bedrock
(To:Werner_E)

Hi, thanks for the help. I attach the file with the resolution block.

Look, I changed the label of the objective function (f) to "function" and obtained the expected results.

Today I added other things before the resolution block and it does not work anymore.

I'd appreciate it if you check the block to see where the error is.

 

 

Werner_E
24-Ruby V
(To:rhanet)

The problem seems to be easily solved.

Simply move the definition of the function f() to a place outside of the solve block (and  of course above it).

Not all results are the ones you expected, though:

Bild.PNG

 
rhanet
7-Bedrock
(To:Werner_E)

Thank you very much for the help Werner, it worked ok.

In other problems I worked with the objective function f (x1, x2, ... xn) within the test values and I had no problems, why in this case I have to take the objective function out of the resolution block?

Werner_E
24-Ruby V
(To:rhanet)

I have no clue why it works that way while it didn't the way you tried.

I gave it a try just because I never define a function inside a solve block but always just in front of it. In my opinion the function definition has nothing to do with the iterations necessary to solve as its neither a guess, nor a constraint.

 

PTC has damaged a lot of things when they wrote Prime. Maybe they introduced some kind of strange limitation for the number of arguments of a function defined inside that new Prime solve block component to be 16 at max.

 

I agree that it should work the way you did it, too. But (compared to Mathcad 15) its also should be possible to use a vector of variables in minerr() instead of a list and it also should be possible to evaluate a solve block symbolically. Both are features in Mathcad which don't work in Prime anymore.

 
 
rhanet
7-Bedrock
(To:Werner_E)

ok Werner, thank you very much for the help.

Here

https://community.ptc.com/t5/PTC-Mathcad-Questions/How-to-convert-XMCD-file-into-MCDX-format/td-p/400986/page/2

I have tried to change the list of unknown to the vector!

But sent please the Mathcad sheet!

Top Tags