Message Boards Message Boards

2 Replies
2 Total Likes
View groups...
Share this post:

How do I use a function as a constraint for NMinimize?

Posted 10 years ago

Hi. Im having a problem when using the EigenValue and SingularValueList functions, as a constraint for NMinimize. I have built a function that works fine and return a solution fast with now seemingly problems - actually I've tried many other ways of programming this simple function as well. The problem is that the NMinimize function evaluate the function in a way that causes Imaginary part of the polynomial - which is not supposed to happen if you first apply numerical values.

The code is in the attached file. Thanks for the help :)

POSTED BY: Alon Ohev-Zion
2 Replies
Posted 10 years ago

Hi Daniel. Thank you very much!! I figured it was the problem but could not find out how to overcome it. It was a quick and very useful response :) Alon.

POSTED BY: Alon Ohev-Zion

It would seem that some symbolic evaluation is taking place or at least being attempted. Not good when one is doing SVD and relying on the min singular value. You can avoid this by restricting the function [Gamma]t so that it only is defined when the second argument is explicitly a number,

\[Gamma]t[Kpt_, kpc_?NumberQ]  := ...

is the way to do this (and don't forget to first clear the current definition).

POSTED BY: Daniel Lichtblau
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
or Discard

Group Abstract Group Abstract