Skip to main content
1-Visitor
March 9, 2012
Solved

Using Maximize Function within a program?

  • March 9, 2012
  • 1 reply
  • 8013 views

In the attached file, the Maximise Function is used against an 5 x 1 Array and is manully repeated 5 times, using a different guess for each case.

Trying to streamline the process, tried to do the five steps with a program but the program fails.

It looks like the maximise function inside the Program is not accepting the Guess value assigned within the program and is picking up the a Global Value for the guess, outside of the program, different from the assign value inside the program.

What would be the proper way to use Maximize within a Program>

Thank you

Laurent

Best answer by AlanStevens

No need to keep redefining the function. See bottom of the attached file.

Alan

1 reply

1-Visitor
March 9, 2012

Looks like I found the answer to this one in an older collab thread::

http://communities.ptc.com/thread/29684

This thread was replied to by people who appear to be Ueber Users (tom gutman, jmgiraud, eden mei), so I would tend to trust the answer:

........ any solver that can be defined as a function can be passed in a program. The ones that can't are Maximize/Minimize.

jmG

So I won't waste more time trying to use Maximize in a Program. But would have been nice if the Manual had a warning about that!

19-Tanzanite
March 10, 2012

You can turn a maximize solve block into a function, and can therefore use it in a program (you cannot embed it in a program, but you can use it in a program). I'm just really busy right now and I'm out at a conference next week. I'll see if I can find time to look at your worksheet tomorrow, but I'm not making any promises.

1-Visitor
March 10, 2012

Somehow the sheet attached to the top post is not the one I had intended to post. I had prepared a simplified version with collapsed region that made it easier to get to the heart of the matter.

The user friendlier one is attached here.

I noticed another issue. I loaded the sheet from 2001 to 15 before posting, and the errors shown are different. In 2001 the program would return results for some of the iterations, where the external global guess that Maximize is (unfortunately) looking for would work. In 15, all steps are in error, so it looks like there are a few changes there.

I will give a shot at looking at the zero of the derivative with a Find function and see if I have better luck than with Maximize.. But the zero will still depend on the exact same good initial guesses.

My HW was turned in and next week is Spring Break. I am just trying to get ready for the HW after Spring Break, where we will have to build on the previous HW. So there is some time left for this one.......