Mathematica 9 is now available
Student Support Forum
Student Support Forum: 'NMinimize with Complex Variables' topicStudent Support Forum > General > Archives > "NMinimize with Complex Variables"

Next Comment >Help | Reply To Topic
Author Comment/Response
John Yang
08/21/10 11:24pm

I have a rather formidable real valued function of several complex variables and I am trying to determine if it ever achieves negative values under certain constraints. I am trying to do this using NMinimize but the fact that complex values are involved is giving me a lot of trouble.

The problem can be simplified to the following (im:=I=Sqrt[-1]):

funct[p_]:=1 + Re[p*(1 + im)]
NMinimize[{funct[p], 0 <= Abs[p] <= 1}, p]

When I evaluate this, mathematica gives me several errors, the gist of which is the following:

Invalid comparison with attempted.

And the answer it ends up giving is clearly wrong:

{1., {p -> 3.36619*10^-8}}

However, when I try:

NMinimize[{funct[p], -1 <= p <= 1}, p]

It gives me the right answer:

{8.07509*10^-9, {p -> -1.}}

I also tried:

Assuming[Element[p1, Reals] && Element[p2, Reals],
NMinimize[{funct[p1 + p2*I], 0 <= Norm[p1 + p2*I] <= 1}, {p1, p2}]]

but this has the same problem as last time.

Is there a way to get NMinimize to work with complex variables?


URL: ,

Subject (listing for 'NMinimize with Complex Variables')
Author Date Posted
NMinimize with Complex Variables John Yang 08/21/10 11:24pm
Code for NMinimize with Complex Variables John Yang 08/26/10 6:08pm
Next Comment >Help | Reply To Topic