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$$
Thus
$$2x-\pi/2=\sin(2x)$$
Let $y=2x-\pi/2=\sin(2x)$
$$\sin(2x)
=\sin(\pi/2+y)=\sin(\pi/2-y)=\cos(y)$$
So
$$\cos(y)=y$$
Hence $y$ is Dottie's number.
In order to improve the convergence, we can employ an acceleration series technique as Levin's acceleration. (See http://en.wikipedia.org/wiki/Series_acceleration)
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;
}
https://math.stackexchange.com/questions/46934/what-is-the-solution-of-cosx-x
– giorgiomugnaini Jul 27 '21 at 18:57