Suppressing tiny imaginary parts in complex numbers [closed]

How do I extract the real part of a substitution expression from FindRoot or Solve? Or alternately, how do I insist that they return real results?

For example, FindRoot returns something of the form:

{x->A + B I}


Analytically, I know that x must be real. Because B is 17+ orders of magnitude smaller than A, I assume it's numerical slop.

If I do:

Re[FindRoot[expr, {x, guess}]]


it simply returns:

Re[{x->A + B I}]


Assumptions aren't helping:

Assuming[Element[x, Reals], FindRoot[expr, {x, guess}]] ]


still returns x with a small imaginary component. Any suggestions?

• Use Chop, that's all. Apr 14, 2015 at 16:35
• This is surely a duplicate. Could we please close it as such rather than "easily found in the documentation?" Apr 14, 2015 at 18:58
• Related: (5235), (17809), (52353), (60278) - The last one seems the closest duplicate, but I'm surprised there isn't an older one. Apr 14, 2015 at 19:41
• I did search before asking, but couldn't find anything after a few tries. Chop works, but I wouldn't say it's easy to find in the documentation unless you already know it's there... Apr 15, 2015 at 21:21

Chop[FindRoot[expr, {x, guess}]]