Here is a solution based on the pst-ode
package. The integrand is symmetrical about x=0, so integration can be started at 0 and the result is multiplied by 2.
Typeset with pdflatex --shell-escape
:
\documentclass{article}
\pagestyle{empty}
%%%%%%%%%%%%%%%%%%%%%%% solve ODE in auxiliary document %%%%%%%%%%%%%%%%%%%%%%%%
\begin{filecontents}[overwrite]{solve.tex}
\documentclass{article}
\usepackage{pst-ode}
\begin{document}
% arguments:
% algebraicAll --> all arguments in algebraic notation
% saveData --> also write result into file `result.dat'
% `result' --> PostScript variable that takes result
% 2*y[0] --> output format in `result' and `result.dat'
% 0, 1 --> integration interval t_0, t_e
% 2 --> number of saved output points t_0, t_e
% 0 --> initial value
% 1/sqrt(...) --> right-hand side of ODE
\pstODEsolve[algebraicAll,saveData]{result}{2*y[0]}{0}{0.9999999}{2}{0}{
1 / sqrt(1-t^2)
}
dummy text
\end{document}
\end{filecontents}
\immediate\write18{latex solve}
\immediate\write18{dvips solve}
\immediate\write18{ps2pdf -dNOSAFER solve.ps}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newread\resfile\immediate\openin\resfile=result.dat
\immediate\read\resfile to \dummy % read and throw away initial value
\immediate\read\resfile to \result % read definite integral value
\begin{document}
\[
\int_{-1}^{1} \frac{1}{\sqrt{1 - x^2}} dx \approx \result
\]
\end{document}
xfp
doesn't do that. You have to solve the integral analytically yourself, then you can feedxfp
the remaining arithmetics for it to give you the final value