Ask Your Question

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

asked 2018-03-29 00:43:30 +0200

RuudH gravatar image

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:


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?


edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2018-03-29 11:11:56 +0200

B r u n o gravatar image

updated 2018-03-29 14:25:34 +0200

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.

[edit] 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]
edit flag offensive delete link 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?

RuudH gravatar imageRuudH ( 2018-03-29 13:54:32 +0200 )edit

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

B r u n o gravatar imageB r u n o ( 2018-03-29 14:24:01 +0200 )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):


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)

z  = CBF(x,y)
z2 = z/RBF(2)
n1 = RBF(1)
K  = z2*(z-n1)*RBF(pi)^(RBF(-1)*z2)*z2.gamma()*z.zeta()
RuudH gravatar imageRuudH ( 2018-03-29 15:25:31 +0200 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2018-03-29 00:43:30 +0200

Seen: 352 times

Last updated: Mar 29 '18