2012/10/28 Charles Bouillaguet <charles.bouillag...@gmail.com>:
> Hi all,
>
> While playing with the quotient of a polynomial ring with an ideal, I 
> encountered several glitches.
>
> *) Trying to compute the inverse of something which is not invertible.
>
> I know it is kind of weird to try this. However, it raises a 
> NotImplementedError exception, instead of something more informative such as 
> NonInvertible or whatever. I am willing to patch this, but could someone tell 
> me what is the correct exception to raise?

Based on http://docs.python.org/2/library/exceptions.html, it should
be ValueError (unless Sage has a more precise error for this
situation, but I don't think so).

But in order to be able to raise a ValueError, you need to first
decide whether your element is invertible or not. If such a decision
mechanism is not implemented, then NotImplementedError is the only
possibility. And I guess that is the current situation here.

>
> *) Non-deterministic output of some (presumably deterministic) functions
>
> Here is an example :
>
> sage: R.<x1,x2> = QQ[]
> sage: I = R.ideal(x2**2 + x1 - 2, x1**2 - 1)
> sage: test = I.gen(0) + x2*I.gen(1)
> sage: (test).lift( I )
> [1, x2]                         # this is correct
>
> sage: R.<x1,x2> = QQ[]
> sage: I = R.ideal(x2**2 + x1 - 2, x1**2 - 1)
> sage: test = I.gen(0) + x2*I.gen(1)
> sage: (test + 1).lift( I )
> [0, 0]                       # this is correct

No it isn't, the correct output would be ValueError, as (test+1) is
not in I. So this is a bug in the "lift" method.

>
> sage: R.<x1,x2> = QQ[]
> sage: I = R.ideal(x2**2 + x1 - 2, x1**2 - 1)
> sage: test = I.gen(0) + x2*I.gen(1)
> sage: (test).lift( I )
> [0, 0]                       # this is WRONG !!! should be [1, x2]
>
> It looks like this could be a caching issue, so I am not sure whether I need 
> to open a new ticket for this, or if it is already "catch" by an 
> already-opened ticket.

It is some kind of corruption triggered by the abovementioned bug, so
it may vanish when that bug is fixed.

Here is a shortened version of your input:

sage: R.<x1,x2> = QQ[]
sage: I = R.ideal(x2**2 + x1 - 2, x1**2 - 1)
sage: test = I.gen(0) + x2*I.gen(1)
sage: test.lift(I) # correct
[1, x2]
sage: (test+1).lift(I) # invalid input, should give error
[0, 0]
sage: test.lift(I) # incorrect
[0, 0]



>
> *) Segfault
>
> The same kind of problem allows a small piece of code to cause segfaults in 
> SAGE (apparently in singular-related stuff) :
>
> sage: R.<x1,x2> = QQ[]
> sage: S = R.quotient_ring( R.ideal(x2**2 + x1 - 2, x1**2 - 1) )
> sage: 1 / S(x1 + x2)        # should raise NotImplementedError
> sage:
> sage: R.<x1,x2> = QQ[]
> sage: S = R.quotient_ring( R.ideal(x2**2 + x1 - 2, x1**2 - 1) )
> sage: S.is_integral_domain()
>
> ---> BOOM
>
> *) bizarre output of p.lift(….)
>
> When R is a Polynomial Ring, I is an ideal of R, and p is a polynomial of I, 
> then p.lift( I ) returns a polynomial combination of a (groebner) basis of I 
> which is equal to p. However, when p is not in I, then p.lift( I ) returns 
> [0,0,…,0]. I find this a bit strange. Should p.lift(…) raise an exception 
> instead? This would be a change of specification, so I guess it should be 
> discussed first…
>
>
>
>
> ---
> Charles Bouillaguet
> http://www.lifl.fr/~bouillaguet/
>
>
>
> --
> You received this message because you are subscribed to the Google Groups 
> "sage-devel" group.
> To post to this group, send email to sage-devel@googlegroups.com.
> To unsubscribe from this group, send email to 
> sage-devel+unsubscr...@googlegroups.com.
> Visit this group at http://groups.google.com/group/sage-devel?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To post to this group, send email to sage-devel@googlegroups.com.
To unsubscribe from this group, send email to 
sage-devel+unsubscr...@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel?hl=en.


Reply via email to