Digits and giacpy

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

Digits and giacpy

Message par jocaps » mer. juin 06, 2018 9:01 pm

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:

Message par frederic han » mar. juin 12, 2018 1:10 pm

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 : 5082
Inscription : mar. déc. 20, 2005 4:02 pm
Contact :

Re:

Message par parisse » mer. juin 13, 2018 7:49 am

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

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

Re:

Message par jocaps » jeu. juin 14, 2018 11:03 am

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

Répondre