How to compute Dottie number accurately?

$\begingroup$

Dottie number is root of this equation : $cos \alpha = \alpha$, $\alpha \approx 0.73908513321516064165531208767\dots$.

I wonder how can I compute it ? I have tried to do it with an approximating formula:

$\alpha = \frac{5\pi^2}{\alpha^2 + \pi^2} - 4$

I have solved this equation and i got $\alpha \approx 0.738305\dots$. So , how can i compute it accurately ? Can i use taylor series, etc. ?

$\endgroup$ 3

5 Answers

$\begingroup$

Using Newton's method,

$$\alpha = \alpha + \frac{\cos \alpha - \alpha}{\sin\alpha + 1}$$ Use this for a fixed-point iteration with chosen starting value ($\alpha_0 := \frac1{\sqrt2} = 0.7\color{red}{172}\ldots$ seems like a good choice)

Thus

$$\alpha_1 = \frac1{\sqrt 2} + \frac{\cos\frac1{\sqrt2}-\frac1{\sqrt2}}{\sin\frac1{\sqrt2} + 1} = 0.739\color{red}3\ldots \\ \alpha_2 = \frac1{\sqrt 2} + \frac{\cos\frac1{\sqrt2}-\frac1{\sqrt2}}{\sin\frac1{\sqrt2} + 1} + \frac{\cos\left(\frac1{\sqrt 2} + \frac{\cos\frac1{\sqrt2}-\frac1{\sqrt2}}{\sin\frac1{\sqrt2} + 1}\right) - \frac1{\sqrt 2} - \frac{\cos\frac1{\sqrt2}-\frac1{\sqrt2}}{\sin\frac1{\sqrt2} + 1}}{\sin\left(\frac1{\sqrt 2} + \frac{\cos\frac1{\sqrt2}-\frac1{\sqrt2}}{\sin\frac1{\sqrt2} + 1}\right) + 1} = 0.7390851\color{red}4\ldots$$

As you can see, it converges quickly. Only one more iteration gives

$$\alpha_3 = 0.73908513321516\color{red}1\ldots$$

Which is equal to $\alpha$ within the IEEE double precision standard. For $\alpha_0 = 0.7$ you need one more iteration for the same result, $0.739$ only requires two iterations and from $0.73908513$, one iteration is enough for double-precision.

$\endgroup$ 6 $\begingroup$

