# Complex number as the result of an integral [closed]

My question has been asked before by other members, however, I didn't find the answer to their question helpful in my case. I'm doing a simple numerical integral with real numbers in mathematica, but I get a complex number as a result. This is my integral:

NIntegrate[f1[x], {x, b1, b2}]


, where

f1[x_] := 0.0472245 (4.2312 - x)^3.53272 (-1.19737 + x)^0.630549;


and b1 = 4.2312 and b2 = 8.46239.

The result is 2.40249 - 23.2898i. This is a complex number which I don't expect. Does someone know why I get this result? and, is there any way to avoid getting it?

• The expression (4.2312 - x)^3.53272 is complex when x > 4.2312. As to how to avoid it: Well, it's correct for the function you've written. If you think the answer should be real, then you set up the function or interval wrong. Maybe you want (x - 4.2312)^3.53272 Commented Mar 24, 2019 at 17:37
• If a and b are real numbers and a > 0, then (-a)^b is equivalent to Exp[b (I \[Pi] + Log[a])], in case you're wondering why it should be complex. Commented Mar 24, 2019 at 17:42

Plot[

you can see, that only in the range $$1.19737 < x < 4.2312$$ the function evaluates to purely real values. Like Michael already commented, a fractional power of a negative value will produce complex values outside of that range. Hope that helps to understand the result you got!