# Strange values and plot of the given function

Suppose the function

f[s2_,m_,m2_] = (s2 - m^2 + m2^2 -Sqrt[m^4 - 2m^2(s2+m2^2) + (s2-m2^2)^2])/(s2 - m^2 + m2^2 +Sqrt[m^4 - 2m^2(s2+m2^2) + (s2-m2^2)^2])


defined on the domain

$m > 0, \quad m2 > 0, \quad s2\geqslant(m+m2)^2$

This is real positive function, tending to one at $s2 = (m+m2)^2$. Mathematica's output for f[(m+m2)^2,m,m2] gives 1, as it must be. But when I try to evaluate the function for particular values of arguments, say, f[(5+0.1)^2,5,0.1], it returns complex numbers with the imaginary part not negligibly small, 1. -9.34975*10^-7i!

Will this cause any problems in numerical simulations involving the function?

• A slight reformulation of your expression works wonders for numerical stability: f[s2_, m_, m2_] := (4 m2^2 s2)/(s2 - m^2 + m2^2 + Sqrt[(m + m2)^2 - s2] Sqrt[(m - m2)^2 - s2])^2 – J. M. will be back soon Aug 5 '17 at 9:15

 f[(5 + 1/10)^2, 5, 1/10]

 f[(5+0.1)^2,5,0.1]