# Minimize and complex numbers

Posted 8 years ago
7363 Views
|
4 Replies
|
2 Total Likes
|
 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?
4 Replies
Sort By:
Posted 8 years ago
 Thanks for the replies, the problem was on my end with the independent variable definition.
Posted 8 years ago
 Direct manipulation In[7]:= ((-0.800188 + 0. I) + scatter)^2 /. Complex[x_, __] -> x Out[7]= (-0.800188 + scatter)^2 
Posted 8 years ago
 Try Chop. It replaces approximate real numbers close to zero with integer 0.
Posted 8 years ago
 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?
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.