<s>[INST] Integrating $\int_0^\pi x^4\cos(nx)\,dx$ using the Feynman trick I should solve the following integral
$$\displaystyle\int_0^\pi x^4\cos(nx)\,dx$$
Usually you would integrate 4 times by parts. I was wondering if there is a more direct way, something like the Leibniz rule (aka Feynman trick).
 [/INST] Take $\int$ as operator D^(-1)
(1/D)e^(ax)x^4=e^(ax)(1/(D+a))x^4=e^(ax)(1/a)(1+D/a)^-1 {x^4}
=(1/a)e^(ax){1-D/a+D^2 /a^2 +D^3/a^3-d^4/a^4}x^4
We can take a as $in$ and proceed to obtain the real part of the expression.
[\begin{gathered}
  \int {{e^{ax}}} {x^n}dx = \frac{1}{D}\left\{ {{e^{ax}}.{x^4}} \right\} = {e^{ax}}\frac{1}{{D + a}}\left\{ {{x^4}} \right\} \hfill \\
   = \frac{{{e^{ax}}}}{a}\frac{1}{{\left( {1 + \frac{D}{a}} \right)}}\left\{ {x4} \right\} = \frac{{{e^{ax}}}}{a}{\left( {1 + \frac{D}{a}} \right)^{ - 1}}\left\{ {{x^4}} \right\} \hfill \\
   = \frac{{{e^{ax}}}}{a}\left( {1 - \left( {\frac{D}{a}} \right) + {{\left( {\frac{D}{a}} \right)}^2} - {{\left( {\frac{D}{a}} \right)}^3} + {{\left( {\frac{D}{a}} \right)}^4} -  \cdots } \right)\left\{ {{x^4}} \right\} \hfill \\
   = \frac{{{e^{ax}}}}{a}\left\{ {{x^4} - \frac{{4{x^3}}}{a} + \frac{{4.3{x^2}}}{{{a^2}}} - \frac{{4.3.2x}}{{{a^3}}} + \frac{{4.3.2.1}}{{{a^4}}}} \right\} \hfill \\
  Let\,a = j.n;and\,obtain\,the\,real\,part\,of\,the\,result. \hfill \\ 
\end{gathered} ]
</s>