# Efficient computation of tangent of fraction of angle

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.

• Where do you get your angle $\theta$ from, i.e. do you have to compute it in some special way? – Pedro Oct 14 '13 at 14:47
• 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$. – Victor Liu Oct 14 '13 at 15:25

I cannot think of any useful trigonometric identity that could help evaluating $$a = \tan ( f \tan^{-1} g)$$ so I would try a series expansion $$fg + \frac{1}{3}f(f^2-1)g^3 + \frac{1}{15}f(2 f^4 - 5f^2 + 3) g^5 + \ldots$$ 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 $$\tan(\alpha - \beta) = \frac{\tan\alpha - \tan\beta}{1+\tan\alpha \, \tan\beta}$$ with $\alpha = \theta$, $\beta = f\theta$, leading to $$b = \frac{g-a}{1+ga}$$ 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...)