Applying Computer Algebra Systems in Approximating the Trigonometric Functions

: We propose numerical algorithms which can be integrated with modern computer algebra systems in a way that is easily implemented to approximate the sine and cosine functions with an arbitrary accuracy. Our approach is based on Taylor’s expansion about a point having a form of kp , k ∈ Z and p = π /2, and being chosen such that it is closest to the argument. A full error analysis, which takes advantage of current computer algebra systems in approximating π with a very high accuracy, of our proposed methods is provided. A numerical integration application is performed to demonstrate the use of algorithms. Numerical and graphical results are implemented by MAPLE.


Introduction
It is an undoubted fact that the design of more reliable and accurate algorithms to compute the approximate values to the sine and cosine functions is one of the most fascinating topics of the constructive approximation of functions.This is clearly motivated by numerous applications of these trigonometric functions ranging from mathematics, physics to engineering.
The use of polynomial approximations plays a key role in computing values of the sine and cosine functions, as well as other elementary functions.The most commonly used polynomials are Taylor, Chebyshev, and Remez.Let us briefly mention an early historical fact related to approximating the trigonometric functions.That is the formula proposed by Bhaskara in the 7th century: which is now explained clearly and logically (see [1]).The explanation is based on the view of interpolation by polynomials and rational functions.For these days, with a rapid development of technology and computer science, there has been great effort to build hardware and software algorithms for evaluating values of the elementary functions, especially the trigonometric functions, to meet an essential need in scientific computations, signal processing, telecommunication and computer graphics [2].Among these algorithms is the most important and fundamental one called the CORDIC algorithm.The name CORDIC is an acronym for Coordinate Rotation Digital Computer.This is a computing technique for solving the trigonometric relations that consist of plane coordinate rotation, Cartesian and polar coordinates.Details on CORDIC and developments on algorithms for evaluating elementary functions can be found in the excellent monograph by Muller [3] Chapter 7, and also [4][5][6][7][8].
It is worth mentioning that the desirable accuracy of computed transcendental functions mainly depends on the demand of users and/or practical scientific use.On the one hand, it would usually suffice to numerically solve real-world problems with an accuracy to machine precision.This is the reason that the majority of present computing software programs such as MATLAB, and its Chebfun software package, developed by Trefethen and his team [9], aims to support.On the other hand, there has always been an imperative need to seek for simpler and more efficient algorithms with higher accuracy as the interest in improving scientific calculation method itself or from other sources of practical demand.This is purely our intention when writing the present article.The design and development of our algorithms stem from the fact that we are able to easily work with higher-degree polynomials (even degrees of thousands or millions [10] Chapter 1) due to the increasing complexity of computer applications.
The goals of this paper are twofold.Firstly, we present an algorithm that gives pointwise approximate values of the sine and cosine functions at any rational angle with a desired precision.Secondly, our biggest contribution to novelty is the piecewise approximation procedure with an arbitrary small absolute error applied to these trigonometric functions.To this end, we introduce a special partition that can take the advantage of dividing an interval [a, b] into appropriate subintervals for the approximation process.Our construction is merely based on the lookup table-like storage of approximate values of Pi (the number π).In some computer algebra systems, we can do this with built-in commands such as evalf[n](Pi) from MAPLE, vpa(pi,n) from MATLAB and N[Pi,n] from MATHEMATICA.
In principle, approximating the value f (x) = sin x by the Taylor polynomial of order n at a point x 0 as is meaningful when the point x 0 satisfies |x − x 0 | < 1 and all the coefficients f (m) (x 0 ) can be explicitly calculated.Such a point can be chosen as kp, where k ∈ Z and p = π/2.We will choose k to get the inequality even better |x − x 0 | < 0.8.Because we only have rational approximate values of p, this challenges us with several practical questions to be solved: how to evaluate errors arising from replacing p with its approximate value p and how to keep f (m) (x 0 ) unchanged with this change of value of p? In addition, we also need an efficient mechanism to access rational approximate values of p more enough to reach an acceptable or desired precision.Fortunately, more and more precise values of Pi have been updated from the projects of computation of special numbers (see [11], for instance), and these values are now supplied conveniently and efficiently for use by present computer algebra systems.The current record of the longest decimal number computed for Pi has been 13.3 trillion digits (date announced: 8 October 2014), held by an anonymous programmer known online as "houkouonch", and will be certainly broken later.The paper is organized as follows.In Section 2, we define the steps to obtain Taylor polynomials for approximating values of the sine function with an absolute error less than a given tolerance.We then, in Section 3, provide appropriate regulations to show that it is possible to keep coefficients of the approximate Taylor polynomials unchanged when p = π/2 is replaced with its approximate value p .The error analysis is presented in the same section in which the properties of special functions Gamma and Modified Bessel are used.We arrive at our algorithms for pointwise approximating values of the sine and cosine functions, and for piecewise approximating on any interval [a, b] in Sections 4 and 5.
To demonstrate the performance of our methods, Section 6 is devoted to an application of numerical integration.Finally, some concluding remarks are discussed in the last section.For our purpose, we use MAPLE to implement our algorithms, and demonstrate numerical and graphical results.

