Turn on suggestions

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

Showing results for

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

Showing results for

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

Jan 20, 2018
08:18 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator

Jan 20, 2018
08:18 PM

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?

Solved! Go to Solution.

1 ACCEPTED SOLUTION

Accepted Solutions

Jan 22, 2018
08:20 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator

Jan 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

Jan 20, 2018
10:45 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator

Jan 20, 2018
10:45 PM

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.

Jan 21, 2018
05:12 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator

Jan 21, 2018
05:12 PM

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.

Jan 22, 2018
08:20 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator

Jan 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:

Jan 22, 2018
09:48 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator

Jan 22, 2018
09:48 AM

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?

Jan 22, 2018
10:39 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator

Jan 22, 2018
10:39 AM

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.

Jan 22, 2018
11:44 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator

Jan 22, 2018
11:44 AM

ok Werner, thank you very much for the help.

Jan 21, 2018
02:17 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator

Jan 21, 2018
02:17 AM

Here

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

But sent please the Mathcad sheet!