First time here? Check out the FAQ!

Ask Your Question
0

Ghost numbers when using ARB

asked 1 year ago

RuudH gravatar image

updated 1 year ago

Maybe a very naive question, but when I code something like:

RDD=RealBallField(256)
RDD(3.1)*RDD(2.1)

I obtain:

[6.510000000000000461852778244065128704839826135899304117285652827862296732064351 +/- 9.03e-80]

as the output. Where does all the noise after the 15th digit come from and how could I get rid of it?

Or am I not allowed to increase the accuracy above 53 when using ARB in SageMath?

Preview: (hide)

2 Answers

Sort by » oldest newest most voted
2

answered 1 year ago

Max Alekseyev gravatar image

Note that number 3.1 has precision of 53 bits as an element of RDF and this precision is inherited by RDD object. Try this instead:

RDD("3.1")*RDD("2.1")
Preview: (hide)
link

Comments

Super! That does the trick :-)

RuudH gravatar imageRuudH ( 1 year ago )

Alternative :

sage: RDD(QQ(3.1))*RDD(QQ(2.1))
[6.510000000000000000000000000000000000000000000000000000000000000000000000000 +/- 3.82e-76]

HTH,

Emmanuel Charpentier gravatar imageEmmanuel Charpentier ( 1 year ago )
0

answered 1 year ago

RuudH gravatar image

updated 1 year ago

This is not an answer, but a possible clue that it is a problem of ARB and not the SageMath wrapper.

When I run this code in my IDE:

#include "flint/arb.h"

int main(int argc, char **argv)
{
    arb_t a;
    arb_init(a);

    slong prec;
    prec = 256;

    arb_set_d(a, 1.1);
    arb_printd(a, 40);
    printf("  WRONG \n");

    arb_set_str(a, "1.1", prec);
    arb_printd(a, 40);
    printf("  FINE \n");

    arb_set_d(a, 1);
    arb_printd(a, 40);
    printf("  FINE \n");

    arb_clear(a);
    return 0;
}

I obtain:

1.100000000000000088817841970012523233891 +/- 0  WRONG 
1.100000000000000000000000000000000000000 +/- 1.7272e-77  FINE 
1.000000000000000000000000000000000000000 +/- 0  FINE

This clearly shows that the issue originates from the "arb_det_d" function when fed with a non-integer value. I will ask about this on the FLINT GitHub issue list.

EDIT: Here is the ARB/Flint thread adequately explaining the observed phenomenon and showing my lack of understanding of what "inexactness" implies: https://github.com/flintlib/flint/iss...

Preview: (hide)
link

Comments

1

This is not an answer.

Max Alekseyev gravatar imageMax Alekseyev ( 1 year 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: 1 year ago

Seen: 251 times

Last updated: Feb 18 '24