Ask Your Question

Revision history [back]

You can first solve the integral symbolically :

sage: i = integral(exp(-1/x)/x,x,0,1)
sage: i
-Ei(-1)

Then, you can convert the result into some real field approximation with high precision:

sage: F = RealIntervalField(200)
sage: F
Real Interval Field with 200 bits of precision
sage: F(i)
0.21938393439552027367716377546012164903104729340690820757797849?

Note that, compared to RealField(200), you have the guaranty that the actual value belongs to some interval:

sage: F(i).endpoints()
(0.21938393439552027367716377546012164903104729340690820757797,
 0.21938393439552027367716377546012164903104729340690820757798)

Note : RealBallField(200) which is supposed to be faster fails with a RecursionError: maximum recursion depth exceeded

You can first solve the integral symbolically :

sage: i = integral(exp(-1/x)/x,x,0,1)
sage: i
-Ei(-1)

You can get information about the Ei function with:

sage: Ei?

Then, you can convert the result into some real field approximation with high precision:

sage: F = RealIntervalField(200)
sage: F
Real Interval Field with 200 bits of precision
sage: F(i)
0.21938393439552027367716377546012164903104729340690820757797849?

Note that, compared to RealField(200), you have the guaranty that the actual value belongs to some interval:

sage: F(i).endpoints()
(0.21938393439552027367716377546012164903104729340690820757797,
 0.21938393439552027367716377546012164903104729340690820757798)

Note : RealBallField(200) which is supposed to be faster fails with a RecursionError: maximum recursion depth exceeded

You can first solve the integral symbolically :

sage: i = integral(exp(-1/x)/x,x,0,1)
sage: i
-Ei(-1)

You can get information about the Ei function with:

sage: Ei?

Then, you can convert the result into some real field approximation with high precision:

sage: F = RealIntervalField(200)
sage: F
Real Interval Field with 200 bits of precision
sage: F(i)
0.21938393439552027367716377546012164903104729340690820757797849?

Note that, compared to RealField(200), you have the guaranty that the actual value belongs to some interval:

sage: F(i).endpoints()
(0.21938393439552027367716377546012164903104729340690820757797,
 0.21938393439552027367716377546012164903104729340690820757798)

Note Note : RealBallField(200) which is supposed to be faster fails with a RecursionError: maximum recursion depth exceeded This issue is now tracked at trac ticket 32301