# How to find where in a large expression Power::infy is generated?

Consider the following expression:

With[{h = 21, z = 22},
(Integrate[(ω^(h + 1) Sqrt[1 - ω^2]^(z - 1))/ Sqrt[2 + M ω^2] *
Hypergeometric2F1[1/2, -((h + z)/2), 3/2, (M ω^2)/(2 + M ω^2)]
, ω] /.
ArcSin[k_ ω]/ω :> k) /. ω -> 0]


I deliberately try to avoid using Limit, since it'll be too slow (I have lots of values for h and z and need the calculation to take reasonable time). The expression as it is now leads to a bunch of Power::infy messages. I'm trying to find the most common cases of 0/0 indeterminancies to eliminate manually (as I did for ArcSin[kx]/x above). But the expression is too large to be processed by a human mind.

So my question is: how can I find the exact place where division by zero occurs? I found the case with ArcSin by chance, having found a zero in denominator in stack trace for the Power::infy message. But is there a way to search for a zero in denominator of a held expression automatically?

• If you want to look at w=0, I guess you can use Series[]. – Anjan Kumar Feb 8 '17 at 12:50
• @AnjanKumar I'm not sure how Series is more helpful than Limit in this case... – Ruslan Feb 8 '17 at 13:45
• Please provide an example that gives an error message. I get zero for an answer with no error messages, whether or not I include 'ArcSin[k_ ω]/ω :> k. – bbgodfrey Feb 9 '17 at 10:49
• @bbgodfrey well the example in the OP gives me errors and Indeterminate` at the end with Mathematica 11.0. Sometimes it stops emitting errors and gives zero until you restart the Kernel. – Ruslan Feb 9 '17 at 11:23
• Please share with the community the outcome of updating, especially if the problem does not go away. Best wishes. – bbgodfrey Feb 9 '17 at 22:35