defint returns an incorrect "divergent" message
for integrals of the form
integrate ( sin(x)/x^n, x, 1, inf ) for n = even pos integer,
n = 2, 4, 6, 8, 10, ...
--------------------------------------------
(%i1) display2d:false$
(%i2) integrate(sin(x)/x^2,x,1,inf);
defint: integral is divergent.
-- an error. To debug this try: debugmode(true);
I use nint program to avoid quadpack error messages on
screen. For this type of integral, nint first tries integrate,
and if not successful, passes it to quad_qagi.
(%i3) load(nint);
(%o3) "c:/work2/nint.mac"
(%i4) nint(sin(x)/x^2,x,1,inf);
defint: integral is divergent.
quadpack error code = too many subintervals done
(%o4) false
Actually returns a good answer (nint code at present
rejects quadpack answer with error number = 1.
(%i5) noutL;
(%o5) [[qagi,0.504076,4.02824006E-6,23985,1]]
This was check with Mma = wolfram alpha,
Mma has a symbolic answer:
(%i6) float(sin(1) - expintegral_ci(1));
(%o6) 0.504067
(%i7) nint(sin(x)/x^4,x,1,inf);
defint: integral is divergent.
(%o7) 0.28653
(%i8) noutL;
(%o8) [[qagi,0.28653,2.68053463E-9,1605,0]]
Mma has a symbolic answer:
(%i9) float((expintegral_ci(1)+sin(1)+cos(1))/6);
(%o9) 0.28653
(%i10) nint(sin(x)/x^6,x,1,inf);
defint: integral is divergent.
(%o10) 0.180983
(%i11) noutL;
(%o11) [[qagi,0.180983,1.09841563E-9,255,0]]
Mma has a symbolic answer:
(%i12) float((-expintegral_ci(1)+23*sin(1)+5*cos(1))/120);
(%o12) 0.180983
(%i13) nint(sin(x)/x^8,x,1,inf);
defint: integral is divergent.
(%o13) 0.128765
(%i14) noutL;
(%o14) [[qagi,0.128765,4.79375878E-10,135,0]]
(%i15) nint(sin(x)/x^10,x,1,inf);
defint: integral is divergent.
(%o15) 0.0992126
(%i16) noutL;
(%o16) [[qagi,0.0992126,8.11496319E-10,105,0]]
---------------------------------
Ted Woollett