3
$\begingroup$

I want to compute $a = \tan(f \theta)$ for $f\in [0,1]$, given $g = \tan\theta$. Obviously, I can compute $a = \tan(f\tan^{-1}g)$, but I'm wondering if there's a more efficient way that avoids having to evaluate two transcendental functions.

I happen to also want the quantity $b = \tan[(1-f)\theta]$, and I believe the identity $$ a+b+gab-g=0 $$ holds. I can be reasonably assured that $0\le g \lesssim \frac{1}{2}$, so that tangent and arctangent are both somewhat linear. I figure this assumption should greatly help, if there happens to be any efficient method. The emphasis here is on accuracy and robustness.

$\endgroup$
  • $\begingroup$ Where do you get your angle $\theta$ from, i.e. do you have to compute it in some special way? $\endgroup$ – Pedro Oct 14 '13 at 14:47
  • $\begingroup$ I don't explicitly have the angle $\theta$ available. This is in relation to computing an arbitrary subdivision of an arc-spline, see these notes for details. The quantity that I have available to begin with is only $\tan\theta$. $\endgroup$ – Victor Liu Oct 14 '13 at 15:25
4
$\begingroup$

I cannot think of any useful trigonometric identity that could help evaluating \begin{equation} a = \tan ( f \tan^{-1} g) \end{equation} so I would try a series expansion \begin{equation} fg + \frac{1}{3}f(f^2-1)g^3 + \frac{1}{15}f(2 f^4 - 5f^2 + 3) g^5 + \ldots \end{equation} but I doubt that if focus is on accuracy and robustness you can do much better than calling tan(f*atan(g)).

Once you know $a$ and $g$ you can compute $b$ by the tangent angle subtraction formula \begin{equation} \tan(\alpha - \beta) = \frac{\tan\alpha - \tan\beta}{1+\tan\alpha \, \tan\beta} \end{equation} with $\alpha = \theta$, $\beta = f\theta$, leading to \begin{equation} b = \frac{g-a}{1+ga} \end{equation} which proves your identity.

(Disclaimer: I'm not an expert in this field, but at high school I was very good in trigonometry, so I could not resist answering the question...)

$\endgroup$

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.