On Fri, Apr 13, 2018 at 11:47 AM, slelievre <samuel.lelie...@gmail.com> wrote: > Fri 2018-04-13 10:56:17 UTC, David Joyner: >> >> PS: About 3 years ago, a related question was posted: >> >> https://groups.google.com/forum/#!topic/sage-support/s59iDjhu2zU >> >> For some reason, the method described there is no longer implemented. > > Regarding the example in the discussion you point to, > a minor change gets it to work: instead of > > sage: C.cardinality() > > you can use > > sage: C.point_set().cardinality() > > Illustration below: > > Sage version: > > $ sage -v > SageMath version 8.2.rc1, Release Date: 2018-03-31 > > > Define the finite field F: > > sage: F.<q> = GF(13^2) > sage: F > Finite Field in q of size 13^2 > > The projective plane over F: > > sage: P2.<x,y,z> = toric_varieties.P2(base_ring=F) > sage: P2 > 2-d CPR-Fano toric variety covered by 3 affine patches > > The curve (as a scheme): > > sage: C = P2.subscheme(x^8 + y^8 + z^8) > sage: C > Closed subscheme of 2-d CPR-Fano toric variety covered by 3 affine > patches defined by: > x^8 + y^8 + z^8 > > Trying to get the cardinality fails for this scheme: > > sage: C.cardinality() > Traceback (most recent call last) > ... > AttributeError: 'AlgebraicScheme_subscheme_toric_with_category' object > has no attribute 'cardinality' > > We need to go through the point set: > > sage: P = C.point_set() > sage: P > Set of rational points of Closed subscheme of 2-d CPR-Fano toric variety > covered by 3 affine patches defined by: > x^8 + y^8 + z^8 > > Now we can get the cardinality: > > sage: c = P.cardinality() > sage: c > 512 >

## Advertising

True, but compare these times! sage: F.<q> = GF(3^7) sage: P2.<x,y,z> = toric_varieties.P2(base_ring=F) sage: C = P2.subscheme(x^8 + y^8 + z^8) sage: time C.point_set().cardinality() CPU times: user 3h 29min 7s, sys: 18 s, total: 3h 29min 25s Wall time: 5h 59min 54s 2188 sage: sage: x,y,z = PolynomialRing(GF(3^7), 3, 'xyz').gens() sage: C = Curve(z^8 + y^8 + x^8) sage: time Cpts = C.rational_points(); len(Cpts) CPU times: user 10.8 s, sys: 197 ms, total: 11 s Wall time: 10.8 s sage: len(Cpts) 2188 > -- > You received this message because you are subscribed to the Google Groups > "sage-support" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to sage-support+unsubscr...@googlegroups.com. > To post to this group, send email to sage-support@googlegroups.com. > Visit this group at https://groups.google.com/group/sage-support. > For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups "sage-support" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-support+unsubscr...@googlegroups.com. To post to this group, send email to sage-support@googlegroups.com. Visit this group at https://groups.google.com/group/sage-support. For more options, visit https://groups.google.com/d/optout.