Ask Your Question

Revision history [back]

QQ.extension() with embedding: incorrect modulus

Minimal Example:

print version() # get the version

ZX.<X>=ZZ[] # polynomials in X
f=X^3-X-1 # minimal polynomial of minimal Pisot
roots=f.complex_roots() # its roots
root_beta=roots[0] # the real root is first
print 'A:', root_beta # verify we got the real root

Qb.<ext_beta> = QQ.extension(f, embedding=root_beta) # make an extension
float_beta = CC(ext_beta) # convert to float
print 'B:', float_beta.abs()
print 'C:', ext_beta.abs() # why B != C ???

print 'D:', roots[1].abs() # it turns out that ext_beta.abs() gives the modulus of another root of f !!!

The problem is that ext_beta.abs() != CC(ext_beta).abs() for ext_beta the generator of an algebraic extension, which just doesn't sound right (and arises some problems of course).

I want to work in precise arithmetics, therefore I need to apply abs() without conversion to floats. Is there any way how to achieve this?

QQ.extension() with embedding: incorrect modulus

Minimal Example:

print version() # get the version

ZX.<X>=ZZ[] # polynomials in X
f=X^3-X-1 # minimal polynomial of minimal Pisot
roots=f.complex_roots() # its roots
root_beta=roots[0] # the real root is first
print 'A:', root_beta # verify we got the real root

Qb.<ext_beta> = QQ.extension(f, embedding=root_beta) # make an extension
float_beta = CC(ext_beta) # convert to float
print 'B:', float_beta.abs()
print 'C:', ext_beta.abs() # why B != C ???

print 'D:', roots[1].abs() # it turns out that ext_beta.abs() gives the modulus of another root of f !!!

Output:

Sage Version 6.1.1, Release Date: 2014-02-04
A: 1.32471795724475
B: 1.32471795724475
C: 0.868836961832709
D: 0.868836961832709

The problem is that ext_beta.abs() != CC(ext_beta).abs() for ext_beta the generator of an algebraic extension, which just doesn't sound right (and arises some problems of course).

I want to work in precise arithmetics, therefore I need to apply abs() without conversion to floats. Is there any way how to achieve this?

QQ.extension() with embedding: incorrect modulus

Minimal Example:

print version() # get the version

ZX.<X>=ZZ[] # polynomials in X
f=X^3-X-1 # minimal polynomial of minimal Pisot
roots=f.complex_roots() # its roots
root_beta=roots[0] # the real root is first
print 'A:', root_beta # verify we got the real root

Qb.<ext_beta> = QQ.extension(f, embedding=root_beta) # make an extension
float_beta = CC(ext_beta) # convert to float
print 'B:', float_beta.abs()
print 'C:', ext_beta.abs() # why B != C ???

print 'D:', roots[1].abs() # it turns out that ext_beta.abs() gives the modulus of another root of f !!!

Output:

Sage Version 6.1.1, Release Date: 2014-02-04
A: 1.32471795724475
B: 1.32471795724475
C: 0.868836961832709
D: 0.868836961832709

The problem is that ext_beta.abs() != CC(ext_beta).abs() for ext_beta the generator of an algebraic extension, which just doesn't sound right (and arises some problems of course).

I want to work in precise arithmetics, therefore I need to apply abs() without conversion to floats. Is there any way how to achieve this?

click to hide/show revision 4
retagged

QQ.extension() with embedding: incorrect modulus

Minimal Example:

print version() # get the version

ZX.<X>=ZZ[] # polynomials in X
f=X^3-X-1 # minimal polynomial of minimal Pisot
roots=f.complex_roots() # its roots
root_beta=roots[0] # the real root is first
print 'A:', root_beta # verify we got the real root

Qb.<ext_beta> = QQ.extension(f, embedding=root_beta) # make an extension
float_beta = CC(ext_beta) # convert to float
print 'B:', float_beta.abs()
print 'C:', ext_beta.abs() # why B != C ???

print 'D:', roots[1].abs() # it turns out that ext_beta.abs() gives the modulus of another root of f !!!

Output:

Sage Version 6.1.1, Release Date: 2014-02-04
A: 1.32471795724475
B: 1.32471795724475
C: 0.868836961832709
D: 0.868836961832709

The problem is that ext_beta.abs() != CC(ext_beta).abs() for ext_beta the generator of an algebraic extension, which just doesn't sound right (and arises some problems of course).

I want to work in precise arithmetics, therefore I need to apply abs() without conversion to floats. Is there any way how to achieve this?