Bug in genus of an ideal

24 views
Skip to first unread message

VictorMiller

unread,
Nov 21, 2010, 12:22:36 AM11/21/10
to sage-support
sage: T.<t1,t2,u1,u2> = QQ[]
sage: TJ = Ideal([t1^2 + u1^2 - 1,t2^2 + u2^2 - 1, (t1-t2)^2 + (u1-
u2)^2 -1])
sage: TJ.genus()
4294967295
sage: TJ.dimension()
1

I'm very skeptical about that answer (I realize that Singular is doing
the calculation) especially since (for example). Even if it's
calculating arithmetic genus I can't imagine that that curve could
have that many singularities.

sage: TK = Ideal([t1^2/4 + u1^2 - 1,t2^2/4 + u2^2 - 1, (t1-t2)^2 + (u1-
u2)^2 -1])
sage: TK.genus()
3
sage: TK.dimension()
1

JamesHDavenport

unread,
Nov 21, 2010, 12:45:30 PM11/21/10
to sage-support
The fact that the number of singularities quoted is precisely 2^32-1
makes me suspect a faulty return fo -1 from somewhere.

luisfe

unread,
Nov 22, 2010, 3:12:03 AM11/22/10
to sage-support


On Nov 21, 6:22 am, VictorMiller <victorsmil...@gmail.com> wrote:
> sage: T.<t1,t2,u1,u2> = QQ[]
> sage: TJ = Ideal([t1^2 + u1^2 - 1,t2^2 + u2^2 - 1, (t1-t2)^2 + (u1-
> u2)^2 -1])
> sage: TJ.genus()
> 4294967295
> sage: TJ.dimension()
> 1

Yes, there is a bug in the code. If I try Sage 32 bits, the answer to
TJ.genus() is -1. Is I use Sage 64 bits I get your result.

The genus -1 looks like the ideal is not (absolutely) prime. This
looks odd at first sight since the ideal is prime over the rationals
and the projection onto [t1,t2] or [u1,u2] gives rational curves.
But, after a little research the answer looks right.

sage: T.<t1,t2,u1,u2,t>=QQ[sqrt(3)][]
sage: TJ = Ideal([t1^2 + u1^2 - 1,t2^2 + u2^2 - 1, (t1-t2)^2 + (u1-
u2)^2 -1])
sage: TJ.is_prime()
False
sage: TJ.primary_decomposition()
[Ideal (3*t2 + (-2*sqrt3)*u1 + (sqrt3)*u2, 3*t1 + (-sqrt3)*u1 +
(2*sqrt3)*u2, 4*u1^2 - 4*u1*u2 + 4*u2^2 - 3) of Multivariate
Polynomial Ring in t1, t2, u1, u2, t over Number Field in sqrt3 with
defining polynomial x^2 - 3, Ideal (3*t2 + (2*sqrt3)*u1 + (-sqrt3)*u2,
3*t1 + (sqrt3)*u1 + (-2*sqrt3)*u2, 4*u1^2 - 4*u1*u2 + 4*u2^2 - 3) of
Multivariate Polynomial Ring in t1, t2, u1, u2, t over Number Field in
sqrt3 with defining polynomial x^2 - 3]

The ideal is the union of two rational conjugate curves.

VictorMiller

unread,
Nov 22, 2010, 7:07:01 PM11/22/10
to sage-support
Thanks! Then perhaps Sage should raise an exception when it gets back
genus -1 from singular.

Victor

Martin Albrecht

unread,
Nov 23, 2010, 5:56:20 AM11/23/10
to sage-s...@googlegroups.com
On Tuesday 23 November 2010, VictorMiller wrote:
> Thanks! Then perhaps Sage should raise an exception when it gets back
> genus -1 from singular.

Here's what Hannes Schönemann from the Singular team replied to me when I
reported this on [libsingular-devel]:

"""
Singular uses (currently) 32bit int on all platforms.
Here our overflow detection represents -1 as a result of a subtraction
as 4294967295.
Fix (in Singular/iparith.cc, routine jjMINUS_I):
--- iparith.cc (Revision 13661)
+++ iparith.cc (Arbeitskopie)
@@ -697,14 +697,18 @@
}
static BOOLEAN jjMINUS_I(leftv res, leftv u, leftv v)
{
- unsigned int a=(unsigned int)(unsigned long)u->Data();
- unsigned int b=(unsigned int)(unsigned long)v->Data();
+ void *ap=u->Data(); void *bp=v->Data();
+ int aa=(int)(long)ap;
+ int bb=(int)(long)bp;
+ int cc=aa-bb;
+ unsigned int a=(unsigned int)(unsigned long)ap;
+ unsigned int b=(unsigned int)(unsigned long)bp;
unsigned int c=a-b;
if (((Sy_bit(31)&a)!=(Sy_bit(31)&b))&&((Sy_bit(31)&a)!=(Sy_bit(31)&c)))
{
WarnS("int overflow(-), result may be wrong");
}
- res->data = (char *)((long)c);
+ res->data = (char *)((long)cc);
return jjPLUSMINUS_Gen(res,u,v);
}
"""

It seems with the new patch the overflow would at least be detected? Can you
give it a try?

Cheers,
Martin

--
name: Martin Albrecht
_pgp: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x8EF0DC99
_otr: 47F43D1A 5D68C36F 468BAEBA 640E8856 D7951CCF
_www: http://martinralbrecht.wordpress.com/
_jab: martinr...@jabber.ccc.de

kro...@uni-math.gwdg.de

unread,
Jan 27, 2014, 8:29:37 AM1/27/14
to sage-s...@googlegroups.com, martinr...@googlemail.com
This is probably a late comment,

but genus() in Singular is also known for containing bugs,
see tickets
http://www.singular.uni-kl.de:8002/trac/ticket/259,
http://www.singular.uni-kl.de:8002/trac/ticket/469


Jack

Georgi Guninski

unread,
Jan 27, 2014, 9:14:38 AM1/27/14
to sage-s...@googlegroups.com
On Mon, Jan 27, 2014 at 05:29:37AM -0800, kro...@uni-math.gwdg.de wrote:
> This is probably a late comment,
>
> but genus() in Singular is also known for containing bugs,
> see tickets
> http://www.singular.uni-kl.de:8002/trac/ticket/259,
> http://www.singular.uni-kl.de:8002/trac/ticket/469
>
>

geometric genus in Singular is known to be quite broken.

especially in number fields and not counting crashes.


Reply all
Reply to author
Forward
0 new messages