Formulation
Recall that the function f (x) = sin x is periodic with period 2π, differentiable of any order, and for each k 0 ∈ Z and m = 0, 1, . .., we have Given a number x, we can choose an integer k such that kπ/2 ≤ x < (k + 1)π/2, which is k = x/p (here, we denote π/2 by p, for brevity, and z is the integral part of a number z).Now, we determine k 0 ∈ Z by an if-then statement: if x/p − x/p < 1/2, then k 0 = x/p , else k 0 = x/p + 1.In both cases, we have |x − x 0 | ≤ π/4 with x 0 = k 0 p.From the choice of x 0 , if P n is the Taylor polynomial at this point, we always have that Therefore, for a given number r ∈ N, to find the degree of P n such that we only need to determine n ∈ N satisfying Note that the Taylor polynomial which depends on x, only contains the values of m such that m = 2k + 1 − k 0 due to (1).Since 0 ≤ m ≤ n, k takes all integral values satisfying Then we derive P n (x) for the approximation f (x) ≈ P n (x) from the following cases: . Thus, we can write 2.
If k 0 is even, we put /2 , and we have (5)

Regulation
In practice, we are only provided with approximate values of p = π/2.Assume that such a value is p and let σ = |p − p |.If |x| < 0.8, we use the formula (5) with k 0 = k 1 = 0 and we have the approximation sin x ≈ P n (x) with the accuracy of 1/10 r , where n is determined from (2).Therefore, we consider from this point on any rational number x such that |x| ≥ 0.8 and we then have that For an initial setting, we assume that σ satisfies for a given r ∈ N.
Because the formulas (4) and ( 5) depend on the distance between x/p and x/p according to the choice of k 0 , we need to choose p so that k 0 will not change its values.This can be attained when x/p = x/p or equivalently is satisfied if and only if Since pp > 2.4, we then have (8) if σ simultaneously satisfies the following inequalities Before proceeding any further, we emphasize here that we can set p as the approximate value of p with the accuracy up to m + 3 significant digits when σ < 1/10 m to prevent inexactitude from rounding-off rules.Such an approximate value of p can be declared by, for instance, evalf[m+3](Pi/2) in MAPLE.As a convention, when the output m has been found for σ to satisfy σ < 1/10 m , we then set p with evalf[m + 3](p).
Finally, we recall here the cases of choosing k 0 and assume some supplementary requirements for σ to make k 0 unchanged when replacing p with p .If x/p − x/p < 1/2 and due to and we then choose k 0 = x/p in this case.Similarly, if x/p − x/p > 1/2, then we also have and we choose k 0 = x/p + 1.In particular, if x/p − x/p = 1/2, then we also choose k 0 = x/p and note that ( 9) and (10) are obviously satisfied in this case.
Let us take an important notice that: (11) implies (10), and ( 12) implies (9).Thus, to find an appropriate value of p and then choose k 0 , we first require σ < 1/10 m by determining a number m ∈ N such that 1 10 m ≤ Then, p can be chosen to satisfy simultaneously ( 9) and ( 11), which is or ( 10) and ( 12), which is depending on x/p − x/p < 1/2 or x/p − x/p > 1/2, respectively.To prove the existence of such a p , we need some results from the notion of sequence limit.This result is an important basis of our approximation algorithm.Supposing that we have found m = m 0 satisfying ( 13), then we choose p 0 = evalf[m 0 + 3](p) and let t 0 = x/p 0 − x/p 0 .Letting an index i take its initial value i := 0. If t i = 1/2, then we choose k 0 = x/p i ; otherwise, we consider the following process.To choose σ that satisfies simultaneously ( 6), ( 9), ( 11) or ( 6), ( 10), (12), from ( 14) or ( 15), we check If both ( 16) and (17) could not occur, we go to the next step by setting m i+1 = m i + 1, p i+1 = evalf[m i+1 + 3](p) and t i+1 = x/p i+1 − x/p i+1 .Then, we check again ( 16) and ( 17), but with m i+1 and t i+1 for this time.Continuing this process, we go to the following conclusion: 1.
One of either ( 16) and ( 17) first occurs at some step k, and assume it is (16).Hence, we have 0 < t k = x/p k − x/p k < 1/2 (and also x/p − x/p < 1/2).Then we choose k 0 = x/p k (= x/p ).Similarly, we have 1/2 < t k = x/p k − x/p k (and also x/p − x/p > 1/2) and we choose Both of ( 16) and (17) could not occur at any step.Then, we obtain the infinite sequences Now, we show the second item of the conclusion cannot be true.Because p i → p, then x/p i → x/p, i → ∞.Since x/p < x/p < x/p + 1, there exists an integer i 0 such that x/p < x/p i < x/p + 1 for all i ≥ i 0 , hence x/p i = x/p for all i ≥ i 0 .Therefore, hence the left side of the inequality (18) leads to ∞ as i → ∞, and this is a contradiction.If x/p − x/p > 0.5, by a similar argument, we also derive a contradiction from (19).
There is one more question that should be considered explicitly.What is the maximum value of k that we may access in the calling sequence evalf[m 0 + 3 + k](p)?We provide here an analysis of this possibility.We set on the intervals (0, 0.5) and (0.5, 1) the functions f (t) and g(t), respectively, such that and Then, we define as 0.5 < t < 1.
and give its graph in Figure 1.Now, reaching (16) or (17) at the step k can be expressed as Because |x|/10 m 0 ≤ 1/10 r+2 , we can attain this when Taking integral values from 0, 1, . .., the variable k makes the value of the right side of (20) increase very fast, whereas the positive values of M(t k ) slightly change when k increases.We also have the estimate for all t, t ∈ (0, 0.5) ∪ (0.5, 1).Thus, the minimum value of m k = m 0 + k satisfying ( 16) or ( 17) is governed by m 0 .In practice, since |x| and r are not too large, we may always determine such a value of m k .On the other hand, if we find a sequence of rational numbers {q n } converging to p = π/2 and a strictly increasing sequence of natural numbers {m n } such that we can determine k 0 , following the above steps without using the command evalf (or other equivalent commands).
According to the choice of k 0 , we always have |x − k 0 p | ≤ p /2 < 0.8.Now, we check that for all choices of k 0 .In the cases of x/p − x/p < 1/2 or x/p − x/p > 1/2, we also have x/p − x/p < 1/2 or x/p − x/p > 1/2 and easily check that |x/p − k 0 | < 1/2 or |x − k 0 p| < p/2 < 0.8.In the case x/p − x/p = 1/2, since (6), ( 9) and ( 10) are all satisfied, we have x/p = x/p and need to check (21) directly.Indeed, we can write We formalize the above discussion by the following lemma.
Lemma 1.For every rational number x, there exists an integer k 0 and a rational approximation p of p = π/2 such that x/p = x/p , and k 0 = x/p or k 0 = x/p + 1, depending on x/p − x/p ≤ 1/2 or x/p − x/p > 1/2, respectively.Moreover, the Taylor polynomial P n of the sine function at x 0 = k 0 p can give the approximation sin x ≈ P n (x) with the accuracy up to 1/10 r , where r is a given positive integer and the degree of P n is determined by (2).
In practice, since we cannot use P n from ( 4) or (5) to approximate the value of the sine function at x, we replace P n with P c n instead.Such a changed polynomial can be either depending on k 0 odd or even, respectively.Because |x − k 0 p| < 0.8, we derive the estimate | sin x − P n (x)| ≤ δ from (2).Now, we need to estimate δ = | sin x − P c n (x)|, which we shall call the practical error.
Firstly, we choose the polynomial (22) and try to make an estimate for (24) can be written as hence we obtain the estimate Letting |k 0 |σ = β, from ( 21) and (25), we derive To estimate the sum in (26), we will use inequalities related to factorial numbers, so we need some properties of the generalized factorial function, the Gamma function: Γ(z) has been proven to be a log-convex function on the interval (0, ∞); thus, for y, z ∈ (0, ∞) we have (see [12] Section 2).In addition, for a non-negative integer n, we have Γ(n + 1) = n!, and for (28) From ( 26) and (28), we can write due to 1 − (β/0.8)2m < 1.
To obtain the desired estimate of δ , we use an approximate value of the Modified Bessel function of the First kind according to the approximation formula in ([13] Section 3).Moreover, we have the estimate that we now check only for x > 0.8.Indeed, if These estimates for |k 0 /x| lead to Finally, from (28), we derive Similarly, if the polynomial (23) has been chosen, we are led to the estimate In this case, applying (27), we obtain the inequality To estimate the right-hand side of (31), we use an appropriate inequality of Lazarević and Lupaş in ( [12] p. 95-96), stated in the form of where z > (1 − µ)/2 and µ ∈ [0, 1].Applying (32) for z = m + 1 (m = 0, 1, . ..) and µ = 1/2, we easily obtain the inequality 1 Combining (30), (31) and (33), we finally get the desired estimate Thus, both of approximate polynomials ( 22) and (23) satisfy the same inequality for the practical error; that is Finally, for a real number x and its rational approximation x , we have the following estimation where P c n is obtained from P n , as indicated in Lemma 1, but for x instead.If r is replaced with r + 1 in (2) and ( 6), and |x − x | < 1/10 r+1 , then | sin x − P c n (x )| < 1/10 r .To sum up, we state our main result in this section by the following theorem.Theorem 1.Let x be a real number and x be a rational approximation of x such that |x − x | < 1/10 r+1 , where r is a given positive integer.Then, from Lemma 1 applied to x , there exists a polynomial P c n having the form of (22) or (23) that gives the approximation | sin x − P c n (x )| < 1/10 r .

