Ask Your Question
0

Ghost numbers when using ARB

asked 2024-02-18 18:27:56 +0200

RuudH gravatar image

updated 2024-02-18 18:34:12 +0200

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?

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
2

answered 2024-02-18 23:06:54 +0200

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")
edit flag offensive delete link more

Comments

Super! That does the trick :-)

RuudH gravatar imageRuudH ( 2024-02-18 23:17:21 +0200 )edit

Alternative :

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

HTH,

Emmanuel Charpentier gravatar imageEmmanuel Charpentier ( 2024-02-19 10:48:48 +0200 )edit
0

answered 2024-02-18 19:57:06 +0200

RuudH gravatar image

updated 2024-02-18 23:20:42 +0200

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...

edit flag offensive delete link more

Comments

1

This is not an answer.

Max Alekseyev gravatar imageMax Alekseyev ( 2024-02-18 23:08:48 +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

Stats

Asked: 2024-02-18 18:27:56 +0200

Seen: 134 times

Last updated: Feb 18