I was reading about the Hardy's approximation for the cosine function (here and also in Mathworld):

hardy's approximation equationfor 0<x<1

What I would like to know is, how was this approximation derived? What other uses does it have? The links also include a graph showing the error between cos(x) and the approximation. There isn't much information on the internet about this interesting formula.

  • 1
    $\begingroup$ I've read the paper refered in MathWorld, but I found nothing about this cosine approximation in it. $\endgroup$ – user153012 Sep 24 '14 at 0:15
  • $\begingroup$ In the link I added, it's at equation (8), starting at the "A close approximation to cos(pix/2) for x in [0,1] is" line. $\endgroup$ – Ashwin Ramaswami Sep 24 '14 at 1:15
  • $\begingroup$ Yes. I know. And there is a referred paper to Hardy 1959 p. 68, but I found nothing there about it. $\endgroup$ – user153012 Sep 24 '14 at 8:07
  • 2
    $\begingroup$ The same question has been recently also asked here, on Wikipedia Mathematics Reference Desk. $\endgroup$ – Lucian Sep 28 '14 at 19:16
  • $\begingroup$ While I agree that the approximation is interesting, there needs to be a specific question suitable for answering in the Math.SE format in order for this to be a good Question. For example, one might emphasize "how was this approximation derived?" in the context of Hardy's writings. If the Hardy paper referred to is not apt, that lends to the Reader's confusion. $\endgroup$ – hardmath Oct 14 '14 at 21:32

(Cross posting my answer from the Wikipedia help desk.)

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 - \frac{x^2}{\text{constant}} + \text{other terms}$$

Rewrite this as $C(x) = 1 - \frac{x^2}{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+(\text{constant})\cdot (x-1)+\text{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)=\sqrt{2}/2$ which would imply (after some computation) $L(1/2) = 1 - \sqrt{1/2}$. So, perhaps a better approximation of $L$ would be: $$L(x)\approx 1 -\sqrt{\frac{1}{2}+m(x-\frac 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 - x^2⋅K(x)$ or $K(x)=1+\frac{(x-1)}{L(x)}$. It might be fun to explore these variations to see how they compare with the one given.

  • $\begingroup$ I have edited your post to make use of $\LaTeX$. Please look it over to ensure that I haven't inadvertently changed the intent of your post. $\endgroup$ – apnorton Sep 30 '14 at 19:59
  • $\begingroup$ @anorton - Looks good, thanks! $\endgroup$ – RDBury Oct 1 '14 at 17: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.