Algorithm for Pointwise Polynomial Approximation
Given a rational number x and an integer h ≥ 2, we will construct an algorithm to evaluate the approximate value a of sin x so that δ = | sin x − a| is less than an arbitrarily small tolerance, and to display the result in the correct number h of significant digits.The first task can be completed by the steps in Algorithm 1, following the steps as indicated in Section 3, above Lemma 1.This algorithm can be converted into a MAPLE procedure called ApproxSine that takes the two arguments x and r.The output of ApproxSine(x,r) is a with δ < 1/10 r , r ≥ 1.This estimation for δ is obtained when r is replaced with r + 1 in (2) and (6).Before completing the second task, we note that the accuracy up to the r-th decimal digit after decimal point is in general quite different from r significant digits.For instance, if a = 0.123437 and b = 0.123415, then |a − b| < 1/10 4 and evalf [4](a) = evalf [4](b), but, if a = 0.0024217 and b = 0.002421, then evalf [6](a) = evalf [6](b), whereas |a − b| < 1/10 6 .Therefore, we should first count how many zero consecutive digits there are right after decimal point contained in the number a = ApproxSine(x,r), and assume that the number of such digits is k, which is a = 0. 00 In fact, the number k can be determined easily, for instance, by a simple while-do loop in MAPLE as follows: Then, the second task can be completed by displaying the output of ApproxSine(x,k + h + 1) in h significant digits, which is the calling evalf[h](ApproxSine(x,k + h + 1)).Now, we can make another MAPLE procedure named Sine to perform the second task when using ApproxSine as its local variable.The calling sequence Sine(x,h) returns an approximate value a of sin x such that the correct number of significant digits of a is equal to h.In the following, we present Algorithm 1 as a pseudo-code algorithm as : else a := (−1) k 0 /2 Similarly, for approximating values of the cosine function, we use the Taylor polynomial of g(y) = cos y: where x 0 = k 0 p and The integer k 0 is determined by the same way as the one in the previous sections and the index k satisfies due to 0 ≤ m ≤ n.Hence, depending on k 0 even or odd, g(x) = cos x is approximated by respectively.Then, we have a similar algorithm to evaluate approximate values of cos x and a corresponding MAPLE procedure Cosine taking the same arguments x and h.In the body of Cosine, ApproxSine becomes its local variable ApproxCosine when the variable a in ApproxSine (as a in Algorithm 1) is assigned to these corresponding values of Q n .Cosine also returns approximate values of the cosine function in a given correct number of significant digits.In practice, Q n (x) becomes Q c n (x) when p takes the position of p, and again we can check the estimate | cos x − Q c n (x)| < 1.1/10 r .As a convention, we will present all algorithms afterwards in a pseudo-code form and use corresponding MAPLE procedures with names to make calculations.Now, we implement our algorithms with some values of x and h, and the results of the calling sequences Sine(x,r) and Cosine(x,r) are given in Table 1.
Table 1.Some results from using the procedures Sine and Cosine.

