Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save Nikolaj-K/f8e041de9b82e65851506ae4043fbc1f to your computer and use it in GitHub Desktop.

Select an option

Save Nikolaj-K/f8e041de9b82e65851506ae4043fbc1f to your computer and use it in GitHub Desktop.
odd_integral_tricks.md
This script is explained at
https://youtu.be/53lvGfk9ib8
For all $n$,
$\int_{-\pi}^\pi\, x^{2n} \left(\dfrac{2}{1 + {\mathrm e}^{\sin(x)}}\right){\mathrm d}x = \int_{-\pi}^\pi x^{2n} \,{\mathrm d}x$
$\dfrac{2}{1+{\mathrm e}^x} = 1 - \tanh(\frac{1}{2}x)$
and, for any $a$, we got $\int_{-a}^a \tanh(\frac{1}{2}x) dx = 0$.
Similarly for
$\dfrac{2}{1-{\mathrm e}^x} = 1 - \coth(\frac{1}{2}x)$
(Below we'll show the previous integral relation much more systematically.)
#### Recentering the integral
First off, a note poiting out that this comment here is applicable for integrals over intervals in general.
Consdier $f$ measurable. Then,
* All integrals over intervals are of the form $\int_{-d}^d$.
We can write
$[a,b]=[m-d,m+d]$
$m:=\frac{1}{2}(a+b)$
$d:=b-m=\frac{1}{2}(b-a)$
So
$\int_a^b f(x) dx = \int_{m-d}^{m+d} f(x) dx = \int_{-d}^{d} f(m+x) dx$
* All integrals over intervals are of the form $\int_0^d$ over an even function.
$f(x) = \frac{1}{2}\left(f(x)+f(-x)\right) + \frac{1}{2}\left(f(x)-f(-x)\right)$
and w.l.o.g.
$f(y+x) = \frac{1}{2}\left(f(y+x)+f(y-x)\right) + \frac{1}{2}\left(f(y+x)-f(y-x)\right)$
So
$\int_a^b f(x) dx = \int_{0}^{d}\left(f(m+x)+f(m-x)\right) dx$
(For the even-odd stuff, here we mostly use properties of a module over a commutative ring.
For the integral, there will be more general variants, in measure theory, with more general involutions.)
#### Parity calculus:
Below we'll need:
* The concatenation of an odd function with an odd function is odd. (Proof: Pull out the minus sign.)
* The concatenation of an any function with an even function (on the right of $\circ$) is even. (Proof: Swallow the minus sign.)
There's at least two more such pure concatenation rules and many many more when we talk about algebra with them.
#### On odd functions
If $E$ is an even function, as in $E(-x)=E(x)$, and $U_k$ are odd functions, then
$\int_{-a}^a E(x)\cdot\left( \frac{1}{2} + \sum_{k=0}^\infty c_k U_k(x)^{2k+1} \right) \,{\mathrm d}x = \int_0^a E(x) \,{\mathrm d}x$
E.g. $\dfrac{1}{1\pm e^{U(x)}}$ has even part constant (in fact it's $\frac{1}{2}$)
and the odd part secretly some odd trigonometric function of $U(x)$.
So, e.g.,
$\int_{-a}^a E(x) \dfrac{2}{1\pm {\mathrm e}^{U(x)}}\,{\mathrm d}x = \int_{-a}^a E(x) \,{\mathrm d}x$
Or
$\int_{-a}^a E(x) \dfrac{1}{1\pm {\mathrm e}^{U(x)}}\,{\mathrm d}x = \int_0^a E(x) \,{\mathrm d}x$
E.g., for any $f$,
$\int_{-a}^a f(x^2) \dfrac{1}{1 + {\mathrm e}^{x^2\sin(x)}}\,{\mathrm d}x = \int_0^a f(x^2) \,{\mathrm d}x$
Above we had
$\int_{-\pi}^\pi\, x^{2n} \left(\dfrac{2}{1 + {\mathrm e}^{\sin(x)}}\right){\mathrm d}x = \int_{-\pi}^\pi x^{2n} \,{\mathrm d}x$
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment