Wikipedia:Reference desk/Archives/Mathematics/2014 September 26

= September 26 =

Approximation of the cosine function
In the Cosine article on Mathworld, an interesting approximation is mentioned: A close approximation to cos(pix/2) for x in [0,1] is


 * $$\begin{align}H(x)	& =	1-\frac{x^2}{x+(1-x)\sqrt{\frac{2-x}{3}}}

& \quad (8) \\

& \approx \cos\left(\frac{\pi}{2}x\right) & \quad (9) \end{align}$$

(Hardy 1959), where the difference between cos(pix/2) and Hardy's approximation is plotted above. However, all it mentions is Hardy's work, and the work cited does not contain any other information about this approximation! The derivation and/or potential applications for this would be interesting, but no other information about this can be found on the internet. Do you know any other sources/information about this? Llightex (talk) 21:05, 26 September 2014 (UTC)
 * Here is a way you might reverse engineer the formula, though I have no idea how Hardy derived it. Let C(x) = cos(πx/2). We know from the Taylor series that C(x) = 1 - x2/constant + other terms. Rewrite this as C(x) = 1 - x2/K(x) where K is to be determined. We also know C(1) = 0 from which K(1)=1. Expand K at x=1 to get K(x)=1+constant⋅(x-1)+higher terms. Again, collecting the the constant and higher terms into a single function, write K(x)=1+(x-1)L(x). At this point you can get a fairly good approximation for C by plugging in a linear approximation for L. But we also know C(1/2)=√2/2 which would imply (after some computation) L(1/2) = 1 - √(1/2). So perhaps a better approximation of L would be L(x)≈ 1 - √(1/2+m(x-1/2)) for some constant m. If you plug in C(2/3)=1/2 you get m=-1/3 which produces the approximation given, but other values of m might work just as well or better. I found m=-.337 gives the lowest mean square error on the interval. Note that there are points in the derivation where different choices could be made, for example you could write C(x) = 1 - x2⋅K(x) or K(x)=1+(x-1)/L(x). It might be fun to explore these variations to see how they compare with the one given. --RDBury (talk) 00:01, 27 September 2014 (UTC)