I have a pretty complicated expression that I'm interested in integrating. There's a lot of parameters, so it looks pretty involved:
$$ \int_{-\infty}^{\infty}d\Delta\frac{W \sqrt{\frac{\log (2)}{\pi }} \left(-\Omega _{\text{c2}}^2+2 \left(-i \gamma _{12}+\Delta _{\text{c1}}-\Delta _p\right) \left(-2 \left(-\Delta _{\text{c1}}+\Delta _{\text{c2}}+\Delta +\Delta _p\right)-i \Gamma \right)\right)}{\left(\Delta ^2+W^2\right) \left(2 \gamma _{12} \left(\Gamma -2 i \left(\Delta +\Delta _p\right)\right) \left(2 \left(-\Delta _{\text{c1}}+\Delta _{\text{c2}}+\Delta +\Delta _p\right)+i \Gamma \right)-\left(-2 \left(-\Delta _{\text{c1}}+\Delta _{\text{c2}}+\Delta +\Delta _p\right)-i \Gamma \right) \left(\Omega _{\text{c1}}^2+2 \left(\Delta _{\text{c1}}-\Delta _p\right) \left(2 \left(\Delta +\Delta _p\right)+i \Gamma \right)\right)+\Omega _{\text{c2}}^2 \left(2 \left(\Delta +\Delta _p\right)+i \Gamma \right)\right)} $$
But it can at least be put into a simpler-looking form:
$$\int_{-\infty}^\infty \frac{\text{A} \Delta +\text{B}}{\left(\Delta ^2+W^2\right) \left(\text{C}+\text{D}\Delta +\text{E}\Delta ^2 \right)}d\Delta$$
When I ask Mathematica to solve this it says the solution is:
$$\frac{\pi (\text{B}-i \text{A} W)}{W (\text{C}-W (i \text{D} + \text{E} W))} \text{ if: } \Im\left(\frac{D\pm\sqrt{D^2-4 C E}}{E}\right)<0 $$
(where $\Im$ is the Imaginary part) If I interpret this correctly, Mathematica has found a solution if these two inequalities hold. Does anyone know if this is the only "symbolic solution" (I guess the proper term is "a closed form solution") to this integral? For the particular parameters I'm interested in these inequalities are false. Are there still closed form solutions for other parameter spaces other than this inequality.
If it is any help to answering this question: In a Mathematica stackexchange question, I showed that the numeric solution looks very well-behaved, and that the solution under this special condition seems to be very close to the numeric answer under conditions where this inequality doesn't hold.
Any help would be appreciated!
(Before start, there is some error in your question; the condition that Mathematica gives is not correct. I (will) edit it based on my Mathematica result.)
Sometimes Mathematica do not find the integral value for all general cases. Let me first show how the Mathematica failure here, and then I will do calculation of integral you asked.
For example, consider $$ \int_{-\infty}^\infty \frac{1}{x^2 + Ax + B}dx $$ for some complex $A, B$. To find this value one can try to run Mathematica with this query
and this gives
Or $$ \text{ConditionalExpression}\left(0, \Im(A) < \Im\left(\sqrt{A^2 - 4B}\right)\&\& \Im\left(A + \sqrt{A^2 - 4B}\right) \right)$$ for readability.
e.g. for $(A, B) = (1, 2)$, the condition fails to be true. But the integral converges with value $\frac{2\pi}{\sqrt{7}}$ which is not $0$.
Then how can this integral be done? Let $x^2 + Ax + B = (x- \alpha) (x - \beta)$ with assumption $\alpha \not\in \mathbb R$, $\beta \not \in \mathbb R$.
Case 1. Assume $\Im(\alpha) > 0$ and $\Im(\beta) >0$. (Note that this case is the case the Mathematica
ConditionalExpressionrequires here!) Then consider the contour $C_R^- = [-R, R] \cup \{ Re^{i\theta} | \pi < \theta < 2\pi\}$. Integral on the semicircle converges to 0 since the integrand is $\mathcal{O}(R^{-2})$. Also there is no residue in the region enclosed in $C_R^-$. So the we have the integral is zero.Case 2. Assume $\Im(\alpha) < 0 $ and $\Im(\beta) <0$. You can proceed with the same step with coutour $C_R^+ = [-R, R] \cup \{R e^{i\theta} | 0 < \theta < 2\pi\}$, which gives the integral is 0.
Case 3. Assume that imaginary parts have different signs; say $\Im(\alpha) < 0 < \Im(\beta)$. Then with the coutour $C_R^-$, we have $$\int_{-\infty}^\infty \frac{1}{x^2 + Ax + B} = {\color{red}-}2\pi i \mathop{\operatorname{residue}}_{z = \alpha}\frac{1}{(z-\alpha)(z - \beta)} = \frac{2\pi i}{\beta - \alpha}.$$ Here the negative sign is from the orientation of line integral on $C_R^-$.
Summing up; Mathematica covers only the Case 1 here, but Case 2 and Case 3 is also calculatable.
Now consider your integral, $$I = I(A, B, C, D, E, W) = \int_{-\infty}^{\infty} \frac{A x+B}{(x^2+W^2)(C+Dx+Ex^2)}dx. $$ Let me make some assumption; $ 0 < W \in \mathbb{R}$, $E \ne 0$, $Ex^2 + Dx + C$ has no real solutions, $(Ax + B)$ is not a factor of $C + Dx + Ex^2$ nor of $x^2 + W^2$.
Similarly let $C+Dx+Ex^2 = E(x-\alpha)(x -\beta)$. Our task is to find $$E\cdot I = \int_{-\infty}^{\infty} \frac{A x+B}{(x^2+W^2)(x-\alpha)(x-\beta)}dx.$$
We care separate cases as follows;
Case 1. Let $Ex^2 + D x + C = E(x^2 + W^2)$. Then $$E\cdot I = \int_{-\infty}^{\infty} \frac{A x+B}{(x^2+W^2)^2}dx.$$ Since the denominator is even; so $Ax$ part in numerator, which is odd function, vanishes. $$E\cdot I = B\int_{-\infty}^{\infty} \frac{1}{(x^2+W^2)^2}dx.$$
On the coutour $C_R^+$ with large enough $R$, the integrand is $\mathcal{O}(R^{-3})$ so integral converges to 0 on the semicircle, so $$ E\cdot I = 2 \pi i B \mathop{\operatorname{residue}}_{z = W i} \frac{1}{(z^2 + W^2)^2} = \frac{2\pi i B}{4 iW^3} = \frac{\pi B}{2W^3}$$ or $$ I =\frac{\pi B}{2EW^3} $$
Case 2. Let $E : D : C \ne 1 : 0 : W^2$, but one of $\alpha, \beta$ is $Wi$. WLOG let $\alpha = Wi$. $$E\cdot I = \int_{-\infty}^{\infty} \frac{A x+B}{(x-Wi)^2 (x+Wi) (x-\beta)}dx.$$ Left to you.
Case 3. Let $E : D : C \ne 1 : 0 : W^2$, but one of $\alpha, \beta$ is $-Wi$. WLOG let $\alpha = -Wi$. This case is also left to you.
Case 4. None of $\alpha$ and $\beta$ are $\pm Wi$. Then
$$E\cdot I = \int_{-\infty}^{\infty} \frac{A x+B}{(x^2+ W^2) (x- \alpha )(x- \beta )}dx.$$
We choose the contour $C_R^+$ again, so $$ \frac{E}{2\pi i}\cdot I = \sum_{\substack{\zeta\text{ zero of denominator} \\ \Im(\zeta) >0}}\mathop{\operatorname{residue}}_{z = \zeta}\frac{A z+B}{(z^2+ W^2) (z- \alpha )(z- \beta )}.$$ Here we have to make subcases to cover the cases (4-1): $\Im \alpha, \Im \beta >0$, (4-2): $\Im \alpha, \Im \beta <0$, (4-3): $\Im \alpha < 0 < \Im \beta$.
Case 4-1. None of $\alpha$ and $\beta$ are $\pm Wi$ and $\Im \alpha , \Im \beta >0$. Note that this is the only case Mathematica covers.
\begin{align*} \frac{E}{2\pi i}\cdot I =& \mathop{\operatorname{residue}}_{z = W i }\frac{A z+B}{(z^2+ W^2) (z- \alpha )(z- \beta )} + \\ & \mathop{\operatorname{residue}}_{z = \alpha}\frac{A z+B}{(z^2+ W^2) (z- \alpha )(z- \beta )} + \\ & \mathop{\operatorname{residue}}_{z =\beta }\frac{A z+B}{(z^2+ W^2) (z- \alpha )(z- \beta )} \\ =&\frac{iAW + B}{2iW(iW - \alpha)(iW - \beta)} + \frac{A\alpha + B}{(\alpha^2 + W^2)(\alpha - \beta)} + \frac{A \beta + B}{(\beta^2 + W^2)(\beta- \alpha)} \end{align*}
Let's confirm this by comparing to the Mathematica result. The following is tedious; \begin{align*} \frac{E}{2\pi i}I &= \frac{iAW + B}{2iW(iW - \alpha)(iW - \beta)} + \frac{A\alpha + B}{(\alpha^2 + W^2)(\alpha - \beta)} + \frac{A \beta + B}{(\beta^2 + W^2)(\beta- \alpha)}\\ & = \frac{iAW + B}{2iW(iW - \alpha)(iW - \beta)} + \frac{1}{\alpha-\beta}\left(\frac{A\alpha + B}{(\alpha^2 + W^2)} -\frac{A \beta + B}{(\beta^2 + W^2)}\right)\\ & = \frac{iAW + B}{2iW(iW - \alpha)(iW - \beta)} + \frac{1}{\alpha-\beta}\left( \frac{(A\alpha + B)(\beta^2 + W^2) - (A \beta + B)(\alpha^2 + W^2)}{(\alpha^2 + W^2)(\beta^2 + W^2)}\right)\\ & = \frac{iAW + B}{2iW(iW - \alpha)(iW - \beta)} + \frac{A W^2 - (\alpha + \beta)B - \alpha \beta A}{(\alpha^2 + W^2)(\beta^2 + W^2)} \\ & = \frac{(iAW + B)(iW+\alpha)(iW+\beta)}{2iW(W^2 + \alpha^2)(W^2 + \beta^2)} + \frac{2 i W\left(A W^2 - (\alpha + \beta)B - \alpha \beta A\right)}{2iW(\alpha^2 + W^2)(\beta^2 + W^2)} \\ & =\frac{(-iAW + B)(-iW+\alpha)(-iW+\beta)}{2iW(W^2 + \alpha^2)(W^2 + \beta^2)}\\ & =\frac{(-iAW + B)}{2iW(iW +\alpha)(iW + \beta)} =\frac{(-iAW + B)}{2iW\left(-W^2 + i(\alpha + \beta)W + \alpha \beta\right)}\\ I & = \frac{2\pi i}{E}\cdot \frac{(-iAW + B)}{2iW\left(-W^2 + i(\alpha + \beta)W + \alpha \beta\right)}\\ & = \frac{\pi(-iAW + B)}{W\left(-EW^2 + iE(\alpha + \beta)W + E\alpha \beta\right)} \end{align*} With $E(\alpha + \beta) = -D$ and $E\alpha \beta = C$, \begin{align*} I & = \frac{\pi(-iAW + B)}{W\left(-EW^2 + iE(\alpha + \beta)W + E\alpha \beta\right)} \\ & = \frac{\pi(-iAW + B)}{W\left(-EW^2 + -iDW + C\right)} = \frac{\pi(-iAW + B)}{W\left(C -W(EW +iD) \right)} \end{align*} which concides to the Mathematica result. (Whoa!)
Case 4-2, 4-3 is also left to you.
Summing up : Sometimes Mathematica is too lazy to cover all possible cases, and you can do it via some tedious residue calculuation by yourself in this case.