I am trying to compute thousands of integrals of the below type, that comes up in a conformal mapping problem, to as many accurate digits as possible (preferably 50+):

$$ \int_{-1}^1\textrm{d}t \frac{\mathcal{Re}\{\log[(\cos{(\pi/130)} - t)]\}}{\sqrt{1 - t^2}} $$

The results from PARI/GP, Sage and Python's mpmath library respectively are:

```
-2.1770705767584673426214016567105099553,
(-2.1775860588840983, 1.2746272565903925e-05),
-2.1774410877577223893132496923831596284
```

Clearly $-2.177$ is correct, but what's the best way to find a more accurate answer, accurate to 50+ digits?

I've tried splitting intervals from $[-1, \tau] \cup [\tau, 1]$, where $\tau = \cos{(\pi/130)}$; that doesn't improve things but actually makes it worse. I am working at much higher decimal precision than 3.

**UPDATE**: Following the suggestion of IgorRivin, the below is the Mathematica attempt:

```
tau = N[Cos[Pi/130], 50];
epsilon = 2^-10;
limit = N[ArcCos[1 - epsilon], 50];
T1 = NIntegrate[Re[Log[(tau - t)]]/(Sqrt[1 - t^2]), {t, -1, 1 - epsilon},
WorkingPrecision -> 50, AccuracyGoal -> 50]
T2 = NIntegrate[Re[Log[tau - Cos[theta]]], {theta, 0, limit},
WorkingPrecision -> 50, AccuracyGoal -> 50]
answer = T1 + T2
```

gives the results:

```
Out[1]= -1.7968036050143567231750633164742621583459497767361
During evaluation of In[881]:= NIntegrate::ncvb: NIntegrate failed to converge to prescribed
accuracy after 9 recursive bisections in theta near
{theta} = {0.024170580099064656300274166159163078224443688377727}.
NIntegrate obtained -0.38078136551592029350719560689304843811203900465893
and 6.9050153103011684224977203192777088512613553501207`50.*^-7 for the
integral and error estimates. >>
Out[2]= -0.38078136551592029350719560689304843811203900465893
Out[3]= -2.1775849705302770166822589233673105964579887813950
```

As may be seen the error is still in the seventh decimal place; increasing the working precision or accuracy does not really improve things.

**UPDATE**: The integral is exactly soluble; the result is given in my comment to the accepted answer of Emil Jeřábek, and compares well to the exact value.

`mpmath.mp.dps=50`

for pari`\p 50`

or`default("realprecision",50)`

$\endgroup$`WorkingPrecision`

and`AccuracyGoal`

. If I am not mistaken (I am no Mathematica expert), the former is the machine precision that is used for computations, that is, the local error allowed at each computation. Using`WorkingPrecision=50`

it is impossible to get 50 significant digits on an ill-conditioned problem. $\endgroup$1more comment