Ask Your Question

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

asked 2018-03-28 17:43:30 -0500

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 04:11:56 -0500

B r u n o gravatar image

updated 2018-03-29 07:25:34 -0500

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 06:54:32 -0500 )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 07:24:01 -0500 )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 08:25:31 -0500 )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-28 17:43:30 -0500

Seen: 61 times

Last updated: Mar 29