How to evaluate $\int \frac{dx}{\sin(\ln(x))}$?

By Euler's formula,

$$\sin(\ln(x))=\frac{e^{i\ln(x)}-e^{-i\ln(x)}}{2i}=\frac{x^i-x^{-i}}{2i}$$

In the integral, this works out to give us

$$\int\frac{\mathrm dx}{\sin(\ln(x))}=\int\frac{2i~\mathrm dx}{x^i-x^{-i}}=2i\int\frac{x^i~\mathrm dx}{x^{2i}-1}=-2i\int\frac{x^i~\mathrm dx}{1-x^{2i}}$$

By expanding with geometric series, this then becomes

$$\int\frac{x^i~\mathrm dx}{1-x^{2i}}=\sum_{k=0}^\infty\int x^{(2k+1)i}~\mathrm dx=\sum_{k=0}^\infty\frac{x^{1+(2k+1)i}}{1+(2k+1)i}$$

Observe that the ratio of consecutive terms in this series is given by

$$\frac{x^{1+(2k+3)i}/(1+(2k+3)i)}{x^{1+(2k+1)i}/(1+(2k+1)i)}=\frac{(2k+1)i+1}{(2k+3)i+1}x^{2i}=\frac{(k+\color{#3377cc}{\frac{1+i}2})(k+\color{#3377cc}1)}{k+\color{#339999}{\frac{1+3i}2}}\frac{\color{#dd3333}{x^{2i}}}{k+1}$$

which implies the series is a hypergeometric function:

$$\sum_{k=0}^\infty\frac{x^{1+(2k+1)i}}{1+(2k+1)i}=x^{1+i}{}_2F_1\left(\color{#3377cc}{\frac{1+i}2},\color{#3377cc}1;\color{#339999}{\frac{1+3i}2};\color{#dd3333}{x^{2i}}\right)$$

and altogether,

$$\int\frac{\mathrm dx}{\sin(\ln(x))}=-2ix^{1+i}{}_2F_1\left(\frac{1+i}2,1;\frac{1+3i}2;x^{2i}\right)\color{#999999}{{}+C}$$

which likely cannot be simplified further, though can be rewritten using various hypergeometric identities.


Note: The above manipulations require that the series converges, but the end results in terms of hypergeometric functions hold everywhere they both exist, as they are defined through the use of analytic continuation.


To avoid hypergeometric functions use the partial fraction decomposition:

$$\frac{1}{\sin x} = \frac{1}{x} + \sum\limits _{n=1} ^{\infty}(-1)^n \left (\frac{1}{x-n\pi}-\frac{1}{x+n\pi}\right ), $$

replace $x$ with $\ln x$ and use

$$\int\frac{dx}{\ln x \pm n\pi}=e^{\mp n\pi}\text{Ei}(x\pm n\pi)+\text{const}$$

where $\text{Ei}(x)=-\int_{-x}^{\infty}\frac{e^{-t}dt}{t}$ is the so called exponential integral


Change variables $y=\sin x$ to convert this to the indefinite integral $$ \int\frac{e^y}{\sin y}\;dy . $$

This is not an elementary function.
Reference: 2.665 in

Gradshteyn, I. S.; Ryzhik, I. M.; Zwillinger, Daniel (ed.); Moll, Victor (ed.), Table of integrals, series, and products. Translated from the Russian. Translation edited and with a preface by Victor Moll and Daniel Zwillinger, Amsterdam: Elsevier/Academic Press (ISBN 978-0-12-384933-5/hbk; 978-0-12-384934-2/ebook). xlv, 1133 p. (2015). ZBL1300.65001.