Get Help

Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Community
- :
- PTC Mathcad
- :
- PTC Mathcad
- :
- Re: Error in function minimize in block resolution

Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

01-20-2018
08:18 PM

01-20-2018
08:18 PM

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?

Solved! Go to Solution.

1 ACCEPTED SOLUTION

Accepted Solutions

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

01-22-2018
08:20 AM

01-22-2018
08:20 AM

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:

7 REPLIES 7

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

01-20-2018
10:45 PM

01-20-2018
10:45 PM

Re: Error in function minimize in block resolution

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.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

01-21-2018
02:17 AM

01-21-2018
02:17 AM

Re: Error in function minimize in block resolution

Here

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

But sent please the Mathcad sheet!

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

01-21-2018
05:12 PM

01-21-2018
05:12 PM

Re: Error in function minimize in block resolution

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.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

01-22-2018
08:20 AM

01-22-2018
08:20 AM

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:

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

01-22-2018
09:48 AM

01-22-2018
09:48 AM

Re: Error in function minimize in block resolution

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?

Highlighted
##

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

01-22-2018
10:39 AM

01-22-2018
10:39 AM

Re: Error in function minimize in block resolution

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.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

01-22-2018
11:44 AM

01-22-2018
11:44 AM

Re: Error in function minimize in block resolution

ok Werner, thank you very much for the help.