14
$\begingroup$

Being fascinated by the approximation $$\sin(x) \simeq \frac{16 (\pi -x) x}{5 \pi ^2-4 (\pi -x) x}\qquad (0\leq x\leq\pi)$$ proposed, more than 1400 years ago by Mahabhaskariya of Bhaskara I (a seventh-century Indian mathematician) (see here), I considered the function $$\sin \left(\frac{1}{2} \left(\pi -\sqrt{\pi ^2-4 y}\right)\right)$$ which I expanded as a Taylor series around $y=0$. This gives $$\sin \left(\frac{1}{2} \left(\pi -\sqrt{\pi ^2-4 y}\right)\right)=\frac{y}{\pi }+\frac{y^2}{\pi ^3}+\left(\frac{2}{\pi ^5}-\frac{1}{6 \pi ^3}\right) y^3+O\left(y^4\right)$$ Now, I made (and may be, this is not allowed) $y=(\pi-x)x$. Replacing, I obtain $$\sin(x)=\frac{(\pi -x) x}{\pi }+\frac{(\pi -x)^2 x^2}{\pi ^3}+\left(\frac{2}{\pi ^5}-\frac{1}{6 \pi ^3}\right) (\pi -x)^3 x^3+\cdots$$ I did not add the $O\left(.\right)$ on purpose since not feeeling very comfortable.

What is really beautiful is that the last expansion matches almost exactly the function $\sin(x)$ for the considered range $(0\leq x\leq\pi)$ and it can be very useful for easy and simple approximate evaluations of definite integrals such as$$I_a(x)=\int_0^x \frac{\sin(t)}{t^a}\,dt$$ under the conditions $(0\leq x\leq \pi)$ and $a<2$.

I could do the same with the simplest Padé approximant and obtain $$\sin(x)\approx \frac{(\pi -x) x}{\pi \left(1-\frac{(\pi -x) x}{\pi ^2}\right)}=\frac{5\pi(\pi -x) x}{5\pi ^2-5(\pi -x) x}$$ which, for sure, is far to be as good as the magnificent approximation given at the beginning of the post but which is not very very bad (except around $x=\frac \pi 2$).

The problem is that I am not sure that I have the right of doing things like that.

I would greatly appreciate if you could tell me what I am doing wrong and/or illegal using such an approach.

Edit

After robjohn's answer and recommendations, I improved the approximation writing as an approximant $$f_n(x)=\sum_{i=1}^n a_i \big(\pi-x)x\big)^i$$ and minimized $$S_n=\int_0^\pi\big(\sin(x)-f_n(x)\big)^2$$ with respect to the $a_i$'s.

What is obtained is $$a_1=\frac{60480 \left(4290-484 \pi ^2+5 \pi ^4\right)}{\pi ^9} \approx 0.31838690$$ $$a_2=-\frac{166320 \left(18720-2104 \pi ^2+21 \pi ^4\right)}{\pi ^{11}}\approx 0.03208100$$ $$a_3=\frac{720720 \left(11880-1332 \pi ^2+13 \pi ^4\right)}{\pi ^{13}}\approx 0.00127113$$ These values are not very far from those given by Taylor ($\approx 0.31830989$), ($\approx 0.03225153$), ($\approx 0.00116027$) but, as shown below, they change very drastically the results.

The errors oscillate above and below the zero line and, for the considered range, are all smaller than $10^{-5}$.

After minimization, $S_3\approx 8.67\times 10^{-11}$ while, for the above Taylor series, it was $\approx 6.36\times 10^{-7}$.

$\endgroup$
  • 1
    $\begingroup$ The one concern I might have here is that $y=(\pi-x)x$ is not bijective over the range $0 \leq x \leq \pi$. On the other hand, $\sin(x)$ actually only depends on $y$ on this range, because of symmetry. So it seems legitimate to me. $\endgroup$ – Ian Mar 27 '16 at 14:03
  • $\begingroup$ @Ian. I have the same concern from the very beginning. But, if legimate, it is quite amazing, don't you think ? If you want fun, have a look to $I_1(x)$ over the whole range. $\endgroup$ – Claude Leibovici Mar 27 '16 at 14:06
4
$\begingroup$

A few approximations

When making approximations, there is no legal or illegal. There are things that work better and things that don't. When making approximations that are supposed to work over a large range of values, often the plain Taylor series is not the best way to go. Instead, a polynomial or rational function that matches the function at a number of points is better. $$ \frac{\pi(\pi-x)x}{\pi^2-\left(4-\pi\right)(\pi-x)x}\tag{1} $$ matches the values and slopes of $\sin(x)$ at $0$, $\frac\pi2$, and $\pi$. However, it is always low.

enter image description here

If instead, we match the values at $0$, $\frac\pi6$,$\frac\pi2$, $\frac{5\pi}6$, and $\pi$ we get Mahabhaskariya's approximation $$ \frac{16(\pi-x)x}{5\pi^2-4(\pi-x)x}\tag{2} $$ which is both high and low, and the maximal error is about $\frac13$ of the one-sided error.

