How do I calculate the sine integral for a specific input?

1.1k Views Asked by At

I need to solve an equation containing the Sine Integral $\mathrm{Si}\left(\frac{2 k \pi}{x}\right)$ in mathjs which doesn't have the $\mathrm{Si}$ function. Is there another way to represent this?

If $$ \mathrm{Si}\left(z\right) = \int_{0}^{z}{\frac{\sin{t}}{t}\,\mathrm{d}t} $$

How do I actually calculate $\mathrm{Si}\left(…\right)$. It seems like I have to find a way to integrate $z$ every time I see $\mathrm{Si}\left(z\right)$ but calculators and computers wouldn't do that if $\mathrm{Si}\left(z\right)$ is a known function?

See : https://www.wolframalpha.com/input/?i=integrate+sin%5E2%281+%2F+x%29

3

There are 3 best solutions below

0
On BEST ANSWER

If you want to compute $$\begin{align} \operatorname{Si}(x) &= \int_0^x \frac{\sin t}t dt , \end{align}$$ for $0\leq x \leq \pi$, you could use the magnificent approximation $$\sin(t) \sim \frac{16 (\pi -t) t}{5 \pi ^2-4 (\pi -t) t}\qquad (0\leq t\leq\pi)$$ proposed, more than $\color{red}{1400}$ years ado by Mahabhaskariya of Bhaskara I, a seventh-century Indian mathematician.

If you think about it, it is a kind of Padé approximant.

As a result, this will give the simple $$\operatorname{Si}(x)\sim -2 \left(\log \left(\frac{4 x^2}{5 \pi ^2}-\frac{4 x}{5 \pi }+1\right)+\tan ^{-1}\left(\frac{4 x}{2 x-5 \pi }\right)\right) $$ which shows a maximum absolute error of $0.00367$ and a maximum relative error of $1.86$%.

Much better would be the $[7,6]$ Padé approximant which I shall write as $$\operatorname{Si}(x)\sim x \,\frac{1+\sum _{i=1}^3 a_i\,x^{2 i} } {1+\sum _{i=1}^3b_i\,x^{2 i} }$$ where the $a_i$'s and $b_i$'s are respectively $$\left\{-\frac{13524601565}{379956015036},\frac{567252710471}{766244630322600},- \frac{35803984658017}{8109933167334398400}\right\}$$ $$\left\{\frac{842673993}{42217335004},\frac{1864994705}{10216595070968},\frac{532 2538193}{6620353605987264}\right\}$$ which gives a maximum absolute error of $5.21 \times 10^{-7}$.

0
On

Computers estimate $Si$ rather than calculate it.

https://en.wikipedia.org/wiki/Trigonometric_integral#Efficient_evaluation

1
On

As you answered yourself, the sine integral can computed efficiently using Pade approximation - a common tool in numerical analysis.

If you've got a decent numerical integrator, then you can compute it directly from the definition as well. The focus of the MathJS Javascript library that you refer to, though, is not really numeric computation but basic symbolic representation. I recommend that you check out the adaptive Simpson integrator from the SciJS library.

Here's an implementation of the Sine Integral on Observable that I used to generate the following plot:

enter image description here

Note that it agrees quite well with WolframAlpha's plot.