0

Can you tell me which is the best approximation for cosine/sine functions. It should also reduce the computational complexity. I've already tried the Bhaskara I's approximation.

Can you suggest me anything better?

Thanks in advance.

Rócherz
  • 3,976
phanitej
  • 201
  • How accurate do you want it to be, how simple (or complex), and what operations do you allow? Also, do you want it in fixed or floating point? – marty cohen May 11 '15 at 06:13
  • I can afford one multiplication, and an addition/subtraction. And I want it for fixed point implementaion – phanitej May 11 '15 at 06:16
  • What range of values? – marty cohen May 11 '15 at 06:20
  • Actually i want it for simultaneous sine and cosine functions, with the input real/ imag values in between -1 and +1. I want to use these functions for discrete fourier transform – phanitej May 11 '15 at 06:23
  • Looks like you are doing this on a quite limited processor. What are the inputs to your computation? From all your restrictions, it's starting to look like the only possibility would be table lookup, perhaps combined with linear interpolation. – marty cohen May 11 '15 at 06:27
  • 1
    Though discovered independently, the following is equivalent to Bhaskara's: $$\cos\bigg(\dfrac\pi2x\bigg) \simeq \Big(1-x^2\Big) \bigg(1-\dfrac{x^2}{4.5}\bigg),$$ for $|x|\le1.~$ – Lucian May 11 '15 at 12:51

2 Answers2

1

For $-\pi\le x \le \pi $ I found $$\left(\frac{315}{2}\pi^2 - \frac{15}{2\pi^2} \right)x + \frac{175}{2\pi^6}\left( \frac{\pi^2}{5}-3\right)x^3,$$ is it of any help?

  • Ya it is of help , but i need to do a modulo operation, to wrap the x^3 back into 0<x<pi. – phanitej May 11 '15 at 06:33
  • @phanitej But does it really work? I had just found it on the net, but I'm afraid it's incorrect. Though, I can't check now. – Vincenzo Oliva May 11 '15 at 06:46
  • I suppose typo's in this formula. Try using $x=\frac \pi 2$ or $x=\pi$. Could you tell where you did find it ? – Claude Leibovici May 11 '15 at 09:02
  • @ClaudeLeibovici Yeah, I checked that once but couldn't doublecheck as I'm at school, so I thought I had typed something wrong in the calculator. It was the result of an Italian graduand, confirmed by who looked like his professor. I guess you're right about the typo. – Vincenzo Oliva May 11 '15 at 10:22
  • @phanitej I'll leave this answer here in case someone finds the typo. In the meanwhile, I'll post another answer with a correct inequality. – Vincenzo Oliva May 11 '15 at 10:58
0

Hopefully you're interested in the following double inequality, valid for $0\le x\le\pi$: $$x\left(1-\frac{x}{\pi}\right)\le\sin x\le \frac{4x}{\pi}\left(1-\frac{x}{\pi}\right) $$