strange quad_qags behavior?



"%solve misses many (most) important cases; for example %solve knows nothing 
about bessel functions. Consider:

  (%i24) quad_qags (1/bessel_j(0,x), x, 2, 10, 'epsrel=1d-10);
  (%o24) [19.18306454272454,49.39600889427612,7077,5]

Oops... bessel_j(0,x) has three zeros in [2, 10] ; sometimes a visual 
analysis wins:

  (%i25) wxplot2d(bessel_j(0,x),[x,2,10]);

--Barton"

I agree that visual analysis may be the best way.  But if expr is univariate 
then you can use find_root(1/expr,x,a,b).  You just have to figure out a and 
b, which may be easier that finding the analytical solution, if there is 
one.  My TI-89 calculator can find a and b in most cases.  It has a nsolve() 
command which does not even require a and b. I assume it samples the real 
number line according to some algorithm and finds a and b on its own.  I 
does accept help in cases by allowing the user to enter a guess for where 
the root is.  Maybe someone knows what algorithm TI-89 uses.  I think you 
could for integrate(1/bessel_j(7,x),x,c,d) just try (c,(c+d)/2) and 
((c+d)/2, d), and then rinse, repeat.  That would always work.

Rich