# Nintegrate: How to define range of integration with moving singularities

I have to do an integral, like this

NIntegrate[1/Sqrt[(Energy - ℏ ω)^2 - Δ^2], {Energy, Δ, Δ + ℏ ω}]


How can I insert these singularities -Δ + ℏ ω, Δ + ℏ ω

• Do you mean E to be the value 2.718... ? If you don't, change it to an undefined symbol. NIntegrate requires numbers. After changing E to some other integration variable, Integrate will work, although you will need to give assumptions concerning the other variables. – Bill Watts Nov 28 '17 at 19:10
• No I use E here for aesthetic reasons it was a typo E means generic variable of integration – Giuliano-Francesco Timossi Nov 29 '17 at 9:40
• Do you want a numerical solution ? If so give values for all symbols except the variable of integration. if you want an analytical solution try Integrate. – Lotus Nov 29 '17 at 10:56

First, one of the singularities is already an end point, and nothing needs to be done about it. Assuming the symbols have numeric values, then one might check if the other singularity is in the interval of integration:

If[Δ < -Δ + ℏ ω < Δ + ℏ ω,
NIntegrate[1/Sqrt[(Energy - ℏ ω)^2 - Δ^2], {Energy, Δ, -Δ + ℏ ω, Δ + ℏ ω}],
NIntegrate[1/Sqrt[(Energy - ℏ ω)^2 - Δ^2], {Energy, Δ, Δ + ℏ ω}]]


A one-liner that should work is

NIntegrate[
1/Sqrt[(Energy - ℏ ω)^2 - Δ^2], {Energy, Δ, Clip[-Δ + ℏ ω, {Δ, Δ + ℏ ω}], Δ + ℏ ω}]


Block[{Δ = 1, ℏ = 1, ω = 2},

{Energy,1,1,3}

(* 0. - 3.14159 I  *)