0
$\begingroup$

Say, for example, what's the angle, theta, between y=10000x and y=10001x ?

In terms of calculator-independent estimation, I tried: calculate tan(theta), then use taylor expansion of arctan(theta). But that seems a bit of work. Is there any other approach with less work?

$\endgroup$
3
  • $\begingroup$ The most direct way to obtain such a result is using calculus. Are you comfortable with that? $\endgroup$ Sep 29, 2014 at 0:17
  • $\begingroup$ @Semiclassical could you elaborate on that? do you mean find the cosine of angle between two vectors? $\endgroup$
    – MatheMagic
    Sep 29, 2014 at 0:28
  • $\begingroup$ For small $\theta$ (in radians), $\tan\theta\approx\sin\theta\approx\theta$. $\endgroup$
    – JRN
    Sep 29, 2014 at 1:10

2 Answers 2

2
$\begingroup$

Using the Taylor expansion of $\arctan$ is the right idea, but you need to do that at, say, $10000$, not at zero.

You want $f(10001) - f(10000)$ where $f(x) = \arctan x$. For relatively small values of $h$, the first-order Taylor formula gives you $$f(a + h) - f(a) \approx f'(a)h.$$

Here we have $f'(x) = \frac{1}{x^2 + 1}$ $$f(a + h) - f(a) \approx \frac{1}{a^2 + 1}h.$$

Moreover, the error in this approximation is bounded by $\frac{1}{2}Mh^2$ where $M$ is an upper bound in absolute value for $f''(x) = -2x/(x^2 + 1)^2$ between $a$ and $a + h$. The numerator is bounded above by $2(|a| + |h|)$ and the denominator below by $a^4$, so a bound for the error is $1/|a|^3 + |h|/a^4$.

But we can further approximate $1/(a^2 + 1)$ by $1/a^2$ with an error of at most $1/a^4$, so the approximation $$f(a + h) - f(a) \approx \frac{h}{a^2}$$ is valid with error at most $1/|a|^3 + 2|h|/a^4$.

In our case, $a = 10000$ and $h = 1$, so the desired approximation is $10^{-8}$ radians with a maximum possible error just over $10^{-12}$.

The actual value is $0.0000000099990000000099987$ radians.

We could have obtained a more accurate estimate by using the second-order Taylor approximation, and then the bound on the error would be given in terms of the third derivative.

$\endgroup$
3
  • $\begingroup$ While it's equivalent, we can just as well take the lines to be $y=x/10000$ and $y=x/10001$ (since this just swaps the axes and doesn't change the angle). In that case we approximate $f(10000^{-1})-f(10001^{-1})$, in which case the use of Taylor's theorem is more direct. $\endgroup$ Sep 29, 2014 at 1:13
  • $\begingroup$ Good point. That will be simpler. On the other hand, I imagine that bounding the error will be a bit worse if you have to add the errors based on the intervals $[0,1/10001]$ and $[0,1/10000]$ rather than just the error on $[1/10001,1/10000]$, which is a much shorter interval. So using the Taylor series at $0$ doesn't appear to be entirely equivalent at first glance. $\endgroup$
    – Tom
    Sep 29, 2014 at 1:18
  • $\begingroup$ Perhaps, I wasn't worrying too much about rigorous inequalities. But at the level of first-order approximations it's just: If $m=\tan \theta$, then for small $\theta$ we have $m\approx \theta$ and $\delta \theta \approx \delta m=\frac{1}{10000}-\frac{1}{10001}\approx 10^{-8}.$ $\endgroup$ Sep 29, 2014 at 1:25
0
$\begingroup$

Assume $1 < a < b$. We will further assume $b < 2a$. Your problem is to estimate $\arctan b - \arctan a$ with $a = 10000$ and $b = 10001$.

We have

$$ \begin{align*} \arctan b - \arctan a &= \int_a^b \frac{dt}{t^2 + 1} \\ &= \int_a^b \left(\frac{1}{t^2} - \frac{1}{t^4} + \frac{1}{t^6} - \dots\right) \, dt \\ &= \int_a^b \frac{1}{t^2} \, dt - \int_a^b \frac{1}{t^4} \, dt + \int_a^b \frac{1}{t^6} \, dt -\dots \\ &= \left(\frac{1}{a} - \frac{1}{b}\right) - \frac{1}{3}\left(\frac{1}{a^3} - \frac{1}{b^3}\right) + \frac{1}{5}\left(\frac{1}{a^5} - \frac{1}{b^5}\right) - \dots \end{align*} $$ The interchange of limit and integral is justified by uniform convergence. Since the series is alternating, as can be seen from the integral terms, if we cut it off at a particular term, then the error is bounded by the following term. If we let $h = b - a$ and cut off after one term, we obtain the approximation $$\arctan (a+h) - \arctan a \approx \frac{h}{a(a+h)} = \frac{h}{a^2}\left[1 - \frac{h}{a} + \left(\frac{h}{a}\right)^2 - \dots \right],$$ where we've used the fact that $h < a$.

If we leave this as $\tfrac{h}{a^2}(1 - \tfrac{h}{a})$, then we commit a negative error no larger than $\frac{h^3}{a^4}$ and a positive one no larger than $\int_a^b \frac{dt}{t^4} \leq \frac{h}{a^4}$.

With $a=10000$ and $h = 1$, we get $\arctan 10001 - \arctan 10000 \approx 10^{-8} - 10^{-12}$ with an error not exceeding $10^{-16}$.

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .