Why isn't an odd improper integral equal to zero

Regarding your original question: let $f(x)$ be an odd function on $\mathbb R$. We can think of two different ways of computing the improper integral $$\int_{-\infty}^\infty f(x) dx=\lim_{a\to\infty}\int_{-a}^a f(x) dx,$$

or $$\int_{-\infty}^\infty f(x) dx=\lim_{a\to -\infty, b\to\infty}\int_a^b f(x) dx.$$

Since $f$ is odd, the first way gives $0$; this is what is called Cauchy Principal Value. However, the proper way to compute the improper integral is the second way. The reason why, is because we want (in some sense) to take the supremum over all intervals $[a,b]\subset \mathbb R$. And this way of computing it is the reason why $f(x)=\dfrac{1}{x}$ (or $f(x)=x$) will give divergent integrals.


The Cauchy principal value and other pseudo-functions are common in distribution theory (not only...) and in physics where infinite values are removed nicely when possible (hidden under the carpet with renormalization tricks else... ;-)).

In distribution theory we may always exchange derivation and limit, all derivatives remain distributions, every distribution admits one primitive (up to a global constant) and so on... For these (generous) rules to hold we need tolerant functions so that the derivative of $\log|x|$ for example will be P.V. $\frac 1x$ and not simply $\frac 1x$ (the integral of the last one would not exist !). Curiously multiplication became more difficult when multiplying two $\delta(x)$ for example (even with Colombeau and others ideas) but we can't have everything...

Distribution theory is much used in advanced part of physics (with great names like Sobolev, Gel'fand, Dirac and later Schwartz bringing the mathematical respectability) because it allows for example to handle discrete values as well as continuous spectra in an unified way but let's stop the propaganda and come to your second part...

Concerning your "integral of cos/sin from 0 to pi" not evaluated by Alpha. Well it seems that the software didn't considerer compensation of singularities at two finite points (I don't know if Alpha handles compensations at $-\infty$ and $+\infty$ but it could consider them as the same 'point' $\infty=\frac 10$). For physical application you would have to specify the limits say 'from $\epsilon$ to $\pi-\epsilon$' as $\epsilon \to 0$.