Taylor series of order 2 gives a simple quadratic in $\alpha$: $$\alpha=1-\alpha^2/2\implies \alpha=0.\color{red}{73}2..$$ Of order 4 gives a bi-quadratic (there's a formula to solve roots of a polynomial of degree less than 5) in $\alpha^2$: $$\alpha=1-\alpha^2/2+\alpha^4/4\implies 0.\color{red}{739}2..$$ Fairly accurate for practical purposes wherein the correct value is $0.739085...$

$\endgroup$ 1 $\begingroup$

Let $a_{0}$ be the start input (it's better to choose one close to Dottie's Number). For example, I'll choose it as $a_{0} = 0.73$.

$$a_{n} = \cos(a_{n-1})$$ $$ \lim_{n \to \infty} a_{n} = \text{Dottie's Number}$$

Let's begin the calculations: $$a_{1} = \cos(a_{0}) = \cos(0.73) = 0.745174402...$$ $$a_{2} = \cos(a_{1}) = \cos(0.745174402...) = 0.734969653...$$ $$a_{3} = \cos(a_{2}) = \cos(0.734969653...) = 0.741851103...$$ $$a_{4} = \cos(a_{3}) = \cos(0.741851103...) = 0.737219118...$$ $$\dots$$ $$a_{55} = 0,739085133...$$

Of course it is not easy to do by hand, but for a computer it's a piece of cake.

$\endgroup$ $\begingroup$

With $a_0=1$ and

$$a_{n+1}=\cos(a_n)$$

It must follow that

$$\alpha=\lim_{n\to\infty} a_n$$

Unfortunately, this converges extremely slowly. One can consider, more generally,

$$a(n,k,x)=\begin{cases}a(n,k-1,(a(n,k-1,x)+a(n+1,k-1,x))/2),&k>0\\a(n-1,0,\cos(x)),&n>k=0\\x,&n=k=0\end{cases}$$

From which it is easily seen that

$$\alpha=\lim_{n\to\infty}a(n,k,x)$$

For any $k\in\Bbb N$ and $x\in\Bbb R$.

A quick implementation is given:

A few values of $a(n,k,1)$ are provided below:

 n | 0 1 2 3
k
_
0 1.0000000000000000 0.5403023058681398 0.8575532158463934 0.6542897904977791
1 0.7701511529340699 0.7655325029045684 0.7467463120692533 0.7437002334049706
2 0.7436266020461714 0.7403751852701087 0.7392909637993013 0.7391335465331998
3 0.7391414918542529 0.7390881161559403 0.7390852375353876 0.7390851380676647

α ≈ 0.7390851332151607, so $a(3,3,1)$ is accurate to 8 places. Estimating from the first few values, it appears $a(n,n,1)$ is accurate to $\alpha$ for the first $≈n^2$ places.

$\endgroup$ $\begingroup$

An analytical form of x can be obtained solving Kepler equation:

$$M= E-\epsilon \sin(E)$$

with eccentricity=1 and mean anomaly = $\pi/2$ by means of Kapteyn series:

$$2x = \frac{\pi}{2}+\sum_{n=1} \frac{2J_n(n)}{n} \sin(\pi n/2)$$

where $J_n()$ are the Bessel functions. Simplifying:

$$2x = \frac{\pi}{2}+\sum_{n=0} \left( \frac{2J_{4n+3}(4n+1)}{4n+1} - \frac{2J_{4n+3}(4n+3)}{4n+3}\right)$$

$$x = \frac{\pi}{4}+\sum_{n=0} \left( \frac{J_{4n+1}(4n+1)}{4n+1} - \frac{J_{4n+3}(4n+3)}{4n+3}\right)$$

Such series can be numerically evaluated, but without some acceleration technique (see below), it converges slowly and n=10000 terms are required to obtain:

$$x = 1.154940317134$$

with

$$2x-\sin(2x)-\pi/2=-1.38017659479e-006$$

In order to improve the convergence, we can employ an acceleration series technique as Levin's acceleration. (See )

With only 10 (ten!) terms we obtain:

$$x=1.1549406884223$$

A simple c++ code, based on gsl library is the following:

#include <iostream>
#include <fstream>
#include <iomanip>
#include "gsl_sf.h"
#include "gsl_sum.h"
using namespace std;
#include <cmath>
int main(int argc, char* argv[])
{ double PIH = atan(1.)*2; cout<<setprecision(13); double E=PIH; cout<<"raw series"<<endl; //raw series for( int i = 0 ; i < 1e4; i +=2 ) { double term = 2*gsl_sf_bessel_Jn( 2*i+1, 2*i+1 )/(2*i+1); double term2 = 2*gsl_sf_bessel_Jn( 2*i+3, 2*i+3 )/(2*i+3); E += (term-term2); } cout<< E/2<<endl; cout<< "error: "<<E-sin(E)-PIH<<endl; //levin cout<<"levin accelerated series"<<endl; const int N = 10; double t[N]; double sum_accel=0, err; gsl_sum_levin_u_workspace* w = gsl_sum_levin_u_alloc( N ); t[0] = PIH; for( int i = 1 ; i < N; i++ ) { double term = 2*gsl_sf_bessel_Jn( 4*i-3, 4*i-3 )/(4*i-3); double term2 = 2*gsl_sf_bessel_Jn( 4*i-1, 4*i-1 )/(4*i-1); t[i] = term-term2; } gsl_sum_levin_u_accel( t, N, w, &sum_accel, &err ); E=sum_accel/2; cout<<sum_accel/2<<endl; cout<<"error: "<<sum_accel-sin(sum_accel)-PIH<<endl;
}
$\endgroup$

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like