# Is it possible to use Arb-library commands directly in Sagemath?

I would like to use some commands/functions from the high performance/precision Arb-library that in turn builds on the Flint-library. Searching the web, I did find references that some commands from both libraries already underpin directly or indirectly the Sagemath environment, however basic commands like for instance:

arb.pi()


don't seem to be supported (or better, I couldn't get them to work yet).

What I am after is to use Flint and Arb functions within Python like in this example, but then under the Sagemath umbrella. Is this already possible?

Thanks.

edit retag close merge delete

Sort by » oldest newest most voted

You can define the RealBallField (that uses Arb as backend) with:

sage: R = RealBallField()


Then you can use some Arb functions as methods of R:

sage: R.pi()
[3.141592653589793 +/- 5.61e-16]


You can read more on the documentation for the real ball field and the complex ball field.

 Basic algebraic operations:

sage: x = R.pi()
sage: y = R.euler_constant()
sage: x + y
[3.718808318491326 +/- 6.85e-16]
sage: x * y
[1.813376492391603 +/- 9.04e-16]

more

Thanks Bruno. This is very helpful! I can now use functions like gamma and zeta as a CBF.method, however could not find how to e.g. add or multiply two CBF's together and get a new CBF, i.e. the basic algebra you could do in Arb doesn't seem to be supported (yet), right?

( 2018-03-29 13:54:32 +0100 )edit

Of course it is ;-), see my edit (and tell me if I didn't understand your question...)!

( 2018-03-29 14:24:01 +0100 )edit

Hey, hey, hey... :-) It does work indeed. Sagemath continues to impress me! I am actually aiming to code the Riemann Xi function (s=x+iy):

s/2*(s-1)*pi^(-s/2)*gamma(s/2)*zeta(s)


using complex Ballfields only.

Thanks B r u n o !

EDIT: Here is the 'ball' code for the Riemann Xi function. It is super fast (e.g. compared to pari)

x=1/3;y=200000
z  = CBF(x,y)
z2 = z/RBF(2)
n1 = RBF(1)
K  = z2*(z-n1)*RBF(pi)^(RBF(-1)*z2)*z2.gamma()*z.zeta()
CIF(K)

( 2018-03-29 15:25:31 +0100 )edit