detect sqrt in expression?



On Nov. 16, 2011,  Stavros Macrakis wrote
----------------------
>a*sqrt(a) simplifies to a^(3/2) -- see my earlier discussion about what
>exactly you mean by "including the operator 'sqrt' ".  So perhaps you want
>to write code recognizing a^(3/2) as "including a sqrt".  How about
>sqrt(sqrt(a)) = a^(1/4)?  Do you want that to be considered as "including
>the operator sqrt?  Surely you don't want sqrt(a)*sqrt(a) (i.e. a) to be
>considered as "including the operator sqrt"?
-------------------------------

I should have defined my goal, which is
to have a filter in the nint program which
allows me to  bypass the use of integrate
if the integrand expr contains multiple
valued functions.

For integrands which pass through the filter,
nint uses:

     float (rectform (integrate (expr,var,a,b)))
  
which can spit out completely wrong answers if
expr contains multiple valued functions.

So I need a filter function which returns true
if at least one multiple valued function is found,
and otherwise returns false.

Thus  I need a function which will detect

1. inverse trig functions which contain 
   somewhere the (real) variable of integration var.

2. inverse hyperbolic trig functions which contain
    somewhere the variable of integration var.

3. log  which contains somewhere the variable
      of integration var.

4. complex or (real and irrational) exponents

  so look for
      a.  f(var)^(n/m)
      b.  f(var)^g(var,%i)
      
   which hopefully will catch (almost?) all cases
  of
          
       f(var,%i)^g(var,%i) = exp (g(var,%i)) * log (f(var,%i))
          
          
Clearly this kind of filter will be rather complicated.

The payoff is the speed advantage of using integrate
instead of quadpack for many integrands which users 
submit to nint.

Ted