Using integrate with sqrt



Using integrate when the integrand is the
square root of a complex expression leads to
a numerical error: the real part is not correct.
The real part should be about 2.65, as shown
by quad_qags.

-------------------------------
Maxima 5.25.1 http://maxima.sourceforge.net
using Lisp GNU Common Lisp (GCL) GCL 2.6.8 (a.k.a. GCL)


(%i1) display2d:false$

/*** wrong real part ****/

(%i2) float(rectform(integrate(sqrt(-1+%i*x),x,-2,3)));

(%o2) 1.358288937752039*%i+1.318001741143204

/*** correct real part  ****/

(%i3) er : realpart(sqrt(-1+%i*x));

(%o3) (x^2+1)^(1/4)*cos(atan2(x,-1)/2)

(%i4) quad_qags(er,x,-2,3);

(%o4) [2.651335074475815,3.3310687541643347E-10,399,0]


(%i5) ei : imagpart(sqrt(-1+%i*x));

(%o5) (x^2+1)^(1/4)*sin(atan2(x,-1)/2)

(%i6) quad_qags(ei,x,-2,3);

(%o6) [1.358288937752036,2.1181538745196349E-9,483,0]

-----------------------------------
Is there a way to use integrate for this kind
of integrand which will allow the correct
real part to be obtained?

Ted Woollett


(%o6) [1.358288937752036,2.1181538745196349E-9,483,0]