First time here? Check out the FAQ!

Ask Your Question
1

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

asked 7 years ago

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:

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.

Preview: (hide)

1 Answer

Sort by » oldest newest most voted
2

answered 7 years ago

B r u n o gravatar image

updated 7 years ago

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]
Preview: (hide)
link

Comments

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 ( 7 years ago )

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 ( 7 years ago )

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)
RuudH gravatar imageRuudH ( 7 years ago )

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

Stats

Asked: 7 years ago

Seen: 505 times

Last updated: Mar 29 '18