Algorithm for Piecewise Polynomial Approximation
We recall here what is needed for initial settings to the piecewise approximation process.For a given number α, we find an integer k 0 such that the Taylor polynomial P n at k 0 p, p = π/2, can be used to approximate sin α with the accuracy of 1/10 r , where r is a given positive integer.Because we only get rational approximate values of p, we have found a way (as presented in previous sections) to determine such a value p , remaining the approximation sin α ≈ P c n (α) with the accuracy of 1/10 r , where P c n is obtained from P n by replacing p with p .In addition, we have proved that |α − k 0 p| < 0.8, or likewise |α − k 0 p | < 0.8 and with the accuracy of 1/10 r if we replace r with r + 1.This extension of our pointwise approximating result can be a starting point to construct a piecewise function F that approximates the sine function on an interval [a, b].
From most parts of Algorithm 1 (only without STEP 2), we can derive a simpler algorithm that results in three objects k, p and P c n (respectively, k 0 , p and a in Algorithm 1) from an input number α.For convenience, we will use the name FindPoint of a MAPLE procedure performing such an algorithm with one real argument, so its usage can be given in one of the forms: = p and FindPoint(α) [3] = P c n .Because the sine function is odd, we only need to find the function F on [a, b] with a ≥ 0. In the cases of 0 ≤ a < b ≤ 0.8 and 0 ≤ a < 0.8 < b, we may set F = F 0 on [a, b] and F = F 0 on [a, 0.8], respectively, where and n is determined by Algorithm 1.Therefore, it is sufficient to construct a piecewise approximate function F on [a, b] when 0.8 ≤ a < b.
On the other hand, from the choice of σ = |p − p | < 1/(|x|10 r+3 ) in Algorithm 1 to approximate sin x, we now change it to This choice is to guarantee the precision for our later construction of F.Moreover, it is easy to check that if α, β ∈ [a, b] are numbers such that [2], p = FindPoint(β) [2] then we have |α − kp | < 0.8 and |β − kp | < 0.8.Firstly, we put and and similarly, p 0 = FindPoint(a) [2] and The cases of k 0 = a/p 0 and k 0 = a/p 0 + 1 are illustrated in Figure 2.
The positions of a corresponding to k 0 = a/p 0 (left) or k 0 = a/p 0 + 1 (right).Now, we consider the case k 0 = n 0 (or even k 0 = n 0 + 1); then, we choose F = A 0 on [a, b] because |b − k 0 p 0 | < 0.8 as shown above for α, β.Next, we consider the case when k 0 < n 0 .We extend the approximation process to determine the next integer by setting k 1 = FindPoint((k 0 + 1)p 0 ) [1], and also If k 1 = n 0 , we then have cases that are illustrated in Figure 3.It is obvious that we can set F = A 0 on [a, (k 0 + 1 2 )p 0 ], regardless of k 0 = a/p 0 or k 0 = a/p 0 + 1.However, we will take different settings on the other intervals, depending on where b is from (k 0 + 1)p 0 .These settings can be given in the following: If k 1 < n 0 , we continue to put In the case of k 2 = n 0 , we have the following choice for F according to the different positions of b from (k Finally, continuing the above process, we obtain a finite sequence k 0 , k 1 , . . ., k n such that k i = k i−1 + 1 = FindPoint((k i−1 + 1)p i−1 ) [1], i = 1, . . ., n − 1, and k n = n 0 .Then, we also gain two sequences p i = FindPoint((k i−1 + 1)p i−1 ) [2] and A i = FindPoint((k i−1 + 1)p i−1 ) [3], i = 1, . . ., n.Before giving our settings for this general case, let us consider ending points of the approximate intervals by taking two consecutive nodes k i p i , k i+1 p i+1 .If we let x i = k i p i + p i /2, then we have To show the assertion of (39), we refer to (36) again and take the same arguments as above.
The inequality (39) explains why we can choose F on In short, by the setting (36), when k n = n 0 with n ≥ 3 (see Figure 4), we have constructed the piecewise function F that approximates the sine function on [a, b] (0.8 ≤ a < b) with the accuracy of 1/10 r .After getting the finite sequences {k i } n i=0 , {p i } n i=0 , {A i } n i=0 and the function B 0 defined as above, we choose F as follows: Although steps for construction of F have been presented, we give here an abbreviated algorithm, Algorithm 2, to specifically determine this function.
In Algorithm 2, the approximate Taylor polynomials A i are derived from Algorithm 1 and given here as depending on k i odd or even.The polynomial B 0 takes a similar expression, where k i p i is replaced with n 0 q 0 .or depending on k i even or odd, and B 0 with Note that the cosine function is even, so we should regulate appropriately the function F in Algorithm 2.

An Application of Numerical Integration
Suppose sin x is approximated by a polynomial P(x) with the accuracy up to 1/10 r on an interval [α, β].Then, we will find an estimation of the absolute error for sin s x and [P(x)] s with some natural number s.One of the possibilities to compute sin s x via sin ((n − k)x) is given in ([14] Lemma 1.3), but here we use our previously established results as follows.Firstly, we can write From this relation, we easily derive the estimate Now, applying (28), we obtain and relying on the inequality ( [15] p. 93), we imply Using ( 44), (45) and the formulas in [15], such as we attain the estimate Finally, from (43), (46) and the formula for the sum of a geometric progression, we derive the following estimate Thus, we have proven the result stated in the following lemma.
Lemma 2. Assume that f (x) = sin x is approximated by the polynomial P c n (x) on an interval [α, β] with the accuracy up to 1/10 r , derived from the Taylor polynomial P n (x) about kp, k ∈ Z and p = π/2, by replacing p with its rational approximation p , as constructed in the previous sections.Then, if Because the upper bound of |I − J| in (47) only depends on r, s, except the integral on the right side, we then easily imply the following theorem.
Based on Algorithm 2, we have established a procedure, say AppIntSin, to approximately compute the integral given in Theorem 2 with the desired accuracy.AppIntSin's arguments may take input values in order as for a, b, r, s and Q, and we can even choose the value for r to get the result satisfying a given tolerance.For instance, to have the estimate |I − J| < ε, a positive integral value for r may be chosen as to satisfy 10 r > 0.8 (2.

Conclusions
Motivated by the powerfulness and popular use of modern computer algebra systems in terms of its ease in programming and accessibility to the value of π with a very high accuracy, simple and easily-implemented algorithms have been designed to approximate the trigonometric functions with an arbitrary accuracy by a means of Taylor expansion.We have provided a careful analysis of the proposed approach with numerical illustrations.Nevertheless, our initial intention is not to compare or surpass other well-developed and well-established existing algorithms in the research literature; rather, we emphasize on the simplification of our methods as a computational application of CAS for which we highlight below:

•
Approximating values of the trigonometric functions by Taylor polynomials with an arbitrary accuracy, taking the form of 1/10 r , r ∈ N.

•
Using a so-called spreading technique to switch the process of pointwise approximating to that of piecewise approximating all over an arbitrary interval.

•
Performing only arithmetics on very small values of finite rational numbers.

•
Only using one command of CAS to access approximate values of π/2.
Our approximation method in Algorithm 2, utilizing the achievements of computing values of Pi with more and more exact significant digits and the power of current computer algebra systems, presents the special partition of an interval [a, b] with nodes k i p i 's, where k i ∈ Z and p i is an approximate value of π/2.This is a great advantage for local approximation to values of the sine (or cosine) function f on each definite interval because p i 's are all finite rational numbers.These nodes also play a role as adjoining centers of approximation, whereas the functional coefficients f (m) still take their normal values 0, ±1 at k i π/2.
Our procedure, corresponding to Algorithm 1, gives not only numerical results of great precision but also a remedy for mistakes in the use of some existing mathematical software programs when displaying wrong results with a small number n of significant digits (e.g., n < 9).In such cases, the argument x's to approximate sin x are commonly close to kπ/2's, k ∈ Z.
In addition, Theorem 2 can be applied to look for desired estimates to the best L 2 -approximation of the sine function in the vector space P of polynomials of degree at most , a subspace of L 2 (a, b).

Figure 4 .
Figure 4.The approximate intervals and functions will be chosen with the specific position of b from (k n−1 + 1 2 )p n−1 .

Theorem 2 .
Suppose an interval [a, b] can be expressed as a finite union [a, α 1 ] ∪ [α 1 , α 2 ] ∪ • • • ∪ [α n , b] and f (x) = sin x is approximated by the polynomials P c m i (x) on the intervals [α i−1 , α i ], i = 1, . . ., n + 1, with the accuracy up to 1/10 r , where α 0 = a and α n+1 = b.Then, if Q is an arbitrary polynomial and I = b a Q(x) sin s x dx (s ∈ N) is approximated by J