3
$\begingroup$

In my knowledge the best aproximation of$\sin$ and$\cos$ is Bhaskara approximation which is :$$\sin(x) \simeq \frac{16 (\pi -x) x}{5 \pi ^2-4 (\pi -x) x}\qquad (0\leq x\leq\pi)$$and$$\cos(x) \simeq\frac{\pi ^2-4x^2}{\pi ^2+x^2}\qquad (-\frac \pi 2 \leq x\leq\frac \pi 2)$$

what is the best approximation of$\cos(x)$ for$ -\pi\leq x\leq 0$ (by a regular function ) ?

askedOct 29, 2020 at 18:33
Bernstein's user avatar
$\endgroup$
5
  • 5
    $\begingroup$Best under what restrictions? You can certainly do better than these approximations by more complicated functions. (For example, you could take more and more terms of the Taylor series.)$\endgroup$CommentedOct 29, 2020 at 18:37
  • $\begingroup$I think the Taylor series is a local approximation of a function, and cannot be applied to approximate $\sin$ in an interval of length $\pi$$\endgroup$CommentedOct 29, 2020 at 19:11
  • $\begingroup$It's an approximation that'sbest closest to the point you use to define the Taylor series. You can apply it to approximate $\sin$ on any range, it will just not be as good, which you can compensate for by taking more terms.$\endgroup$CommentedOct 29, 2020 at 20:17
  • $\begingroup$Thanks @MishaLavrov yes you are right but what I am looking for is an approximation of this function on the hull interval$\endgroup$CommentedOct 29, 2020 at 20:55
  • 1
    $\begingroup$And what I am telling you is that the Taylor serieswill give that to you. It takes some sufficient number of terms; for example, to beat the Bhaskara approximation of $\sin x$ on $[0,\pi]$, we need to go out to the $-\frac{x^{11}}{11!}$ term. But at that point, the Taylor approximation is nearly four times as good, and you can keep making it better.$\endgroup$CommentedOct 29, 2020 at 21:05

3 Answers3

3
$\begingroup$

In terms of approximation, you can do a lot of things depending on how many terms you want to include in the expression. Most of the time, this is done using Padé approximants.

For example, for your question, using the simple$[3,2]$ Padé approximant built around$x=-\frac \pi 2$, we get$$\cos(x)=\left(x+\frac{\pi }{2}\right)\frac {1-\frac{7}{60} \left(x+\frac{\pi }{2}\right)^2 } {1+\frac{1}{20}\left(x+\frac{\pi }{2}\right)^2 }$$ which leads to an absolute error of$0.0042$ at the bounds.

For sure, you could go further and use the$[5,4]$ Padé approximant$$\cos(x)=\left(x+\frac{\pi }{2}\right)\frac {1-\frac{53}{396} \left(x+\frac{\pi }{2}\right)^2+\frac{551 }{166320}\left(x+\frac{\pi }{2}\right)^4 } {1+\frac{13}{396} \left(x+\frac{\pi }{2}\right)^2+\frac{5 }{11088}\left(x+\frac{\pi }{2}\right)^4 }$$ which leads to an absolute error of$3.0\times 10^{-6}$ at the bounds. This is equivalent to the Taylor series to$O\left(\left(x+\frac{\pi }{2}\right)^{11}\right)$.

To give you an idea of the possible improvements; consider that$P_n$ is the$[2n+1,2n]$ Padé approximant of$\cos(x)$ built around$x=-\frac{\pi }{2}$ and compute the norm$$\Phi_n=\int_{-\pi}^0 \big[\cos(x)-P_n\big]^2\,dx$$

$$\left(\begin{array}{cc} n & \Phi_n \\ 1 & 3.92 \times 10^{-6} \\ 2 & 1.26 \times 10^{-12}\\ 3 & 2.23 \times 10^{-20}\end{array}\right)$$

All of these have been done only based on the information (function and derivative values) at$x=-\frac{\pi}{2}$.

But we can try to cover the whole range and consider for example$$\cos(x) \sim \left(x+\frac{\pi }{2}\right)\frac {1+a \left(x+\frac{\pi }{2}\right)^2+b\left(x+\frac{\pi }{2}\right)^4 } {1+c \left(x+\frac{\pi }{2}\right)^2+d\left(x+\frac{\pi }{2}\right)^4 }$$ and obtain

$$a=\frac{-1952+672 \pi -192 \pi ^2+56 \pi ^3}{\pi ^3(\pi ^2-10)}$$$$b=\frac{-3456+1056 \pi +768 \pi ^2-240 \pi ^3 } {\pi ^5 \left(\pi ^2-10\right) }$$$$c=\frac{-192+72 \pi -104 \pi ^2+32 \pi ^3 } {\pi ^2 \left(\pi ^2-10\right) } $$$$d=\frac{-4704+1504 \pi +400 \pi ^2-128 \pi ^3} {\pi ^4 \left(\pi ^2-10\right) }$$ which gives a maximum absolute error equal to$5.96\times 10^{-8}$ and a norm equal to$2.73\times 10^{-15}$ (which is$461$ times smaller than$\Phi_2$).

You could notice that the coefficients are extremely close to those of$P_2$ but these minor changes make a lot of difference.

All these approximations have been built for answering your question.

answeredOct 30, 2020 at 6:07
Claude Leibovici's user avatar
$\endgroup$
1
$\begingroup$

There is no such thing as a "best" approximation for a function, there are always minor tweaks you can make to produce better approximations.

However, to your question, you can massage the approximation you gave by noticing that$$-\pi\leq x\leq 0 \iff -\frac \pi2\leq x+\frac \pi2\leq \frac \pi2$$

answeredOct 29, 2020 at 18:43
Rhys Hughes's user avatar
$\endgroup$
1
  • $\begingroup$this dont give a good aprroximation speacialy in $-\pi$$\endgroup$CommentedOct 29, 2020 at 18:46
1
$\begingroup$

The approximation for$\sin(x)$ on$[-\pi/2, \pi/2]$ that fits Bhaskara’s spirit the best is

$$\frac{22 \pi^2 x - 24 x^3}{\pi (7 \pi^2 + 4 x^2)}.$$

It is exact for$\lvert x \rvert \in\{0, \pi/6, \pi/2\}$ and its derivative is zero at the end points. Shift left over$\pi/2$ to get an approximation of$\cos(x)$ on$[-\pi, 0]$.

This is a better approximation in terms of maximum absolute error than Padé’s of the same degree. (Remez’ algorithm can find an even better one. See section 6 ofthis exposition.) Scaling to the interval$[-1,1]$ gives the nicer looking approximation$$\frac{11 x - 3 x^3}{7 + x^2} \approx \sin \left(\tfrac{\pi}2 x\right).$$

answeredOct 29, 2020 at 20:04
WimC's user avatar
$\endgroup$

You mustlog in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.