Message Boards Message Boards

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

Minimize and complex numbers

Posted 9 years ago

Hi, I keep running into a problem using minimize on a set of equations that are complex but after multiplying by the complex conjugate the imaginary part is zero but Minimize keeps outputting:

The objective function {((-0.802836+0. I)+scatter)^2,((-0.800188+0. I)+scatter)^2,((-0.835493+0. I)+scatter)^2,((-0.823595+0. I)+scatter)^2,((-0.807161+0. I)+scatter)^2,<<42>>,((-0.818022+0. I)+scatter)^2,((-0.811734+0. I)+scatter)^2,((-0.812057+0. I)+scatter)^2,<<115>>} should be scalar-valued. >>

So far I have tried to use the Re[] function to strip off the imaginary part but with the same results. Any ideas?

POSTED BY: Kris Brumbaugh
4 Replies
Posted 9 years ago

Thanks for the replies, the problem was on my end with the independent variable definition.

POSTED BY: Kris Brumbaugh

Direct manipulation

In[7]:= ((-0.800188 + 0. I) + scatter)^2 /. Complex[x_, __] -> x

Out[7]= (-0.800188 + scatter)^2
POSTED BY: Udo Krause
Posted 9 years ago

Try Chop. It replaces approximate real numbers close to zero with integer 0.

POSTED BY: David Keith

Perhaps the round-off errors introduce small imaginary parts in the function to minimize. Have you tried with Abs instead of multiplying by the conjugate?

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

Group Abstract Group Abstract