Processing math: 100%

Math Equations

Monday, March 14, 2016

Estimating a quarter turn in radians

Compute two sequences $a0an1b0bn1$ of unsigned integers with
a0an1b0bn1=1001,|akak+1bkbk+1|=1for all k.Then 1akak+1+bkbk+1τ4.

The idea is as follows: Integrate 1 from 0 to $\frac\tau4.$ A small term $\Delta\theta$ can be approximated as $\sin \Delta\theta$. Take $\sin^2 \Delta\theta$ to be the spread between two adjacent vectors $akbk$, $ak+1bk+1.$ This spread is (akbk+1ak+1bk)2(a2k+b2k)(a2k+1+b2k+1)=1(akak+1+bkbk+1)2+11(akak+1+bkbk+1)2.Thus $\Delta\theta\approx\frac1{a_ka_{k+1}+b_kb_{k+1}}.$

Here's an algorithm:

#include <iostream>
#include <iomanip>
using namespace std;

long double integrate(unsigned long a0, unsigned long b0,
                      unsigned long a1, unsigned long b1) {   
    if (a0*a1+b0*b1 > 100000)
        return 1.0L/(a0*a1+b0*b1);
    else
        return integrate(a0+a1, b0+b1, a1, b1) + integrate(a0, b0, a0+a1, b0+b1);
}

int main() {
    cout << "approx " << setprecision(20) << integrate(1, 0, 0, 1) << endl;
}

The output is 1.5707963268188070548, which equals $\frac\tau4$ to 9 decimal places.