Ask Your Question

tohecz's profile - activity

2017-09-06 00:35:45 -0600 received badge  Popular Question (source)
2014-11-18 05:26:02 -0600 received badge  Nice Question (source)
2014-11-13 07:14:22 -0600 commented answer Comparing numbers in an algebraic field

Thanks Thierry. Actually what is even stranger is that `floor(x-y)>=0` works well in place of `x>=y`. The problem with `AA` is that there seem to be some memory leaks :-/

2014-11-12 13:25:40 -0600 asked a question Comparing numbers in an algebraic field

I get a very strange results from comparison of number in an algebraic field, see the example:

version()
X = polygen(ZZ)
f = X^3 - 2*X^2 - 2*X - 2
Qb.<b> = QQ.extension(f, embedding=3)

b.N() # b is positive
0 < b # gives False; why?
0 < 1 # gives True; fine
Qb(0) < Qb(1) # gives False; WTF?

sage: version()
'Sage Version 6.1.1, Release Date: 2014-02-04'
sage: X = polygen(ZZ)
sage: f = X^3 - 2*X^2 - 2*X - 2
sage: Qb.<b> = QQ.extension(f, embedding=3)
sage: 
sage: b.N() # b is positive
2.91963956583942
sage: 0 < b # gives False; why?
False
sage: 0 < 1 # gives True; fine
True
sage: Qb(0) < Qb(1) # gives False; WTF?
False
sage:

Can I do something to obtain the correct results of comparison, or is using the flawed .N() the only option?

2014-06-29 11:53:35 -0600 received badge  Notable Question (source)
2014-06-29 11:53:35 -0600 received badge  Popular Question (source)
2014-06-29 06:38:06 -0600 received badge  Popular Question (source)
2014-06-29 06:38:06 -0600 received badge  Notable Question (source)
2014-06-29 06:38:06 -0600 received badge  Famous Question (source)
2014-04-17 02:26:42 -0600 commented question QQ.extension() with embedding: incorrect modulus

Thanks @Francis for pointing it out, I wasn't aware that this is the issue! And you're welcome, Thierry :)

2014-04-11 00:38:29 -0600 received badge  Editor (source)
2014-04-11 00:34:40 -0600 asked a question 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?

2014-04-10 14:01:10 -0600 received badge  Student (source)
2013-12-31 14:04:48 -0600 received badge  Scholar (source)
2013-12-31 14:04:48 -0600 marked best answer Running sage --testall in parallel

It is possible to run the doctests in parallel, see this page. In your case, you can use the -tp 4 --all option.

2013-12-31 14:04:46 -0600 received badge  Supporter (source)
2013-12-29 04:07:33 -0600 asked a question Running sage --testall in parallel

Hello there! After an install of sage from binaries (Fedora20), I ran sage --testall. However, it takes quite a lot of time (3000s). I have 4 processors and running this in parallel would shorten it significantly (and it should be easily possible to run the tests in parallel).

Therefore my question: Can I run the tests in parallel? And how?