0
$\begingroup$

I was wondering, in terms of complexity and "precision", what are the differences, if any, netween the computation of

$$2R \sin(\alpha)\cos(\alpha) \qquad \qquad \text{and} \qquad \qquad R\sin(2\alpha)$$

It's the same thing, for it is a goniometric identity. So are there differences in terms of order of complexity, computation time and so on?

Sorry for my ignorance in matter, hope this question is not too stupid.

$\endgroup$
3
  • $\begingroup$ The formula on the left obviously takes two function evaluations instead of one. But we don't know the time complexity as a function of the argument, so without more info we can't conclude. $\endgroup$
    – user16034
    Commented Jan 11, 2023 at 15:19
  • $\begingroup$ Used in a mathematical context, "precision" does not make sense, the two formulas are perfectly equivalent. In a computational context, you need to specify the computational algorithms. In a programmatic context, all complexities are $O(1)$ and precision of the product might be a little lower but this is hard to say without details on the behavior of the FPU. $\endgroup$
    – user16034
    Commented Jan 11, 2023 at 15:22
  • $\begingroup$ If you have some larger problem domain, we may be able to find the most efficient solution. I think you have a potentially interesting problem, I just wish that there were more specifics to work with so that we could use them to our advantage. $\endgroup$
    – Matt Groff
    Commented Jan 12, 2023 at 4:03

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.