TITLE: Computing an indefinite integral: $\int \frac{2n!\sin x + x^n }{e^x + \sin x + \cos x + P_n (x)}\, dx $
QUESTION [12 upvotes]: Let $\displaystyle 
P_n (x) = 1 + \frac{x}{1!} + \frac{x^2 }{2!} + \cdots + \frac{x^n }{n!}
\
$ and $$
I(x) = \int \frac{2n!\sin x + x^n }{e^x  + \sin x + \cos x + P_n (x)}\, dx
$$ (where $\
n \to \infty 
\
$).
This problem is REALLY frustrating to me at the moment, it's 6 AM here and I've been trying to sort it out since 4:30 AM. First of all, I don't get the use of the $P_n(x)$ notation,  isn't that just $e^x$ ?
Anyhow...None of my approaches yielded any useful results, so I'm reaching out to you. Can someone suggest anything, at all ?
It would be much appreciated, thanks a lot!
EDIT : I managed to solve part of it, I'm now stuck with $
I(x) = n!(x - \log [2e^x  + \sin (x) + \cos (x)] + \int {\frac{{x^n }}{{e^x  + \sin x + \cos x + P_n (x)}}} dx
$. 
Can't really figure out if this is much better, but that's all I could get up until this point.

REPLY [18 votes]: This is a tricky integral! 
Let's prove that

$$
\begin{align}
\int \frac{2n!\sin x + x^n }{e^x  + \sin x + \cos x + P_n (x)} {\rm d} x 
& = n! \:x-n!\:\log |e^x+\cos x+\sin x+P_n(x)| +C,
\end{align}
$$ 

where $C$ is any constant (depending on $n$).
Observe that
$$
P_n (x) = 1 + \frac{x}{1!} + \frac{x^2 }{2!} + \cdots + \frac{x^n }{n!}
$$
is such that
$$
P_n '(x) = 1 + \frac{x}{1!} + \frac{x^2 }{2!} + \cdots + \frac{x^{n-1} }{(n-1)!}= P_n (x) -\frac{x^n}{n!}.
$$
Setting
$$
f(x):=e^x+\cos x+\sin x+P_n(x)
$$ we then have
$$
f'(x)=e^x-\sin x+\cos x+P_n(x)-\frac{x^n}{n!}
$$
and 
$$
f(x)-f'(x)=2\sin x+\frac{x^n}{n!}
$$
Hence your integral may be rewritten as
$$
\begin{align}
\int \frac{2n!\sin x + x^n }{e^x  + \sin x + \cos x + P_n (x)} {\rm d} x 
&= n! \int \frac{f(x)-f'(x) }{f(x)}{\rm d} x \\\\
&= n! \int {\rm d} x-n! \int \frac{f'(x) }{f(x)}{\rm d} x \\\\
& = n! \:x-n!\:\log |f(x)| +C \\\\
& = n! \:x-n!\:\log |e^x+\cos x+\sin x+P_n(x)| +C,
\end{align}
$$ where $C$ is a constant (depending on $n$).