I forward the following from sage-support because I know to little to
answer those issues competently and I also think those questions
shouldn't pass uncommented:
From: 
http://groups.google.com/group/sage-support/browse_thread/thread/c46950723108a191#

Hi there,

here are some bugs which may or may not be already known. If they are
new, could you please file them wherever such bugs need to be filed?
Or
if they are not bugs but wrong usage, could you explain to me what I
should type instead?

I am still working with version 4.7.1, so some remarks might be
obsolete
already. (Sorry about that.)

1.  When I have rational functions over a field [or over an integral
domain], I expect that the denominator is made monic [or the content
of
numerator and denominator coprime]. This is not always happening. For
example:

sage: R.<x> = QQ[]
sage: (2*x+4)/(4*x-8)
(2*x + 4)/(4*x - 8)  # bad
sage: R.<x> = ZZ[]
sage: (2*x+4)/(4*x-8)
(x + 2)/(2*x - 4)  # good

Although mathematically correct, I consider this as a bug, because not
bringing rational functions to normal form can easily lead to
ridiculous
expression swell. For example:

sage: R1.<x> = QQ[]
sage: R2.<y> = R1.fraction_field()[]
sage: K = R2.fraction_field()

sage: def canonic(rat):
     num, den = rat.numerator(), rat.denominator()
     clear = lcm(num.denominator(), den.denominator())
     num, den = num*clear, den*clear
     clear = map(lambda p: p.numerator().coeffs(), \
                 num.coeffs() + den.coeffs())
     clear = lcm([a.denominator() for b in clear for a in b])
     num, den = num*clear, den*clear
     x = rat.parent().gen()
     t = rat.parent().base_ring().gen()
     return rat.parent()(ZZ[t,x](num)/ZZ[t,x](den))

sage: d = K.random_element().derivative(y).derivative(x);
sage: len(str(d))
919274
sage: len(str(canonic(d)))
8371

2.  A coercion problem?

sage: K = QQ[x].fraction_field()
sage: R.<y> = K[]
sage: S = QuotientRing(R, R.ideal(y^2-(x^2+1)))
sage: ybar = S.gen()
sage: S(y) # works
ybar
sage: 1/ybar # works
(-1/(-x^2 - 1))*ybar
sage: S(1/y) # doesn't work
*** output flushed ***
TypeError: denominator must be a unit

3.  Another coercion problem?

sage: R0 = QQ['t'].fraction_field(); t = R0.gen()
sage: R1 = R0['x'].fraction_field(); x = R1.gen()
sage: R2 = R1['y']; y = R2.gen()
sage: R = QuotientRing(R2, R2.ideal(y^2-(x+t)))
sage: ybar = R.gen()
sage: ybar^2 # works
x + t
sage: ybar + x # works
ybar + x
sage: ybar * x # doesn't work
*** output flushed ***
NotImplementedError:
sage: ybar*R(x) # works
x*ybar

4.  A bug in LCM:

sage: u = QQ['u'].gen(); v = QQ[u].fraction_field()['v'].gen()
sage: pol = ((u^2 - u - 1)/(-1/5*u^2 - u - 1))*v^2 + ((4/9*u^2 -
1/2)/(1/2*u - 2))*v + (2*u^2 - 1/2*u - 1/3)/(-2*u^2 - 5*u - 1/2)
sage: lcm(pol, 1)
*** output flushed ***
TypeError: denominator must be a unit

5.  The universe of a factorization cannot be changed if the
factorization happens to be empty.

sage: factor(2).base_change(ZZ['t','x']).universe()
Multivariate Polynomial Ring in t, x over Integer Ring # correct
sage: factor(1).base_change(ZZ['t','x']).universe()
Integer Ring # incorrect

6.  Resultants for elements of Quot(ZZ[t])[x,y] crash.

sage: K = ZZ['t'].fraction_field(); t = K.gen()
sage: R = K['x', 'y']; x,y = R.gens()
sage: R.random_element().resultant(R.random_element(), y)
*** Output flushed ***
TypeError: denominator must be a unit

7.  Nullspace for matrices over finite fields is unreasonably slow

sage: M = MatrixSpace(GF(2^31-1), 1000, 1001).random_element();
sage: %time M.right_kernel();
CPU times: user 165.71 s, sys: 0.01 s, total: 165.73 s
Wall time: 166.20 s

Mathematica does this almost 20 times as fast:

In[5]:= mat = Table[RandomInteger[{0,2^31-1}], {n,0,1000},{k,0,1001}];
In[6]:= Timing[NullSpace[mat, Modulus -> 2^31-1];]
Out[6]= {8.98856, Null}

And here is a wish list of some things that I would find convenient to
have, but didn't find.

1.  a method .derivative for quotient ring elements, with which
algebraic functions can be differentiated.

2.  a method Factorization.square_free_part

3.  a possibility to specify a variable in the method .minpoly for
quotient ring elements. It is confusing that this method takes 'x' as
variable for the minimal polynomial even if there is already an 'x' in
the ground field.

Thanks & best regards,
Manuel

-- 
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org

Reply via email to