Course information, class updates, notes, references, projects ...


Saturday, 15 September 2012

Brahmagupta's Sine Interpolation





In a previous post we saw a very accurate approximation to the Sine function provided by the scientist Bhaskara who lived in the 7th century AD. In this post, we present an alternative formula given by his contemporary Brahmagupta. This is based on starting with a table of Sine values. The standard tables presented by Aryabhata and others preceding Brahmagupta used intervals of 3o45'. Intermediate values were then found by linear interpolation. Let's express this in our language:

We assume intervals of fixed width $\delta$. We are thus looking at the angles 0, $\delta$, $2\delta$, ..., $i\delta$ ,... Suppose a table is available for the Sines of these angles: $\sin(0)$, $\sin(\delta)$, $\sin(2\delta)$, ..., $\sin(i\delta)$, ... Our task is to estimate the value of $\sin(x)$ when $x$ is not a tabulated angle. Suppose $x$ is between $x_{i-1}=(i-1)\delta$ and $x_i=i\delta$. The total change of the Sine function over this interval is $\sin(x_i)-\sin(x_{i-1})$ and we denote this by $\triangle\sin_i$. If this change were happening linearly then every unit change in the angle would produce a change of
$$\frac{\triangle\sin_i}{\delta}$$ in the Sine function. In moving from  $x_{i-1}$ to $x$ we would therefore create a change of
$$\frac{\triangle\sin_i}{\delta}(x-x_{i-1})$$ This gives the following approximation, which is called linear interpolation:
$$\sin(x)-\sin(x_{i-1}) \approx \frac{\triangle\sin_i}{\delta}(x-x_{i-1}) \quad\mbox{or}\quad \sin(x) \approx \sin(x_{i-1}) + \frac{\triangle\sin_i}{\delta}(x-x_{i-1})$$
In linear interpolation we match the function which a straight line which meets it at 2 points: $x_{i-1}$ and $x_i$. Brahmagupta's approach amounts to improving this by matching the function with a quadratic which meets it at 3 points: $x_{i-2}$, $x_{i-1}$ and $x_i$. To derive this formula (and we don't know the steps Brahmagupta took) we start with a form similar to the linear interpolation formula: $$\sin(x)\approx \sin(x_{i-1}) + (x-x_{i-1})p(x)$$ where $p(x)$ is a linear function $Ax+B$. This already does the right thing at $x_{i-1}$. We have to choose $p(x)$ so that it also does the right thing at $x_{i-2}$ and $x_i$. In other words, we need $p(x)$ to satisfy the following: $$\sin(x_{i-2})=\sin(x_{i-1}) + (x_{i-2}-x_{i-1})p(x_{i-2})$$ $$\sin(x_{i})=\sin(x_{i-1}) + (x_{i}-x_{i-1})p(x_{i})$$ These can be rearranged into $$p(x_{i-2}) = \frac{\triangle\sin_{i-1}}{\delta}$$ $$p(x_{i}) = \frac{\triangle\sin_{i}}{\delta}$$
This is again a linear interpolation problem and we have already seen how to solve it: \begin{eqnarray*}
p(x) &=&p(x_{i-2}) + \frac{x-x_{i-2}}{x_i-x_{i-2}}(p(x_i)-p(x_{i-2}))= \frac{\triangle\sin_{i-1}}{\delta}+\frac{x-x_{i-2}}{2\delta}\left(\frac{\triangle\sin_{i}-\triangle\sin_{i-1}}{\delta}\right)\\
&=& \frac{\triangle\sin_{i-1}}{\delta}+\frac{x-x_{i-1}+\delta}{2\delta}\left(\frac{\triangle\sin_{i}-\triangle\sin_{i-1}}{\delta}\right) = \frac{\triangle\sin_i+\triangle\sin_{i-1}}{2\delta}+\frac{x-x_{i-1}}{\delta^2}\left(\frac{\triangle\sin_{i}-\triangle\sin_{i-1}}{2}\right)
\end{eqnarray*}
We bring things to a close by putting this expression for $p(x)$ back into our initial quadratic approximation. We get:
$$\sin(x) \approx \sin(x_{i-1}) + \frac{x-x_{i-1}}{\delta}\left(\frac{\triangle\sin_i+\triangle\sin_{i-1}}{2}+\frac{x-x_{i-1}}{\delta}\left(\frac{\triangle\sin_{i}-\triangle\sin_{i-1}}{2}\right)\right)$$ Brahmagupta used $\delta=15^o =900'$. So his base trigonometric table needed only five values (ignoring the trivial cases of 0 and 90 degrees). And here are graphs showing the accuracy of his formula between 60 and 75 degrees:
Linear Interpolation
Brahmagupta's Quadratic Interpolation

No comments:

Post a Comment