How to compare two complex numbers?
19 次查看(过去 30 天)
显示 更早的评论
I am trying to implement Muller's method for computing the complex root of a polynomial.
Here r1,r2 could be complex in nature.
How do i compare r1 and r2. r1 >= r2 doesnt seem to be working. I have read elsewhere that > operator compares only the real part of the complex number. Is this true?
4 个评论
Bruno Luong
2019-8-18
编辑:Bruno Luong
2019-8-18
Then use
abs(r1) < abs(r2)
You notice this is NOT the same than r1 < r2 even for real numbers.
If you apply the first definition with r1=-4 and r2=2 it returns FALSE, which is kind of not comfortable to believe.
In fact there is no order relation for complex numbers.
TMW decides to implement a order relation on complex field that is extended from real number ordering, but rarely pertinent for application.
回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!