***I have revised my method and it turns out consider the half disk is easier than consider a wedge. Thanks for the comments and the answer. However I tend to leave my (incorrect) computation here.
Let us try to compute $\int_{-\infty}^\infty \frac{\cos x}{x^4+1} \, dx$.
The first step is to acknowledge that $\frac{\cos x}{x^4+1} = \frac{1}{2}(\frac{e^{ix}}{x^4+1} + \frac{e^{-ix}}{x^4+1})$ (1)
Let us take a look at $\frac{e^{ix}}{x^4+1}$, I think we should compute its value on a wedge-like curve y, including only $z= e^{i \frac{\pi}{4}} $ as a pole.
Now apply Residue Theorem, we know that its value is $ \frac{\pi i}{2} e^{ie^{\frac{\pi i }{4}}} e^{\frac{\pi i }{4}} $
Now, note that on the wedge, the perpendicular part is $-e^{\frac{\pi i }{4}}$ times the value of the straight line, and the value on the arc is 0 as R goes to infinity.
Now we have $(1-e^{\frac{\pi i }{4}}) \frac{e^{ix}}{x^4+1} = \frac{\pi i}{2} e^{ie^{\frac{\pi i }{4}}} e^{\frac{\pi i }{4}} $, and adjust this we have $\frac{e^{ix}}{x^4+1}$ = $e^{ie^{\frac{\pi i }{4}}} \frac{\pi/4}{\sin(\pi/4)} $ (2), for the $\frac{e^{-ix}}{x^4+1}$ part I suspect we can compute it in another wedge with negative imaginary part and we will end up with the exact same value, and according to (1) we can conclude that the value fir the integral is (2).
Note that since some of the process is extremely tedious I have been deliberately avoid writing everything out, but I would appreciate very much if you point out any mistakes or unclear part. My main question is that:
- is this a valid approach?
- Can there be any easier way?
An additional question is: is there a reliable calculator for improper integral online so I can validify before posting a question? Wolfram Alpha doesn't seem to have such function.