1
$\begingroup$

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

$\endgroup$
5
  • $\begingroup$ The "function" you defined is not sine integral. It is a constant equal to $\pi/2$. $\endgroup$ – user Apr 26 '20 at 14:15
  • $\begingroup$ Oops, thanks, I corrected the Sine Integral function. Wolfram Alpha uses $Si$ as the sine integral. How do I calculate it when I don't have a $Si$ function available to me, as in mathjs? $\endgroup$ – dataphile Apr 26 '20 at 14:38
  • $\begingroup$ What is the equation you want to solve? $\endgroup$ – user Apr 26 '20 at 15:21
  • $\begingroup$ I just wanted to know what the integral of $sin(1/x)$ looked like, then $Si$ popped up. I have since found out that $Si$ involves the Taylor series, so computers estimate rather than calculate it. $\endgroup$ – dataphile Apr 26 '20 at 15:45
  • $\begingroup$ This is why it is a special function. $\endgroup$ – Claude Leibovici Apr 28 '20 at 7:45
1
$\begingroup$

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}$.

$\endgroup$
1
$\begingroup$

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.

$\endgroup$
1
  • $\begingroup$ wow, thanks, I'll start using the SciJS library. I've been checking out ObservableHG as well, great stuff. I need arbitrary precision so would probably have to do some trickery with $e^{i\pi}$ $\endgroup$ – dataphile Apr 28 '20 at 9:30
0
$\begingroup$

Computers estimate $Si$ rather than calculate it.

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

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.