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
- :
- Maximize Function: MC 15

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

Highlighted

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

04-22-2013
11:03 PM

04-22-2013
11:03 PM

All --

Any ideas on why the attached sheet bombs? The error is (of course) "This variable is undefined", but I have been using MC long enough now to know that when you get that error in a solve block the absolute last thing that is likely wrong is that you have an undefined variable. I note that if I remove two of the conditions in the solve block, it works. Maybe this means there is no convergence?

Thanks in advance.

Matt

Solved! Go to Solution.

Labels:

1 ACCEPTED SOLUTION

Accepted Solutions

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

04-24-2013
12:01 AM

04-24-2013
12:01 AM

OK, I'm an idiot. Worksheet (below) now works correctly (I think). Putting it in to production mode to look for remaining issues. Thanks, all.

18 REPLIES 18

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

04-23-2013
12:25 AM

04-23-2013
12:25 AM

Re: Maximize Function: MC 15

1. The vector p is a constant.

2. Plot please H(p) function

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

04-23-2013
11:43 AM

04-23-2013
11:43 AM

Re: Maximize Function: MC 15

Valery -- thanks for the reply.However, I'm not sure that I follow you. I provide guess values for p that are constant, but the vector values are, themselves, the parameters being optimized in the solve block. As for plotting the function H(p), that doesn't make sense. H takes the vector p as input and provides a scalar output. I'm not exactly sure what you would like for me to plot.

Matt

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

04-23-2013
12:20 PM

04-23-2013
12:20 PM

Re: Maximize Function: MC 15

Moe, if You would like to find a maximum of a function with one argument You can plot this function and see this maximum.

I think so.

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

04-23-2013
12:52 PM

04-23-2013
12:52 PM

Re: Maximize Function: MC 15

But the one argument is actually a vector of (in this case) 28 values.

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

04-23-2013
01:10 PM

04-23-2013
01:10 PM

Re: Maximize Function: MC 15

Moe Szyslak wrote:

But the one argument is actually a vector of (in this case) 28 values.

Ok,

Can you calculate the value of this function in one point?

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

04-23-2013
01:52 PM

04-23-2013
01:52 PM

Re: Maximize Function: MC 15

Sure. What point? It can be calculated for any vector p.

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

04-23-2013
02:12 PM

04-23-2013
02:12 PM

Re: Maximize Function: MC 15

The solve block given-find needs a guess value. Can you calculate the value of your function with this guess value?

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

04-23-2013
02:25 PM

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

04-23-2013
03:15 PM

04-23-2013
03:15 PM

Re: Maximize Function: MC 15

Valery -- thanks, but that doesn't do it. I, too, found that if I remove one of the constraints the solve block executes. However, this changes the nature of the problem. The vector p is a vector of probabilities and, as such, needs to sum identically to 1. In your attached sheet, I note that it sums to 1.005. If you're tempted to say "close enough", just change the value of mu_p from 0.4 to 0.5 and you'll find that the sum of the vector p is much greater than 1.

I note that I solved this problem in Excel, so I know that there is an optimal solution that satisfies all constraints.