## Digits and giacpy

jocaps
Messages : 118
Inscription : lun. avr. 17, 2017 4:32 pm

### Digits and giacpy

Hi,

It seems that giacpy only gives me python float precision when solving numerical values (eg. with proot and froot). Consider the following code

Code : Tout sélectionner

``````from giacpy import giac, proot

giac("printpow(1)")
giac("Digits := 38")
giac("Digits") #tells me if giac indeed set the precision to 38 digits
#outputs 38

proot("x^4+x+1")
#outputs [-0.7271360844912-0.43001428832972*i,-0.7271360844912+0.43001428832972*i,0.7271360844912-0.93409928946053*i,0.7271360844912+0.93409928946053*i]
``````
The output in pari has ca. 12 digit precision. How do I get the 38 digit precision?

Jose

frederic han
Messages : 1113
Inscription : dim. mai 20, 2007 7:09 am
Localisation : Paris
Contact :

### Re:

But it is the same in icas or xcas, it is not typical of giacpy.
so I think it just means that proot doesn't use higher precision.
Right?

parisse
Messages : 5346
Inscription : mar. déc. 20, 2005 4:02 pm
Contact :

### Re:

Run proot(expression,n) where n is an integer for more precision.

jocaps
Messages : 118
Inscription : lun. avr. 17, 2017 4:32 pm

### Re:

parisse a écrit :Run proot(expression,n) where n is an integer for more precision.
Nice one! Thanks. I have more precision now . BTW, can you remind me again how to express a symbol "x" as an algebraic element corresponding to a root (modulo conjugate) of a polynomial. I forgot this. So for instance I want to use

x=some root of f(x) (encoded as algebraic integer, not a float)

then

x+conj(x) (if this is possible in giac) and eventually feed it to pari and check what is the minimal polynomial of such a (real) algebraic number.

Edit: Actually.. I'm an idiot. Nevertheless it is interesting for me to know how to represent algebraic numbers in giac. For my specific case (minimal polynomial of say the real part of an algebraic number) I can take the resultant of f(x), f(z-x) over x, where f(x) is the minimal polynomial of the algebraic number I am interested in. From this resultant (polynomail with variable z) I can deduce the minimal polynomial of the real part (or twice of it, but there is another trick to get the real part).