enter image description here

A good quadratic polynomial approximation also matches the values at $0$, $\frac\pi6$,$\frac\pi2$, $\frac{5\pi}6$, and $\pi$ $$ \frac{31}{10\pi^2}(\pi-x)x+\frac{18}{5\pi^4}(\pi-x)^2x^2\tag{3} $$ enter image description here

The maximal error is about $\frac23$ that of Mahabhaskariya's.

If we want to extend to a cubic polynomial, we can try to match values at $0$, $\frac\pi6$, $\frac\pi4$, $\frac\pi2$ $$ \tfrac{9711-6400\sqrt2}{210\pi^2}(\pi-x)x+\tfrac{-7194+5120\sqrt2}{15\pi^4}(\pi-x)^2x^2+\tfrac{43488-30720\sqrt2}{35\pi^6}(\pi-x)^3x^3\tag{4} $$ enter image description here

The maximum error of approximation $(4)$ is about $\frac1{40}$ that of approximation $(3)$.


Analysis of the functions in the question

The function $$ \frac{\pi(\pi-x)x}{\pi^2-(\pi-x)x}\tag{5} $$ has a maximum error about $40\times$ as big as $(3)$

enter image description here

The function $$ \frac{(\pi-x)x}\pi+\frac{(\pi-x)^2x^2}{\pi^3}+\left(\frac2{\pi^5}-\frac1{6\pi^3}\right)(\pi-x)^3x^3\tag{6} $$ has $30\times$ the maximum error of $(4)$. However, the coefficients of $(6)$ are more appealing.

enter image description here

$\endgroup$
  • $\begingroup$ I agree. My problem is that I started solving for $x$ $(\pi-x)x=y$ and tehn made the Taylor expansion of $\sin \left(\frac{1}{2} \left(\pi -\sqrt{\pi ^2-4 y}\right)\right)$ and then changed again in the resulting expression $y$ by $(\pi-x)x$. Is this kind of gymnastics allowed from a purely mathematical point of view ? $\endgroup$ – Claude Leibovici Mar 27 '16 at 14:50
  • 1
    $\begingroup$ As I said, there is no right or wrong when making approximations. You are not claiming that things are supposed to converge, just that this is close; how close tells how good the approximation is. $\endgroup$ – robjohn Mar 27 '16 at 15:49
  • $\begingroup$ I am unable to make good plots since I do not see them (I am almost blind). My wife told me that the ones you added are very clear and explicit. Would you mind to add, for illustration purposes, the one corresponding to $$\sin(x)=\frac{(\pi -x) x}{\pi }+\frac{(\pi -x)^2 x^2}{\pi ^3}+\left(\frac{2}{\pi ^5}-\frac{1}{6 \pi ^3}\right) (\pi -x)^3 x^3$$. Thank you ! $\endgroup$ – Claude Leibovici Mar 27 '16 at 16:23
  • $\begingroup$ Thank you very much. I added some information about what was my next step. $\endgroup$ – Claude Leibovici Mar 28 '16 at 8:15
  • $\begingroup$ Thanks for the idea ! What is nice is that, using your last formula, $S$ comes to be $\approx 3.35\times 10^{-10}$ that is to say half of what I obtained after optimization. $\endgroup$ – Claude Leibovici Mar 29 '16 at 8:46
1
$\begingroup$

@Claude Leibivici use the following two point Taylor series in x=-Pi, Pi $$\frac{z (z-\pi )^3 (z+\pi )^3}{48 \pi ^4}-\frac{5 z (z-\pi )^3 (z+\pi )^3}{16 \pi ^6}+\frac{3 z (z-\pi )^2 (z+\pi )^2}{8 \pi ^4}-\frac{z (z-\pi ) (z+\pi )}{2 \pi ^2}$$ the cuadratic error is superior to any formula above at the same grade

$\endgroup$
  • $\begingroup$ Very interesting ! I suppose typo's : I presume that the first term is $\frac{z (z-\pi )^4 (z+\pi )^4}{48 \pi ^8}$. Is this correct ? $\endgroup$ – Claude Leibovici Apr 13 '18 at 10:33
  • $\begingroup$ No is raise Power 4 $\endgroup$ – Clerk Apr 13 '18 at 10:40
  • $\begingroup$ Just out of curiosity : do you know any CAS doing two point Taylor series ? $\endgroup$ – Claude Leibovici Apr 13 '18 at 11:14
  • $\begingroup$ what it is mean CAS $\endgroup$ – Clerk Apr 13 '18 at 11:16
  • $\begingroup$ Computer Algebra System (such as Mahematica, Wolfram Alpha, ...) $\endgroup$ – Claude Leibovici Apr 13 '18 at 11:18

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.