[sage-support] Re: EC question

2024-05-01 Thread John Cremona
False alarm -- the current version of Safe computes this correctly,
presumably because of the bugfix I made.

So this is no longer a Sage issue, but the LMFDB will need to be corrected.

John

On Wed, 1 May 2024 at 08:51, John Cremona  wrote:

> This looks like the same bug as I reported at
> https://github.com/sagemath/sage/issues/36780 five months ago and
> supposedly fixed via a PR (https://github.com/sagemath/sage/pull/36786).
> It's the same bug (over Q(sqrt(5)), j=0, missing a 5-isogeny) so clearly my
> fix was incorrect.
>
> The curve is defined by
> sage: K. = NumberField(x^2-5)
> sage: t = -4320 - 1944*r
> sage: E = EllipticCurve([0, -27*t^2, 0, 216*t^3*(t - 27), -432*t^4*(t -
> 27)^2])
> sage: E.has_cm()
> True
> sage: E.cm_discriminant()
> -75
> sage: C = E.isogeny_class()
> sage: len(C)
> 6
> sage: C.matrix()[0]
> (1, 25, 75, 3, 5, 15)
>
> This is all correct, the class has size 6 and 3- and 5- isogenies suffice
> to fill it.  But the class contains two curves defined over Q for example
> sage: E1 = C[5]; E1.ainvs()
> (0, 0, 1, 0, 1)
> sage: E1.j_invariant()
> 0
> sage: E1.base_field() == K
> True
>
> and computing the isogeny class starting with E1 does not find the whole
> class as it misses 5-isogenies:
>
> sage: len(E1.isogeny_class())
> 2
>
> The problem is in the function possible_isogeny_degrees_cm():
> sage: from sage.schemes.elliptic_curves.isogeny_class import
> isogeny_degrees_cm
> sage: isogeny_degrees_cm(E1, verbose=True)
> CM case, discriminant = -3
> initial primes: {2, 3}
> ramified primes: {3}
> downward split primes: {}
> downward inert primes: {}
> Complete set of primes: {2, 3}
> [2, 3]
>
> Here, "downward" primes are sgrees of isogenies to curves with a strictly
> smaller endomorphism ring and in this case should inlude 5.  I cannot right
> now see the error in the code but am building the current development
> branch and will sort this out.
>
> John
>
> On Tue, 30 Apr 2024 at 17:08, John Cremona  wrote:
>
>> I can confirm that your curve is isogenous (and not isomorphic) to the
>> ones in the LMFDB.  The isogeny class computed by Sage from your curve has
>> 6 curves in it.  That means that there is a bug in Sage's isogeny class
>> code -- which I wrote most of.  I hope that it is something specific to
>> j-invariant 0, which is (as always) treated separately.
>>
>> I will investigate the Sage bug, and when it is fixed I will recompute
>> all the isogeny classes in the LMFDB.  This will not be done very soon.
>>
>> Thanks for the report!
>>
>> John
>>
>> On Tue, 30 Apr 2024 at 16:42, Zhengyu Tao 
>> wrote:
>>
>>> Thanks for your reply! The coefficients of my curve is [0, -27*t^2, 0,
>>> 216*t^3*(t - 27), -432*t^4*(t - 27)^2] with t = -4320 - 1944\sqrt{5}.
>>>
>>> -- Original --
>>> *From: * "John Cremona";
>>> *Date: * Tue, Apr 30, 2024 11:35 PM
>>> *To: * "John Jones";
>>> *Cc: * "lmfdb-support"; "taozhy"<
>>> tao...@smail.nju.edu.cn>;
>>> *Subject: * Re: EC question
>>>
>>> The isogeny classes in the LMFDB are supposed to be complete.  I see
>>> that curve 2.2.5.1-2025.1-d2 has coefficients (0, 0, 1, 0, -34) while the
>>> isogenous curve d1 has coefficients (0, 0, 1, 0, 1), both with j-invariant
>>> 0 and conductor (45) over this field.   They are quadratic twists of each
>>> other by -3.
>>>
>>> What are the coefficients of the curve you have?  If it is not
>>> isomorphic to either of these then there is a bug in Sage, which was used
>>> to compute the isogeny classes.
>>>
>>> John Cremona
>>>
>>> On Tue, 30 Apr 2024 at 16:08, John Jones  wrote:
>>>
>>>> From the feedback page:
>>>>
>>>> Hi LMFDB devs,
>>>>
>>>> In a recent problem I'm working on, I need to compute a (CM) elliptic
>>>> curve over Q(\sqrt{5}). When I searched it in LMFDB, it seems that it is
>>>> not included. However, I found that my curve seems isogenous (over
>>>> Q(\sqrt{5})) to the curve 2.2.5.1-2025.1-d2. In fact, I have constructed
>>>> the isogeny from my curve to 2.2.5.1-2025.1-d2 using velu'formula.
>>>>
>>>> My qusetion is: is the isogeny classes in LMFDB complete? I.e., is each
>>>> isomorphism class (over the base field) in a isogeny class has a
>>>> representative in LMFDB's "isogeny class"?
>>>>
>>>> Best regards,
>>>>

[sage-support] Re: EC question

2024-05-01 Thread John Cremona
This looks like the same bug as I reported at
https://github.com/sagemath/sage/issues/36780 five months ago and
supposedly fixed via a PR (https://github.com/sagemath/sage/pull/36786).
It's the same bug (over Q(sqrt(5)), j=0, missing a 5-isogeny) so clearly my
fix was incorrect.

The curve is defined by
sage: K. = NumberField(x^2-5)
sage: t = -4320 - 1944*r
sage: E = EllipticCurve([0, -27*t^2, 0, 216*t^3*(t - 27), -432*t^4*(t -
27)^2])
sage: E.has_cm()
True
sage: E.cm_discriminant()
-75
sage: C = E.isogeny_class()
sage: len(C)
6
sage: C.matrix()[0]
(1, 25, 75, 3, 5, 15)

This is all correct, the class has size 6 and 3- and 5- isogenies suffice
to fill it.  But the class contains two curves defined over Q for example
sage: E1 = C[5]; E1.ainvs()
(0, 0, 1, 0, 1)
sage: E1.j_invariant()
0
sage: E1.base_field() == K
True

and computing the isogeny class starting with E1 does not find the whole
class as it misses 5-isogenies:

sage: len(E1.isogeny_class())
2

The problem is in the function possible_isogeny_degrees_cm():
sage: from sage.schemes.elliptic_curves.isogeny_class import
isogeny_degrees_cm
sage: isogeny_degrees_cm(E1, verbose=True)
CM case, discriminant = -3
initial primes: {2, 3}
ramified primes: {3}
downward split primes: {}
downward inert primes: {}
Complete set of primes: {2, 3}
[2, 3]

Here, "downward" primes are sgrees of isogenies to curves with a strictly
smaller endomorphism ring and in this case should inlude 5.  I cannot right
now see the error in the code but am building the current development
branch and will sort this out.

John

On Tue, 30 Apr 2024 at 17:08, John Cremona  wrote:

> I can confirm that your curve is isogenous (and not isomorphic) to the
> ones in the LMFDB.  The isogeny class computed by Sage from your curve has
> 6 curves in it.  That means that there is a bug in Sage's isogeny class
> code -- which I wrote most of.  I hope that it is something specific to
> j-invariant 0, which is (as always) treated separately.
>
> I will investigate the Sage bug, and when it is fixed I will recompute all
> the isogeny classes in the LMFDB.  This will not be done very soon.
>
> Thanks for the report!
>
> John
>
> On Tue, 30 Apr 2024 at 16:42, Zhengyu Tao  wrote:
>
>> Thanks for your reply! The coefficients of my curve is [0, -27*t^2, 0,
>> 216*t^3*(t - 27), -432*t^4*(t - 27)^2] with t = -4320 - 1944\sqrt{5}.
>>
>> -- Original --
>> *From: * "John Cremona";
>> *Date: * Tue, Apr 30, 2024 11:35 PM
>> *To: * "John Jones";
>> *Cc: * "lmfdb-support"; "taozhy"<
>> tao...@smail.nju.edu.cn>;
>> *Subject: * Re: EC question
>>
>> The isogeny classes in the LMFDB are supposed to be complete.  I see
>> that curve 2.2.5.1-2025.1-d2 has coefficients (0, 0, 1, 0, -34) while the
>> isogenous curve d1 has coefficients (0, 0, 1, 0, 1), both with j-invariant
>> 0 and conductor (45) over this field.   They are quadratic twists of each
>> other by -3.
>>
>> What are the coefficients of the curve you have?  If it is not isomorphic
>> to either of these then there is a bug in Sage, which was used to compute
>> the isogeny classes.
>>
>> John Cremona
>>
>> On Tue, 30 Apr 2024 at 16:08, John Jones  wrote:
>>
>>> From the feedback page:
>>>
>>> Hi LMFDB devs,
>>>
>>> In a recent problem I'm working on, I need to compute a (CM) elliptic
>>> curve over Q(\sqrt{5}). When I searched it in LMFDB, it seems that it is
>>> not included. However, I found that my curve seems isogenous (over
>>> Q(\sqrt{5})) to the curve 2.2.5.1-2025.1-d2. In fact, I have constructed
>>> the isogeny from my curve to 2.2.5.1-2025.1-d2 using velu'formula.
>>>
>>> My qusetion is: is the isogeny classes in LMFDB complete? I.e., is each
>>> isomorphism class (over the base field) in a isogeny class has a
>>> representative in LMFDB's "isogeny class"?
>>>
>>> Best regards,
>>> Zhengyu Tao
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "lmfdb-support" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to lmfdb-support+unsubscr...@googlegroups.com.
>>> To view this discussion on the web, visit
>>> https://groups.google.com/d/msgid/lmfdb-support/CAJciYuQy0AS%3D29ceGLXnAxgMt5Z_01VQj5nom5WHU4kH%3Djf6uA%40mail.gmail.com
>>> <https://groups.google.com/d/msgid/lmfdb-support/CAJciYuQy0AS%3D29ceGLXnAxgMt5Z_01VQj5nom5WHU4kH%3Djf6uA%40mail.gmail.com?utm_medium=email_source=footer>
>>> .
>>>
>>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-support/CAD0p0K5qJt_u1hHsJBS%2Boukk6yJfwF6R-OyB5eRsQzWBxgSjhQ%40mail.gmail.com.


[sage-support] Re: EC question

2024-04-30 Thread John Cremona
I can confirm that your curve is isogenous (and not isomorphic) to the ones
in the LMFDB.  The isogeny class computed by Sage from your curve has 6
curves in it.  That means that there is a bug in Sage's isogeny class code
-- which I wrote most of.  I hope that it is something specific to
j-invariant 0, which is (as always) treated separately.

I will investigate the Sage bug, and when it is fixed I will recompute all
the isogeny classes in the LMFDB.  This will not be done very soon.

Thanks for the report!

John

On Tue, 30 Apr 2024 at 16:42, Zhengyu Tao  wrote:

> Thanks for your reply! The coefficients of my curve is [0, -27*t^2, 0,
> 216*t^3*(t - 27), -432*t^4*(t - 27)^2] with t = -4320 - 1944\sqrt{5}.
>
> -- Original --
> *From: * "John Cremona";
> *Date: * Tue, Apr 30, 2024 11:35 PM
> *To: * "John Jones";
> *Cc: * "lmfdb-support"; "taozhy"<
> tao...@smail.nju.edu.cn>;
> *Subject: * Re: EC question
>
> The isogeny classes in the LMFDB are supposed to be complete.  I see
> that curve 2.2.5.1-2025.1-d2 has coefficients (0, 0, 1, 0, -34) while the
> isogenous curve d1 has coefficients (0, 0, 1, 0, 1), both with j-invariant
> 0 and conductor (45) over this field.   They are quadratic twists of each
> other by -3.
>
> What are the coefficients of the curve you have?  If it is not isomorphic
> to either of these then there is a bug in Sage, which was used to compute
> the isogeny classes.
>
> John Cremona
>
> On Tue, 30 Apr 2024 at 16:08, John Jones  wrote:
>
>> From the feedback page:
>>
>> Hi LMFDB devs,
>>
>> In a recent problem I'm working on, I need to compute a (CM) elliptic
>> curve over Q(\sqrt{5}). When I searched it in LMFDB, it seems that it is
>> not included. However, I found that my curve seems isogenous (over
>> Q(\sqrt{5})) to the curve 2.2.5.1-2025.1-d2. In fact, I have constructed
>> the isogeny from my curve to 2.2.5.1-2025.1-d2 using velu'formula.
>>
>> My qusetion is: is the isogeny classes in LMFDB complete? I.e., is each
>> isomorphism class (over the base field) in a isogeny class has a
>> representative in LMFDB's "isogeny class"?
>>
>> Best regards,
>> Zhengyu Tao
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "lmfdb-support" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to lmfdb-support+unsubscr...@googlegroups.com.
>> To view this discussion on the web, visit
>> https://groups.google.com/d/msgid/lmfdb-support/CAJciYuQy0AS%3D29ceGLXnAxgMt5Z_01VQj5nom5WHU4kH%3Djf6uA%40mail.gmail.com
>> <https://groups.google.com/d/msgid/lmfdb-support/CAJciYuQy0AS%3D29ceGLXnAxgMt5Z_01VQj5nom5WHU4kH%3Djf6uA%40mail.gmail.com?utm_medium=email_source=footer>
>> .
>>
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-support/CAD0p0K5jOXaG3ex1st9yTs%3D9BFUN2oRSopExN%3D5qnmWSHX3Wag%40mail.gmail.com.


[sage-support] Re: Possible error: isogeny classes

2023-11-26 Thread John Cremona
https://github.com/sagemath/sage/issues/36780

On Saturday, 25 November 2023 at 15:11:53 UTC John Cremona wrote:

> Thanks for this report, which certainly indicates a bug.  I will look into 
> it as the code here was written by me.  I note that the two curves have CM 
> (by the order of index 5 and the maximal order in Q(sqrt(-3)) 
> respectively), and the code to deal with isogenies is different in this 
> case. The relevant function is isogeny_degrees_cm(), imported 
> from sage.schemes.elliptic_curves.isogeny_class.  And for some reason that 
> function is not including the valid isogeny prime 5.
>
> If you do F.isogeny_class(reducible_primes=[3,5]) you get the same as for 
> E (but you have to so that in a fresh Sage session becauses of caching of 
> previously computed results).
>
> John Cremona
>
> On Friday, 24 November 2023 at 03:50:54 UTC hbetx9 wrote:
>
>> Hi, 
>>  
>>  In some work on isogeny clases, my team ran across the following of two 
>> elliptic curves which are isogenous but sage reports different isogeny 
>> classes for them. Is there some  technicalities (j = 0) leading to 
>> incorrect output or is this something that we should flag a bug? 
>>
>> sage: L5. = NumberField(x^2-5)
>>
>> sage: E = 
>> EllipticCurve(L5,[287275052073119826051072\*r5-642366544675288047943680,-125329261653845158603060848774610944\*r5+280244748627855491701953075326484480])
>>
>> sage: F = EllipticCurve(L5,[0,-4325477943600\*r5-4195572876000])
>>
>> sage: E.isogeny_class().matrix()
>> [ 1 25 75  3  5 15]
>> [25  1  3 75  5 15]
>> [75  3  1 25 15  5]
>> [ 3 75 25  1 15  5]
>> [ 5  5 15 15  1  3]
>> [15 15  5  5  3  1]
>>
>> sage: F.isogeny_class().matrix()
>> [1 3]
>> [3 1]
>>
>> sage: E.is_isogenous(F)
>> True
>>
>> Best,
>> Lance
>>
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-support/ec0aba44-faaf-4bb0-a5d4-e6bd027131a5n%40googlegroups.com.


[sage-support] Re: Possible error: isogeny classes

2023-11-25 Thread John Cremona
Thanks for this report, which certainly indicates a bug.  I will look into 
it as the code here was written by me.  I note that the two curves have CM 
(by the order of index 5 and the maximal order in Q(sqrt(-3)) 
respectively), and the code to deal with isogenies is different in this 
case. The relevant function is isogeny_degrees_cm(), imported 
from sage.schemes.elliptic_curves.isogeny_class.  And for some reason that 
function is not including the valid isogeny prime 5.

If you do F.isogeny_class(reducible_primes=[3,5]) you get the same as for E 
(but you have to so that in a fresh Sage session becauses of caching of 
previously computed results).

John Cremona

On Friday, 24 November 2023 at 03:50:54 UTC hbetx9 wrote:

> Hi, 
>  
>  In some work on isogeny clases, my team ran across the following of two 
> elliptic curves which are isogenous but sage reports different isogeny 
> classes for them. Is there some  technicalities (j = 0) leading to 
> incorrect output or is this something that we should flag a bug? 
>
> sage: L5. = NumberField(x^2-5)
>
> sage: E = 
> EllipticCurve(L5,[287275052073119826051072\*r5-642366544675288047943680,-125329261653845158603060848774610944\*r5+280244748627855491701953075326484480])
>
> sage: F = EllipticCurve(L5,[0,-4325477943600\*r5-4195572876000])
>
> sage: E.isogeny_class().matrix()
> [ 1 25 75  3  5 15]
> [25  1  3 75  5 15]
> [75  3  1 25 15  5]
> [ 3 75 25  1 15  5]
> [ 5  5 15 15  1  3]
> [15 15  5  5  3  1]
>
> sage: F.isogeny_class().matrix()
> [1 3]
> [3 1]
>
> sage: E.is_isogenous(F)
> True
>
> Best,
> Lance
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-support/26785a33-7be4-4682-b988-ec2a4452a8a4n%40googlegroups.com.


Re: [sage-support] graph question about orientation of polyhedra

2023-06-19 Thread John Cremona
On Mon, 19 Jun 2023 at 14:27, Dima Pasechnik  wrote:

> One can do something like this; start from your graph G, take
> D=G.planar_dual(), in D take a spanning tree, and starting from the
> root of the tree,
> and orientation chosen in the face corresponding to the root, proceed
> recursively to induce orientations on the adjacent faces.
>

OK, though that is quite complicated.  Right now I am just checking that
the faces I am given by G.faces() are consistently oriented.  If/when I
come across a case where theya re not, I will work out which subset of them
needs to have its orientation flipped.

John

>
>
>
> On Mon, Jun 19, 2023 at 2:00 PM Dima Pasechnik  wrote:
> >
> > oh, right, what I suggested isn't what you asked for, sorry.
> >
> >
> > On Mon, 19 Jun 2023, 13:56 John Cremona,  wrote:
> >>
> >> Thanks Dima for the suggestion.  I'm not sure that this does what I
> need: the associated directed graph has each edge directed, which is not
> what I was needing, and the faces of the directed graph look identical to
> those of the original -- in particular, the edges of each face are tuples
> (x,y) where both (x,y) and (y,x) appear on different faces (as I need to
> always hold) regardless of the orientation of the edges.
> >>
> >> I will keep on experimenting. My polyhedra are small and few enough
> that check the orientations of each is not very time-consuming.
> >>
> >> John
> >>
> >> On Monday, June 19, 2023 at 12:08:18 PM UTC+1 Dima Pasechnik wrote:
> >>>
> >>> On Mon, Jun 19, 2023 at 11:18 AM John Cremona 
> wrote:
> >>> >
> >>> > I have some quite small graphs which are polyhedral, each is the
> 1-skeleton of a (connected convex) polyhedron such as a cube, tetrahedron,
> etc, constructed from a list of edge pairs.
> >>> >
> >>> > I can get the faces of one of these, say G, via G.faces(). This
> returns a list of lists of vertices, each one being a list of the vertices
> of one face in some cyclic order. So each face in the list has an implied
> orientation. OK so far.
> >>> >
> >>> > What I want is for the orientations of the different faces to be
> coherent, coming from a single orientation of the surface. Expliticly that
> means that each edge xy, which will appear in exactly two faces, appears
> once in each direction, i.e. x before y (cyclically) in one and the other
> way round in the other.
> >>> >
> >>> > It is possible that G.faces() is already returning such a globally
> oriented list of faces, as experimentation suggests, but I need to be
> certain -- otherwise I can write code to check and if necessary reverse
> some faces. I would prefer not to have to though.
> >>> >
> >>> > The docstrong of G.faces() does not make this clear (at least not to
> me).
> >>>
> >>> You can call G.strong_orientation()
> >>> to get an orientation of the edge of your graph, and use it.
> >>>
> >>> HTH
> >>> Dima
> >>>
> >>> >
> >>> > --
> >>> > 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...@googlegroups.com.
> >>> > To view this discussion on the web visit
> https://groups.google.com/d/msgid/sage-support/CAD0p0K5e9ch3tgrM2RAHxQieVOqG%2BEX37fyWj7BwF0ns-NTPpA%40mail.gmail.com
> .
> >>
> >> --
> >> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/sage-support/08ace3c1-1e96-427a-97a1-53605ca42742n%40googlegroups.com
> .
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "sage-support" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/sage-support/5GmwK-v-UWY/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> sage-support+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/sage-support/CAAWYfq1Rd%2BOmDBLY9x4ZZFn99WFrGShS98%2BPc39zHfw4jcgZvA%40mail.gmail.com
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-support/CAD0p0K5rZaZ2o4Kg2qukMb4v%3DqutXHN9QNLUWyrNzSjUfoECcA%40mail.gmail.com.


Re: [sage-support] graph question about orientation of polyhedra

2023-06-19 Thread John Cremona
Thanks Dima for the suggestion.  I'm not sure that this does what I need: 
the associated directed graph has each edge directed, which is not what I 
was needing, and the faces of the directed graph look identical to those of 
the original -- in particular, the edges of each face are tuples (x,y) 
where both (x,y) and (y,x) appear on different faces (as I need to always 
hold) regardless of the orientation of the edges.

I will keep on experimenting. My polyhedra are small and few enough that 
check the orientations of each is not very time-consuming.

John

On Monday, June 19, 2023 at 12:08:18 PM UTC+1 Dima Pasechnik wrote:

> On Mon, Jun 19, 2023 at 11:18 AM John Cremona  wrote:
> >
> > I have some quite small graphs which are polyhedral, each is the 
> 1-skeleton of a (connected convex) polyhedron such as a cube, tetrahedron, 
> etc, constructed from a list of edge pairs.
> >
> > I can get the faces of one of these, say G, via G.faces(). This returns 
> a list of lists of vertices, each one being a list of the vertices of one 
> face in some cyclic order. So each face in the list has an implied 
> orientation. OK so far.
> >
> > What I want is for the orientations of the different faces to be 
> coherent, coming from a single orientation of the surface. Expliticly that 
> means that each edge xy, which will appear in exactly two faces, appears 
> once in each direction, i.e. x before y (cyclically) in one and the other 
> way round in the other.
> >
> > It is possible that G.faces() is already returning such a globally 
> oriented list of faces, as experimentation suggests, but I need to be 
> certain -- otherwise I can write code to check and if necessary reverse 
> some faces. I would prefer not to have to though.
> >
> > The docstrong of G.faces() does not make this clear (at least not to me).
>
> You can call G.strong_orientation()
> to get an orientation of the edge of your graph, and use it.
>
> HTH
> Dima
>
> >
> > --
> > 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...@googlegroups.com.
> > To view this discussion on the web visit 
> https://groups.google.com/d/msgid/sage-support/CAD0p0K5e9ch3tgrM2RAHxQieVOqG%2BEX37fyWj7BwF0ns-NTPpA%40mail.gmail.com
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-support/08ace3c1-1e96-427a-97a1-53605ca42742n%40googlegroups.com.


[sage-support] graph question about orientation of polyhedra

2023-06-19 Thread John Cremona
I have some quite small graphs which are polyhedral, each is the 1-skeleton
of a (connected convex) polyhedron such as a cube, tetrahedron, etc,
constructed from a list of edge pairs.

I can get the faces of one of these, say G, via G.faces().  This returns a
list of lists of vertices, each one being a list of the vertices of one
face in some cyclic order.  So each face in the list has an implied
orientation.  OK so far.

What I want is for the orientations of the different faces to be coherent,
coming from a single orientation of the surface.  Expliticly that means
that each edge xy, which  will appear in exactly two faces, appears once in
each direction, i.e. x before y (cyclically) in one and the other way round
in the other.

It is possible that G.faces() is already returning such a globally oriented
list of faces, as experimentation suggests, but I need to be certain --
otherwise I can write code to check and if necessary reverse some faces.  I
would prefer not to have to though.

The docstrong of G.faces() does not make this clear (at least not to me).

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-support/CAD0p0K5e9ch3tgrM2RAHxQieVOqG%2BEX37fyWj7BwF0ns-NTPpA%40mail.gmail.com.


[sage-support] tracking memory usage

2023-01-20 Thread John Cremona
I'm sure I have seen posts about this but cannot find them or guess the
appropriate commands.

In testing variants of some new and algorithms to compute the same thing I
know how to measure the CPU time taken using cputime(), but is there a way
I can tell how much memory was used -- the maximum between two points of
the program?

Also with cputime() is time spent in calls to pari library functions (not
GP) included?

John

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-support/CAD0p0K4m_CSuOxMfC0tWrATsK3gP-p5E64hRUGgxaAmTdzvBqg%40mail.gmail.com.


Re: [sage-support] evaluation of polynomials mod 8

2022-09-27 Thread John Cremona
Thanks!

On Tuesday, September 27, 2022 at 3:02:25 PM UTC+1 Kwankyu wrote:

> This bug is tracked now in 
>
> https://trac.sagemath.org/ticket/34591
>
> On Tuesday, September 27, 2022 at 6:31:39 PM UTC+9 wdjo...@gmail.com 
> wrote:
>
>> On Tue, Sep 27, 2022 at 4:46 AM John Cremona  wrote:
>> >
>> > Am I doing something stupid here, or is this a bug?
>> >
>> > sage: R = Integers(8)
>> > sage: RXY. = R[]
>> > sage: F = X^3-X^2*Y+X*Y^2+Y^3
>> > sage: F([4,2])
>> > 6
>> > sage: 4^3-4^2*2+4*2^2+2^3
>> > 56
>> > sage: (4^3-4^2*2+4*2^2+2^3) % 8
>> > 0
>> >
>>
>> Even after coercion it doesn't evaluate in ZZ/8ZZ:
>>
>> sage: ZZ8 = IntegerModRing(8)
>> sage: R. = PolynomialRing(ZZ8, "x,y")
>> sage: f = x^3-x^2*y+x*y^2+y^3
>> sage: x0 = ZZ8(4)
>> sage: y0 = ZZ8(2)
>> sage: x0^3-x0^2*y0+x0*y0^2+y0^3
>> 0
>> sage: f(x0,y0)
>> 6
>> sage: f(4,2)
>> 6
>>
>> >
>> > Why does F not evaluate to 0 mod 8 at X=4, Y=2? Rather obviously, each
>> > of the terms in F(4,2) is 0 mod 8.
>> >
>> > John
>> >
>> > --
>> > 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...@googlegroups.com.
>> > To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/sage-support/CAD0p0K5hXexw5J20gstKUOXxzWdP2a2OTRbKmUtAyG41ySSR-A%40mail.gmail.com
>> .
>>
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-support/a3bf46f4-f359-476d-897f-302ac3838cean%40googlegroups.com.


[sage-support] evaluation of polynomials mod 8

2022-09-27 Thread John Cremona
Am I doing something stupid here, or is this a bug?

sage: R = Integers(8)
sage: RXY. = R[]
sage: F = X^3-X^2*Y+X*Y^2+Y^3
sage: F([4,2])
6
sage: 4^3-4^2*2+4*2^2+2^3
56
sage: (4^3-4^2*2+4*2^2+2^3) % 8
0


Why does F not evaluate to 0 mod 8 at X=4, Y=2? Rather obviously, each
of the terms in F(4,2) is 0 mod 8.

John

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-support/CAD0p0K5hXexw5J20gstKUOXxzWdP2a2OTRbKmUtAyG41ySSR-A%40mail.gmail.com.


Re: [sage-support] Re: trouble displaying 3D graphics

2021-11-10 Thread John Cremona
As expected, using firefox to navigate to the file in .sage works fine.  
But also, I found that within a notebook the 3d display is just fine on 
chromium too -- complete with rotation and zooming in and out.  That is 
very nice.

On Tuesday, November 9, 2021 at 7:36:43 PM UTC John H Palmieri wrote:

> Is there a way for users to redefine SAGE_TMP (without editing Sage source 
> code) so that these graphics files would be produced elsewhere?
>
> On Tuesday, November 9, 2021 at 4:06:34 AM UTC-8 dim...@gmail.com wrote:
>
>> Right, one can see more of these "Chromium cannot open hidden 
>> files/directories" posts
>> elsewhere, cf. e.g.
>>
>> https://askubuntu.com/questions/1312932/cant-browse-access-hidden-files-and-folders-with-chromium
>>
>> I don't see a good and quick way out, rather than renaming ~/.sage/ to 
>> something without leading '.'.
>>
>>  
>>
>>
>>
>>
>> On Tue, Nov 9, 2021 at 10:23 AM Eric Gourgoulhon  
>> wrote:
>>
>>> Le mardi 9 novembre 2021 à 10:38:29 UTC+1, dim...@gmail.com a écrit :
>>>
 I wonder if 'file:///' must be present in the URL for the script source 
 for Chrome/Chromium to load it.

 This does not seem to be an issue with 'file:///' in the URL since 
>>> Chromium refuses to open any hidden directory while browsing directories in 
>>> the window opened after CTRL+O.  
>>>
>>> -- 
>>>
>> 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...@googlegroups.com.
>>>
>> To view this discussion on the web visit 
>>> https://groups.google.com/d/msgid/sage-support/dd62df2d-4a09-4475-bdf6-62af5a3249e3n%40googlegroups.com
>>>  
>>> 
>>> .
>>>
>>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-support/0f79e54e-400c-4ee3-9e1d-d49887d88bdan%40googlegroups.com.


Re: [sage-support] Re: trouble displaying 3D graphics

2021-11-09 Thread John Cremona
Thanks for all the replies. I did not respond earlier just because I have 
my Google groups set to daily summary for this group which meant that none 
of the replies even landed in my inbox until today's summary. That's not 
very helpful of Google.

OK, so for the time being I ll use Firefox to see these. I'm sure I will be 
able to find out how to get sage to use that instead of my default browser.

John

On Tuesday, November 9, 2021 at 12:06:34 PM UTC Dima Pasechnik wrote:

> Right, one can see more of these "Chromium cannot open hidden 
> files/directories" posts
> elsewhere, cf. e.g.
>
> https://askubuntu.com/questions/1312932/cant-browse-access-hidden-files-and-folders-with-chromium
>
> I don't see a good and quick way out, rather than renaming ~/.sage/ to 
> something without leading '.'.
>
>  
>
>
>
>
> On Tue, Nov 9, 2021 at 10:23 AM Eric Gourgoulhon  
> wrote:
>
>> Le mardi 9 novembre 2021 à 10:38:29 UTC+1, dim...@gmail.com a écrit :
>>
>>> I wonder if 'file:///' must be present in the URL for the script source 
>>> for Chrome/Chromium to load it.
>>>
>>> This does not seem to be an issue with 'file:///' in the URL since 
>> Chromium refuses to open any hidden directory while browsing directories in 
>> the window opened after CTRL+O.  
>>
>> -- 
>>
> 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...@googlegroups.com.
>>
> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/sage-support/dd62df2d-4a09-4475-bdf6-62af5a3249e3n%40googlegroups.com
>>  
>> 
>> .
>>
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-support/575b5777-92be-4a4d-8002-a53aca90c06dn%40googlegroups.com.


[sage-support] trouble displaying 3D graphics

2021-11-08 Thread John Cremona
I don't often use 3D graphics, but when I run  implicitplot3d() I get
a  file permissions error (on ubuntu 20.04):

# example from the docstring
sage: var('x,y,z')
(x, y, z)
sage: implicit_plot3d(x^2+y^2+z^2==4, (x,-3,3), (y,-3,3), (z,-3,3))
Launched html viewer for Graphics3d Object

Over in my browser (chromium-browser) I see the error message "Access
to the file was deniedThe file at
file:///home/john/.sage/temp/john-Latitude-E5470/2250012/tmp_x5e1jfy0.html
is not readable. It may have been removed, moved or file permissions
may be preventing access."  I changed the permissions on .sage and
everything under it to a+rx and reloaded, with no change.  I deleted
all of ~/.sage and restarted sage and reran the commands, but the same
happened.

I can view other html files in my home directory using the browser.

What should I do?

John

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-support/CAD0p0K5YZvB92P1LdwLh0aDpZW_0F8pv4wP0yndC0%3DHJNSaE0w%40mail.gmail.com.


Re: [sage-nt] Re: [sage-support] AssertionError when finding roots over the Real Algebraic Field

2021-09-22 Thread John Cremona
More generally uf all the coefficients can be coerced into AA then the
roots in QQbar not in AA come in pairs.

On Wed, 22 Sep 2021, 09:23 Dima Pasechnik,  wrote:

>
>
> On Wed, Sep 22, 2021 at 9:19 AM Dima Pasechnik  wrote:
>
>>
>>
>> On Wed, Sep 22, 2021 at 8:10 AM Tracy Hall  wrote:
>>
>>> I ran into an assertion error when trying to return a sorted list whose
>>> key was a certain linear combination of eigenvalues of the Laplacian matrix
>>> over graphs on nine vertices. Digging into it a bit, the failure happened
>>> when comparing an algebraic real number against the same number that was
>>> constructed differently (starting with the graph complement). Digging
>>> further, the error happens when finding roots of a certain degree 56
>>> polynomial over AA (all the roots are real) but there is no error doing the
>>> same thing over QQbar.
>>>
>>> Here is a minimal working example:
>>>
>>> P. = QQ[]
>>> rootlist = (z^8 - 32*z^7 + 425*z^6 - 3044*z^5 + 12789*z^4 - 32090*z^3 +
>>> 46672*z^2 - 35734*z + 10917).roots(AA)
>>> problem = rootlist[-1][0] - rootlist[0][0] - 9
>>>
>>> problem.minpoly().roots(AA)
>>>
>>
>> indeed, problem.minpoly().roots(QQbar) produces a list of 56 QQbar
>> elements, more precisely, pairs (t,1)), each t convertible into AA.
>> One funny discrepancy is that one of the elements of this list is shown as
>> (-6.390396068452545? + 0.?e-170*I, 1)
>>
>> sage: rrr=problem.minpoly().roots(QQbar)
>> sage: rrr[-1]
>> (-6.390396068452545? + 0.?e-170*I, 1)
>> sage: AA(rrr[-1][0])
>> -6.390396068452545?
>>
>> Not sure whether this is the cause of the bug, though.
>>
>
> The behaviour  of QQbar is not very consistent there. Only one root is
> shown with an imaginary part, but
> the polynomial has integer coefficients --- it ought to "know" that
> complex roots come in pairs :-)
>
>
>> Dima
>>
>> --
> You received this message because you are subscribed to the Google Groups
> "sage-nt" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to sage-nt+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/sage-nt/CAAWYfq35Omovg-jPnG6a3eKLLa%2BpaL-%3D%3DCRFpgPRasn%2BwBf8qA%40mail.gmail.com
> 
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-support/CAD0p0K5jv%2BjrVz3p2TBvsGmfySJGTrCgm7KPJAR4tmze7%3DKRUQ%40mail.gmail.com.


[sage-support] Does anyone know what this means?

2021-07-27 Thread John Cremona
At the end of a run of some code I have run before, without seeing this:

/usr/local/sage/sage-9.3/local/lib/python3.9/site-packages/prompt_toolkit/renderer.py:514:
DeprecationWarning: The explicit passing of coroutine objec
ts to asyncio.wait() is deprecated since Python 3.8, and scheduled for
removal in Python 3.11.
  await wait(coroutines, return_when=FIRST_COMPLETED)

This is sage-9.3 on ubuntu.  I assume that I can ignore it.

John

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-support/CAD0p0K41n8aSz2ujD1O-4a9Z8DASRcr6u5DAV-E-BS_Nxqaj1Q%40mail.gmail.com.


[sage-support] having trouble entering multiline code

2021-03-22 Thread John Cremona
I havethe problem reported here -- but apparently solved in ipython
7.1.1, but I am using sage-9.2 with ipython 7.13.0 (as reported by
"sage -ipython").
https://stackoverflow.com/questions/52947493/ipython-how-to-continue-code-on-the-next-line

I start entering a loop like this

sage: for n in [1..10]:
: m=2*n

where ipython automatically enters the continuation ":" and
indentation, but after hitting return the second time, immediately
after the n in the second line, it evaluates what I have entered so
far (uselessly) and gives me a new Sage prompt.

I know that this seems to be an ipython issue, but there is no problem
if I use sage -ipython directly (using range() instead of [..])  *and*
no problem in Sage if instead I do "for n in range(10):" in the first
line.  So this seems to be being caused by whatever Sage does to
convert [1..10] into python.

John

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-support/CAD0p0K6xtD6ODgzX-y-9ay2-d-xVBWZn0sgK1zDrvaHmQkE5Mg%40mail.gmail.com.


Re: [sage-support] gp in Sage

2020-09-02 Thread John Cremona


On Wednesday, September 2, 2020 at 5:00:07 PM UTC+1 kks wrote:

> Yes, I knew the point regarding 
> >>
> ndeed, there are 9 imaginary quadratic extensions of Q for which one
> gets integer j-invariant, one of them
> Q[sqrt(-163)], but as 163 mod 4 = 3, one has to compute its j-invariant as
> ellj((1+sqrt(163)*I)/2)
> getting -262537412640768000
> <<
> However on the boundary of the fundamental domain, my calculation shows 
> only j-invariants ( positive) which are perfect cubes as
> Q(sqrt(-1)).12^3
> Q(sqrt(-2))..20^3
> Q(sqrt(-4))..66^3
> Q(sqrt(-7))..255^3
> and the above almost integer. Are there any others on the Imaginary axis?
>

No. cm_j_invariants_and_orders(QQ) gives all 13 imaginry quadratic orders 
of class number 1, from which you can recover the 13 associated imaginary 
discriminants D.  Most of these are congruent to 1 mod 4 so the j-value is 
j((1+sqrt(d))/2) , only those which are 0 mod 4 are on the imaginary axis 
with values j(sqrt(D)/2) as in your list.

THere is a big theory of complex multiplcation behind these facts, but I 
don'y think that "gp in Sage" is an accurate sub   ject 
line for discussion about that.

John Cremona

 

>
>
> On Mon, Aug 31, 2020 at 2:28 AM Dima Pasechnik  wrote:
>
>> On Sun, Aug 30, 2020 at 9:24 AM Dima Pasechnik  wrote:
>> >
>> > On Sun, Aug 30, 2020 at 5:50 AM Surendran Karippadath
>> >  wrote:
>> > >  I evaluated the j-invariant in Pari/gp In SageMathCell
>> > > ? \p 50
>> > > ? ellj(sqrt(163.0)*I)
>> > > %1 = 68925893036109279891085639286944512.0163739
>> >
>> > Sage has this function too (it calls Pari, so that's not an
>> > independent confirmation that this number is (not) an integer:
>> > sage: elliptic_j(sqrt(163)*I,prec=500)
>> > 
>> 6.892589303610927989108563928694451201637386442092346075751855217523117650690239250072955532985645916831850173541132959651401661828116253839333e34
>> >
>> > The output in Pari is a bit easier to read:
>> >
>> > ? \p 500
>> > ? ellj(sqrt(163)*I)
>> > %4 = 
>> 68925893036109279891085639286944512.016373864420923460757518552[...]
>> >
>> > Is it one of these "almost integers" (unless it's a bug, and this
>> > number must be an integer, I don't know  - number theorists, please
>> > step forward!), such as
>> > ? \p 500
>> > ? exp(sqrt(163)*Pi)
>> > %3 = 
>> 262537412640768743.25007259719818568887935385633733699086270[...]
>> >
>> > Or a bug in Pari/GP ?
>>
>> If I read the discussion  after Cor. 42 in
>> http://people.maths.ox.ac.uk/greenbj/papers/ramanujanconstant.pdf
>> right, this is not an integer.
>> Indeed, there are 9 imaginary quadratic extensions of Q for which one
>> gets integer j-invariant, one of them
>> Q[sqrt(-163)], but as 163 mod 4 = 3, one has to compute its j-invariant as
>> ellj((1+sqrt(163)*I)/2)
>> getting -262537412640768000
>>
>>
>> >
>> >
>> > >
>> > > Furthermore the Cube-root of the j-invariant I obtained
>> > > ? (ellj(sqrt(163.0)*I))^(1/3)
>> > > %2 = 410009702400.00077461269365317226812447191214259043
>> >
>> > the closest integer to (ellj(sqrt(163.0)*I))^(1/3) is 410009702400,
>> > and so you can check
>> > that its cube is quite far from ellj(sqrt(163)*I)
>> >
>> >
>> >
>> > >
>> > > Is it possible to check in Sage with High Precision if the values are 
>> Integers.
>> > >
>> > > Thanking you in advance
>> > >
>> > > --
>> > > 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...@googlegroups.com.
>> > > To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/sage-support/CAGp5ChV21gzwieMCGvywDMxETh3ZUOuOpHaSGUbPNhNHvbVOpg%40mail.gmail.com
>> .
>>
>> -- 
>> 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...@googlegroups.com.
>>
> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/sage-support/CAAWYfq0kox%3DLYaemNbNdXcDNHKDMxwFaYq9VKASHDoaa1bjZ%3Dg%40mail.gmail.com
>> .
>>
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-support/ebafb877-a4e0-4d91-aa0f-85c030de2d7an%40googlegroups.com.


[sage-support] recovering the last Sage command while it is still running

2020-08-20 Thread John Cremona
Suppose I enter a command at the Sage prompt and it runs and runs,
producing vast amounts of output to the screen (too much to scroll
back), during which I start to wonder if I typed the command correctly
or perhaps added a 0 to a parameter by mistake.  I don't want to
interrupt the computation.  I thought that there was a Sage history
file somewhere where the last command I gave would be stored but if
there is (as I know there is) it seems to be unreadable.   I think it
is in .sage/ipython-*/profile_default/history.sqlite.

The command (which is still running as I type) will probably have
finished before I get an answer, and after that it will be as simple
as pressing the up-arrow key!

John

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-support/CAD0p0K7-%3DN6t%2B06r5LueXfjbrDWbwrfFhfUkLQtH-rzWgE-QwA%40mail.gmail.com.


[sage-support] summing infinite series

2020-06-12 Thread John Cremona
I never deliberately use the Symbolic Ring since I believe in algebra.
But I wanted to simplify some quite complicated expressions involving
infinite series in one variable called 'p', nothing more complicated
that geometric series, and from sum? I learned that this could be done
in SR.  However this experience has convinced me that SR is not for
me:

sage: p,i=var('p','i')
sage: sum(p^i,i,0,oo)
...
RuntimeError: ECL says: Maxima asks: Is abs(_SAGE_VAR_p)-1 positive,
negative or zero?
...
ValueError: Computation failed since Maxima requested additional
constraints; using the 'assume' command before evaluation *may* help
(example of legal syntax is 'assume(abs(p)-1>0)', see `assume?` for
more details)
Is abs(p)-1 positive, negative or zero?
...

What?  What part of the meaning of "symbolic" am I not understanding?
Why does it not just return 1/(1-p)  which is the correct symbolic
answer?  If 'p' is a "symbol" (whatever that is) how can it make sense
to ask how big it is?

Never mind, I will revert to pencil and paper (which did actually get
me the answer I was expecting, though it took two pages of
handwriting).

John

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-support/CAD0p0K7yLBi20DqMtXOs6fYx%2BNehE1cx%2BPCcpJD7nPttOUa82Q%40mail.gmail.com.


[sage-support] Re: Endomorphism Rings of Elliptic Curves

2020-01-22 Thread John Cremona
I suspect the question might have been referring to elliptic curves over finite 
fields. In the ordinary case you can ask for the Frobenius order and know that 
the endomorphism ring is between that and the maximal order of its field of 
fractions (an imaginary quadratic field) but as far as I know Sage jas no 
implementation of finding the exact endomorphism ring such as Kohel's algorithm.

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-support/e883d3f6-bbf4-422b-b964-b6f72abb746a%40googlegroups.com.


[sage-support] Re: Minor bug in EllipticCurve's global_minimal_model()

2020-01-11 Thread John Cremona


On Saturday, January 11, 2020 at 10:49:08 AM UTC, Benjamin Matschke wrote:
>
> Computing the global minimal model of an elliptic curve over a number 
> field isomorphic to QQ...
>
> sage: K. = NumberField(x-1)
> sage: E = EllipticCurve(K,[0,2])
> sage: E.global_minimal_model()
>
> ... raises an unexpected TypeError:
>
> TypeError: round() takes no arguments (1 given).
>
> (Run on Sage 9.0, Linux Mint 19.2, 64 bit)
> It's not dramatic as one can simply work over QQ and coerce, but I think 
> the above code should also work and yield the same result, as sometimes it 
> is convenient to treat QQ as an instance of NumberField. 
>
> Thanks,
> Benjamin
>

Yes it's a bug.  The rounding is only used when the base field has degree 
1, but the test should be that it is actually QQ.  A one-line fix in line 
895 of  sage/schemes/elliptic_curves/ell_number_field.py would sort this.

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-support/d76b94c7-b954-4055-ad39-8453de6067bf%40googlegroups.com.


Re: [sage-support] Unexpected error for asking diagonalizability

2019-11-08 Thread John Cremona
On Fri, 8 Nov 2019 at 01:33, saad khalid  wrote:

> This functionality seems to be intended somehow? At least, it is made
> reference to in the documentation:
> http://doc.sagemath.org/html/en/reference/matrices/sage/matrix/matrix2.html
> Look at the part after:
> "A matrix that is not diagonalizable over the rationals, as evidenced by
> its Jordan form."
>

I think that this is certainly a bug, this method should return False for a
non-diagonalizable matrix, not raise an error.  Of course there is an issue
here about whether the matrix is diagonalizable over its base field or just
over an extension, but that is properly documented.

It is reasonable to raise an error for matrices over RR or CC (as they are
not exact) though I'm sure that many users will not like

sage: m = matrix(CC,2, 2, [0,-1,1,0])
sage: m.eigenvalues()
/local/localhome/masgaj/sage/src/bin/sage-ipython:1: UserWarning: Using
generic algorithm for an inexact ring, which will probably give incorrect
results due to numerical precision issues.
  #!/usr/bin/env sage-python23
[1.00*I, -1.00*I]
sage: m.is_diagonalizable()
(...)
ValueError: base field must be exact, not Complex Field with 53 bits of
precision

since for such an example "obviously" the eigenvalues are distinct, but at
least there is a warning.

John


>
>
> -Saad
>
> On Thursday, November 7, 2019 at 4:38:13 AM UTC-5, Dima Pasechnik wrote:
>>
>> On Thu, Nov 7, 2019 at 9:15 AM Kwankyu  wrote:
>> >
>> > Hi,
>> >
>> > This
>> >
>> > m = matrix(QQ, 3, [1, 1, 1, 0, 3, 3, -2, 1, 2])
>> > m.is_diagonalizable()
>> >
>> > raises an error rather than giving False. The error message gives an
>> explanation why the matrix is > not diagonalizable. But I think the
>> expected result for asking diagonalizability should be either True or
>> False, for legitimate inputs.
>>
>> I agree. It seems that is_diagonalizable() is the only method among
>> is_*() for matrices
>> that has this strange behavior (I checked several of them, but not all).
>>
>> CC'ing to the original author...
>>
>> Dima
>>
>> > What do you think?
>> >
>> >
>> >
>> >
>> > --
>> > 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-s...@googlegroups.com.
>> > To view this discussion on the web visit
>> https://groups.google.com/d/msgid/sage-support/4c3a3e63-14d7-4e49-aadb-480b6ff46a64%40googlegroups.com.
>>
>>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/sage-support/8efe0856-7376-447f-908e-6e9677d475ea%40googlegroups.com
> 
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-support/CAD0p0K5-U%3D5h3fKK4xT6A_ERteNy0HS3FRUbMp3h_VHUb-by8Q%40mail.gmail.com.


Re: [sage-support] Re: Solve equation efficiently

2019-07-30 Thread John Cremona
On Tue, 30 Jul 2019 at 05:56, Kwankyu  wrote:

>
>
> On Thursday, July 25, 2019 at 12:08:20 AM UTC+9, chandra chowdhury wrote:
>>
>> I have matrices B and C of size (m,n) over integer with m>n.
>> I know there is matrix A of size (m,m) such that
>> AB=C. How to find A efficiently in Sage?
>>
>
Try B.solve_left(C).  For example:

sage: B = Matrix(2,3,[1,2,3,4,5,6]); B
[1 2 3]
[4 5 6]
sage: A = Matrix(2,2,[1,1,1,2]); A
[1 1]
[1 2]
sage: C = A*B; C
[ 5  7  9]
[ 9 12 15]
sage: B.solve_left(C)
[1 1]
[1 2]
sage: B.solve_left(C) == A
True



>
> I guess there is no special way in Sage to solve your kind of problem.
> Just solve for each row of A.
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/sage-support/021a81f6-9ba9-4066-bf30-9dd0796f97e7%40googlegroups.com
> 
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-support/CAD0p0K7oC9Yphjh144vVXZMUk40xFOacrXcM1L2Shb_a1R%3Dxnw%40mail.gmail.com.


Re: [sage-support] Counting Points of Multivariate Polynomials Over Finite Fields

2019-07-09 Thread John Cremona
As far as I know the answer is "no" except for elliptic and hyperelliptic
curves.

John Cremona

On Tue, 9 Jul 2019 at 00:47, Caleb Robelle  wrote:

> I am using sage version 7.3 on Linux mint 18. I was wondering if there are
> algorithms to count points of multivariate polynomials over finite fields
> implemented in sage that were faster than a simple brute force search. I
> haven't been able to find any on my own. Any advice would be appreciated.
> Thanks!
>
> --
> 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.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/sage-support/4b29a324-6474-4a2e-8020-58712bae2ddb%40googlegroups.com
> <https://groups.google.com/d/msgid/sage-support/4b29a324-6474-4a2e-8020-58712bae2ddb%40googlegroups.com?utm_medium=email_source=footer>
> .
> 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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-support/CAD0p0K4BaEpBAj0odPrS6Grcx5GbdOksnYCwmqm8vCOaXoa%3DQg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-support] Polynomial over prime field

2019-06-17 Thread John Cremona
On Mon, 17 Jun 2019 at 13:02, chandra chowdhury 
wrote:

> Hi,
>   I have multi variable polynomial over integers say f(x,y,z).
> I want to define it over GF(5) efficiently.
>
> For that I am doing this:
>
>
> R=PolynomialRing(GF(5), 3, 'X')
> Z = list(R.gens())
>
> But g=R(f(Z)) is not working.
>

If you also define, say,

sage: RZ = PolynomialRing(ZZ,3,'Y')

as a parent for polynomials over the integers then Sage can coerce elements
of RZ into R directly.  For example (first assigning to the identifiers Y0,
Y1, Y2 their natural values in RZ):

sage: Y0, Y1, Y2 = Z.gens()
sage: f = RZ.random_element()
sage: f
7*Y0*Y1 + 5*Y2^2 - Y2
sage: R(f)
2*X0*X1 - X2
sage: f = RZ.random_element()
sage: f
-Y0^2 + Y0*Y2 + Y1*Y2 + 4*Y2
sage: R(f)
-X0^2 + X0*X2 + X1*X2 - X2

> --
> 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.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/sage-support/CAC3pSB%2B6cxwuOtKJ1EMVBZUnyrFW%3Dj2%3Dv58ZNQu9fjxfsMAEqA%40mail.gmail.com
> 
> .
> 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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-support/CAD0p0K4Mxbco18db0Cckb9o6VD5WXivjfeG%3Dw1LP2K%3D1wrwwQA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-support] Re: starting sage with no history file

2019-05-22 Thread John Cremona
On Wed, 22 May 2019 at 11:18, John Cremona  wrote:

>
>
> On Wed, 22 May 2019 at 11:17, John Cremona  wrote:
>
>>
>>
>> On Wed, 22 May 2019 at 10:27, slelievre 
>> wrote:
>>
>>> Le mercredi 22 mai 2019 10:00:34 UTC+2, John Cremona a écrit :
>>>>
>>>> Paul Zimmermann suggested using -nodotsage, which apparently creates a
>>>> temporary .sage directory which I expect would be different for different
>>>> runs.  This is not ideal since currently the scripts I am running this way
>>>> make use of a %runfile command in ~/.sage/initsage to load all the
>>>> functions needed.
>>>>
>>>
>>> One can use a custom init.sage, see my answer to
>>>
>>> - Stack Overflow question 41922740: Start cli with init.sage
>>>   https://stackoverflow.com/questions/41922740
>>>
>>> The trick is just to use the SAGE_STARTUP_FILE environment variable.
>>>
>>> Instead of just running
>>>
>>> $ sage
>>>
>>> run
>>>
>>> $ SAGE_STARTUP_FILE=/path/to/custom/init.sage sage
>>>
>>
>> Thanks Samuel, that sounds perfect.  In fact, since my init.sage only
>> contains the line
>>
>> %runfile /home/jec/ecdata/scripts/ecdb.py
>>
>> it seems that I can do
>>
>> SAGE_STARTUP_FILE=%runfile /home/jec/ecdata/scripts/ecdb.py sage
>> -nodotsage
>>
>
> Of course I meant
>
> SAGE_STARTUP_FILE=/home/jec/ecdata/scripts/ecdb.py sage -nodotsage
>>
>
3rd time lucky:

SAGE_STARTUP_FILE=/home/jec/ecdata/scripts/ecdb.py sage --nodotsage

works fine ( --nodotsage, not -nodotsage).  Thanks again


>
>
>>
>> and this will solve the issue.  I will try that.
>>
>> John
>>
>>
>>>
>>> --
>>> 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.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/sage-support/47d12b47-1a03-4fd3-adbd-52ae32b93470%40googlegroups.com
>>> <https://groups.google.com/d/msgid/sage-support/47d12b47-1a03-4fd3-adbd-52ae32b93470%40googlegroups.com?utm_medium=email_source=footer>
>>> .
>>> 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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-support/CAD0p0K7bSXEAwUEXuQDn3aUfS4%3DRutvY7DYdUbN8CyQUFYTCBw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-support] Re: starting sage with no history file

2019-05-22 Thread John Cremona
On Wed, 22 May 2019 at 11:17, John Cremona  wrote:

>
>
> On Wed, 22 May 2019 at 10:27, slelievre  wrote:
>
>> Le mercredi 22 mai 2019 10:00:34 UTC+2, John Cremona a écrit :
>>>
>>> Paul Zimmermann suggested using -nodotsage, which apparently creates a
>>> temporary .sage directory which I expect would be different for different
>>> runs.  This is not ideal since currently the scripts I am running this way
>>> make use of a %runfile command in ~/.sage/initsage to load all the
>>> functions needed.
>>>
>>
>> One can use a custom init.sage, see my answer to
>>
>> - Stack Overflow question 41922740: Start cli with init.sage
>>   https://stackoverflow.com/questions/41922740
>>
>> The trick is just to use the SAGE_STARTUP_FILE environment variable.
>>
>> Instead of just running
>>
>> $ sage
>>
>> run
>>
>> $ SAGE_STARTUP_FILE=/path/to/custom/init.sage sage
>>
>
> Thanks Samuel, that sounds perfect.  In fact, since my init.sage only
> contains the line
>
> %runfile /home/jec/ecdata/scripts/ecdb.py
>
> it seems that I can do
>
> SAGE_STARTUP_FILE=%runfile /home/jec/ecdata/scripts/ecdb.py sage -nodotsage
>

Of course I meant

SAGE_STARTUP_FILE=/home/jec/ecdata/scripts/ecdb.py sage -nodotsage
>



>
> and this will solve the issue.  I will try that.
>
> John
>
>
>>
>> --
>> 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.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/sage-support/47d12b47-1a03-4fd3-adbd-52ae32b93470%40googlegroups.com
>> <https://groups.google.com/d/msgid/sage-support/47d12b47-1a03-4fd3-adbd-52ae32b93470%40googlegroups.com?utm_medium=email_source=footer>
>> .
>> 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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-support/CAD0p0K6SXij-zScJjS%3DRXwLZXkQswfKn1xcMLBG4gOXj_0pxWQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-support] Re: starting sage with no history file

2019-05-22 Thread John Cremona
On Wed, 22 May 2019 at 10:27, slelievre  wrote:

> Le mercredi 22 mai 2019 10:00:34 UTC+2, John Cremona a écrit :
>>
>> Paul Zimmermann suggested using -nodotsage, which apparently creates a
>> temporary .sage directory which I expect would be different for different
>> runs.  This is not ideal since currently the scripts I am running this way
>> make use of a %runfile command in ~/.sage/initsage to load all the
>> functions needed.
>>
>
> One can use a custom init.sage, see my answer to
>
> - Stack Overflow question 41922740: Start cli with init.sage
>   https://stackoverflow.com/questions/41922740
>
> The trick is just to use the SAGE_STARTUP_FILE environment variable.
>
> Instead of just running
>
> $ sage
>
> run
>
> $ SAGE_STARTUP_FILE=/path/to/custom/init.sage sage
>

Thanks Samuel, that sounds perfect.  In fact, since my init.sage only
contains the line

%runfile /home/jec/ecdata/scripts/ecdb.py

it seems that I can do

SAGE_STARTUP_FILE=%runfile /home/jec/ecdata/scripts/ecdb.py sage -nodotsage

and this will solve the issue.  I will try that.

John


>
> --
> 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.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/sage-support/47d12b47-1a03-4fd3-adbd-52ae32b93470%40googlegroups.com
> <https://groups.google.com/d/msgid/sage-support/47d12b47-1a03-4fd3-adbd-52ae32b93470%40googlegroups.com?utm_medium=email_source=footer>
> .
> 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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-support/CAD0p0K4-MGra2mRMm1Z-RngimwHWPc5YFNq8K_z%2BiVUt-838uQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-support] Re: starting sage with no history file

2019-05-22 Thread John Cremona
Paul Zimmermann suggested using -nodotsage, which apparently creates a
temporary .sage directory which I expect would be different for different
runs.  This is not ideal since currently the scripts I am running this way
make use of a %runfile command in ~/.sage/initsage to load all the
functions needed.

John

On Tue, 21 May 2019 at 23:07, slelievre  wrote:

> Possibly related:
>
> - Sage Trac ticket 23752
>   Use different history file for unit tests
>   https://trac.sagemath.org/ticket/23752
>
> - Sage Trac ticket 16372
>   Intermittent test failures with IPython history
>   https://trac.sagemath.org/ticket/16372
>
> --
> 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.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/sage-support/dd799185-11a1-47be-b2e2-c1636e74909e%40googlegroups.com
> 
> .
> 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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-support/CAD0p0K4KKBHUXkLtbB1p9NMG0kpn0RQLBjrfHBYEFaa2XQpaAw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[sage-support] starting sage with no history file

2019-05-21 Thread John Cremona
I want to run sage with no history file (it is running a script so no
history of commands is needed, and I am running multiple instances in
parallel, and finding that all but one show error messages that the history
database is locked).

I see that ipython allows --loglevel=0 for this, but sage (from the command
line) appears not to.  Am I missing something?

John Cremona

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-support/CAD0p0K6kkYwh-j702pnVcm6Z4QYds2RSPAmtOab94KG1b8Dd1g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-support] Print statement vs function in Sage-py3

2019-04-03 Thread John Cremona
On Wed, 3 Apr 2019 at 18:56, John H Palmieri  wrote:

>
>
> On Wednesday, April 3, 2019 at 10:11:19 AM UTC-7, kcrisman wrote:
>>
>>
>>
>> On Tuesday, April 2, 2019 at 6:03:23 PM UTC-4, Dima Pasechnik wrote:
>>>
>>> On Tue, Apr 2, 2019 at 10:47 PM  wrote:
>>> >
>>> > Hello, Sage community.
>>> > With the upcoming migration of Sage from Python2 to Python3, I was
>>> wondering if the "print" statement will be changed to the new "print"
>>> function. In any case, will there be backwards compatibility with the
>>> current behavior?
>>>
>>> As you can see in the current sage sources, there are no print
>>> statements left,
>>> only print functions.
>>>
>>> the trick with Python 2 is to do
>>>
>>> from __future__ import print_function
>>>
>>> to get this compatibility
>>>
>>
>> I think the post was asking for the reverse compatibility, though.
>> Presumably this would be possible (but perhaps not advisable) with adding
>> something to the preparser.  I would be okay with a preparser addition that
>> would look for this and say something like "print blah should now be
>> print(blah)" but raise an error.
>>
>
> Some of this has been discussed at https://trac.sagemath.org/ticket/23674.
> That ticket should be revived, especially if there is any consensus about
> how to handle this. I like the idea of deprecating statements like "print
> x" ASAP.
>

+1

For what it's worth, running pyflakes on src/sage now outputs 4192 lines of
which 2438 are just "imported but unused" while pyflakes3 only only outputs
4106 lines (and the same number of "imported but unused".  That seems
somehow encouraging.


>
> --
> John
>
> --
> 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.


Re: [sage-support] primes -- enhancement request

2019-03-12 Thread John Cremona
You did not say what command you were using.  The documentation for both
primes() and prime_range() show examples with much larger primes.

John Cremona


On Tue, 12 Mar 2019 at 11:25, Peter Luschny  wrote:

> ValueError: Cannot compute primes beyond 436273290
>
>
> I think SageMath should do better.
>
>
> Cheers, Peter
>
>
>
> /opt/sagemath-8.4/local/lib/python2.7/site-packages/sage/rings/fast_arith.pyx 
> in sage.rings.fast_arith.prime_range 
> (build/cythonized/sage/rings/fast_arith.c:3390)() 46 from 
> sage.rings.integer cimport Integer 47 ---> 48 cpdef prime_range(start, 
> stop=None, algorithm="pari_primes", bint py_ints=False): 49 r""" 
> 50 List of all primes between start and stop-1, inclusive.  If the
> /opt/sagemath-8.4/local/lib/python2.7/site-packages/sage/rings/fast_arith.pyx 
> in sage.rings.fast_arith.prime_range 
> (build/cythonized/sage/rings/fast_arith.c:2946)()145 # Adding 
> 1500 should be sufficient to guarantee an146 # additional 
> prime, given that c_stop < 2^63.--> 147 pari.init_primes(c_stop + 
> 1500)148 assert maxprime() >= c_stop149
> cypari2/pari_instance.pyx in cypari2.pari_instance.Pari.init_primes()
>
> --
> 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.


Re: [sage-support] Maple interface

2019-03-08 Thread John Cremona
Perhaps an easier way to debug this is to use the fact that the global
maple object is defined in the Sage library by the assignment maple=Maple()
(in sage/interfaces/maple.py) and if at the top of your Sage session you do
maple = Maple(logfile="maple.log")
then you can take a look in that file to see all the communication between
Sage via pexpect and maple.

John

On Wed, 6 Mar 2019 at 16:42, E. Madison Bray  wrote:

>
>
> On Wednesday, March 6, 2019 at 5:31:19 PM UTC+1, E. Madison Bray wrote:
>>
>> On Tuesday, March 5, 2019 at 4:47:39 PM UTC+1, benyamin alizade wrote:
>>>
>>> It gives no result, and when I interrupt it, the following error appears:
>>>
>>>
>>> ---
>>> EOF   Traceback (most recent call
>>> last)
>>>  in ()
>>> > 1 maple('2*3')
>>>
>>> /opt/sagemath-8.5/local/lib/python2.7/site-packages/sage/interfaces/interface.pyc
>>> in __call__(self, x, name)
>>> 278
>>> 279 if isinstance(x, string_types):
>>> --> 280 return cls(self, x, name=name)
>>> 281 try:
>>> 282 return self._coerce_from_special_method(x)
>>>
>>> /opt/sagemath-8.5/local/lib/python2.7/site-packages/sage/interfaces/expect.pyc
>>> in __init__(self, parent, value, is_name, name)
>>>1436 else:
>>>1437 try:
>>> -> 1438 self._name = parent._create(value, name=name)
>>>1439 # Convert ValueError and RuntimeError to TypeError
>>> for
>>>1440 # coercion to work properly.
>>>
>>> /opt/sagemath-8.5/local/lib/python2.7/site-packages/sage/interfaces/interface.pyc
>>> in _create(self, value, name)
>>> 474 def _create(self, value, name=None):
>>> 475 name = self._next_var_name() if name is None else name
>>> --> 476 self.set(name, value)
>>> 477 return name
>>> 478
>>>
>>> /opt/sagemath-8.5/local/lib/python2.7/site-packages/sage/interfaces/maple.pyc
>>> in set(self, var, value)
>>> 622 """
>>> 623 cmd = '%s:=%s:' % (var, value)
>>> --> 624 out = self.eval(cmd)
>>> 625 if out.find("error") != -1:
>>> 626 raise TypeError("Error executing code in
>>> Maple\nCODE:\n\t%s\nMaple ERROR:\n\t%s" % (cmd, out))
>>>
>>> /opt/sagemath-8.5/local/lib/python2.7/site-packages/sage/interfaces/expect.pyc
>>> in eval(self, code, strip, synchronize, locals, allow_use_file,
>>> split_lines, **kwds)
>>>1350 elif split_lines:
>>>1351 return '\n'.join([self._eval_line(L,
>>> allow_use_file=allow_use_file, **kwds)
>>> -> 1352 for L in
>>> code.split('\n') if L != ''])
>>>1353 else:
>>>1354 return self._eval_line(code,
>>> allow_use_file=allow_use_file, **kwds)
>>>
>>> /opt/sagemath-8.5/local/lib/python2.7/site-packages/sage/interfaces/maple.pyc
>>> in _eval_line(self, line, allow_use_file, wait_for_prompt,
>>> restart_if_needed)
>>> 574 with gc_disabled():
>>> 575 z = Expect._eval_line(self, line,
>>> allow_use_file=allow_use_file,
>>> --> 576
>>>  wait_for_prompt=wait_for_prompt).replace('\\\n','').strip()
>>> 577 if z.lower().find("error") != -1:
>>> 578 raise RuntimeError("An error occurred running a
>>> Maple command:\nINPUT:\n%s\nOUTPUT:\n%s" % (line, z))
>>>
>>> /opt/sagemath-8.5/local/lib/python2.7/site-packages/sage/interfaces/expect.pyc
>>> in _eval_line(self, line, allow_use_file, wait_for_prompt,
>>> restart_if_needed)
>>> 982 out = ''
>>> 983 except KeyboardInterrupt:
>>> --> 984 self._keyboard_interrupt()
>>> 985 raise KeyboardInterrupt("Ctrl-c pressed while
>>> running %s"%self)
>>> 986 if self._terminal_echo:
>>>
>>> /opt/sagemath-8.5/local/lib/python2.7/site-packages/sage/interfaces/maple.pyc
>>> in _keyboard_interrupt(self)
>>> 333 print("Interrupting %s..." % self)
>>> 334 self._expect.sendline(chr(3))  # send ctrl-c
>>> --> 335 self._expect.expect(self._prompt)
>>> 336 raise RuntimeError("Ctrl-c pressed while running %s" %
>>> self)
>>> 337
>>>
>>> /opt/sagemath-8.5/local/lib/python2.7/site-packages/pexpect/spawnbase.pyc
>>> in expect(self, pattern, timeout, searchwindowsize, async_, **kw)
>>> 339 compiled_pattern_list =
>>> self.compile_pattern_list(pattern)
>>> 340 return self.expect_list(compiled_pattern_list,
>>> --> 341 timeout, searchwindowsize, async_)
>>> 342
>>> 343 def expect_list(self, pattern_list, timeout=-1,
>>> searchwindowsize=-1,
>>>
>>> /opt/sagemath-8.5/local/lib/python2.7/site-packages/pexpect/spawnbase.pyc
>>> in expect_list(self, pattern_list, timeout, searchwindowsize, async_, **kw)
>>> 367 return 

Re: [sage-support] about the speed of tha Magma interface

2019-02-26 Thread John Cremona
On Tue, 26 Feb 2019 at 17:01, Vincent Delecroix <20100.delecr...@gmail.com>
wrote:

> I don't think this has ever been implemented in Sage. You
> have to figure out how to create a sparse matrix in magma
> and write Sage code to produce it. You can get inspiration
> from the current code of _magma_init_
>
>  def _magma_init_(self):
>  P = magma(self.parent())
>  v = [x._magma_init_(magma) for x in self.list()]
>  return '%s![%s]'%(P.name(), ','.join(v))
>
> Vincent
>

This would be a very useful addition (for some people).  Magma constructs
sparse matrices using SparseMatrix() with several interfaces including

(m::RngIntElt, n::RngIntElt, Q::SeqEnum[Tup]) -> MtrxSprs

The m by n sparse matrix, whose entries are given by the tuples in
Q of the form  (specifying that x is at entry (i, j)).

Example:

> M:=SparseMatrix(3,3,[<1,1,1>,<2,2,1>,<3,3,1>]);
> IdentitySparseMatrix(Integers(), 3) eq M;
true




>
> Le 26/02/2019 à 17:55, Pierre Guillot a écrit :
> > Thanks! I think to know where the issue is :
> >
> > M= random_matrix(ZZ, 10, sparse= True, density= 0.1)
> > M._magma_init_(magma)
> >
> >
> '_sage_[11]![0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,-1,0,0,0,0,0,0,0,-1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-14,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,8,0,0,0,0]'
> >
> >
> > This does not look like a sparse matrix to me : it's been converted to a
> > "dense" matrix before magma code was produced...
> >
> > no wonder if my 50,000 x 50,000 matrix takes forever to load...
> >
> > If anyone has an easy fix, it would be great. Otherwise, i'll have to
> learn
> > the syntax for sparse matrices in magma, and figure out how magma reads
> > from a file...
> >
> >
> >
> >
> >
> >
>
> --
> 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.


Re: [sage-support] Fwd: Sage Crash Report

2019-02-20 Thread John Cremona
On Wed, 20 Feb 2019 at 14:24, Douglas Webster 
wrote:

> Thank you, Isuru, for the assistance, but I'm afraid it still isn't
> working.  The program is still crashing, but this time it seems to be the
> elliptical curves module that is causing the problem.  A copy of the crash
> report is attached but I think I will reinstall the binary version of sage
> until package has been updated.
>

It looks as if eclib failed to build.  This is first noticed when building
the part of sagelib which uses it.  If you can find the part of your build
log relating to building eclib that might help debug.


>
> Best regards
> Douglas
>
> On Tue, 19 Feb 2019 at 19:18, Isuru Fernando  wrote:
>
>> This is a known issue with the conda package as the sage package hasn't
>> been updated yet for the new compiler runtimes on conda-forge.
>>
>> Try,
>>
>> conda create -n sage sage -c conda-forge/label/cf201901
>>
>> Isuru
>>
>> On Tue, Feb 19, 2019 at 1:11 PM Douglas Webster <
>> douglas.webster2...@gmail.com> wrote:
>>
>>>
>>>
>>>
>>> Operating system: See Attached file.
>>>
>>> I installed Sage using conda giving the following commands during the
>>> session as per the instructions on the sage website:
>>>
>>> conda update --all
>>> anaconda-navigator
>>> conda create -n sage sage
>>> conda activate sage
>>> sage
>>>
>>>
>>> I then removed the conda environment and reinstalled it following the
>>> above method.  The complete re-instillation session record is detailed in
>>> the file CrashReproduction.txt.
>>> Also included is the SystemInfo as reported by the Linux Mint app.
>>> There are two crash reports, Sage_crash_report_1st.txt being generated
>>> from the original installation and Sage_crash_report.txt from the
>>> reinstallation
>>>
>>> I have previously installed sage successfully as a binary package.  This
>>> I removed before trying it as a conda package.
>>>
>>> Hopefully this will be of some help.
>>>
>>> Best regards
>>> Douglas
>>>
>>> --
>>> 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.
>>
> --
> 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.


Re: [sage-support] Re: please explain casting in this example

2019-02-16 Thread John Cremona
1. You can use srange which works like range but gives a list of Sage
integers.
2. To coerce an int to a Sage Integer just use ZZ():

sage: srange(1,4)
[1, 2, 3]
sage: [type(i) for i in srange(1,4)]
[,
 ,
 ]
sage: range(1,4)
[1, 2, 3]
sage: [type(i) for i in range(1,4)]
[, , ]
sage: [type(ZZ(i)) for i in range(1,4)]
[,
 ,
 ]

Lastly, there are also xrange() and sxrange() which give iterators rather
than lists, useful if the range is big.


On Fri, 15 Feb 2019 at 23:27, Michael Beeson  wrote:

> Well,  the real cure is to use IntegerRange instead of range.
> Sorry to bother those of you who actually can read a manual.
>
>
> On Friday, February 15, 2019 at 2:56:14 PM UTC-8, Michael Beeson wrote:
>>
>> def test(p,q):
>> t = p/q;
>> print(p,q,p/q,t)
>> def test2():
>> for p in range(1,4):
>> for q in range(1,4):
>> test(p,q)
>>
>> sage: test2()
>>
>> (1, 1, 1, 1)
>>
>> (1, 2, 0, 0)
>>
>> (1, 3, 0, 0)
>>
>> (2, 1, 2, 2)
>>
>> (2, 2, 1, 1)
>>
>> (2, 3, 0, 0)
>>
>> (3, 1, 3, 3)
>>
>> (3, 2, 1, 1)
>>
>> (3, 3, 1, 1)
>>
>> sage: test(*2*,*3*)
>>
>> (2, 3, 2/3, 2/3)
>>
>> sage: version()
>>
>> 'SageMath version 8.0, Release Date: 2017-07-21'
>>
>>
>> When test(2,3) is executed at top-level, 2/3 is not cast to an integer.
>> But when
>>
>> it is executed inside test2,  2/3 becomes 0.  Why?  and how to prevent it?
>>
>>
>>
>> --
> 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.


Re: [sage-support] how to specify a port when running jupyter notebook

2019-02-04 Thread John Cremona
On Mon, 4 Feb 2019 at 10:01, Jan Groenewald  wrote:

> Hi
>
> On Mon, 4 Feb 2019 at 11:58, J E Cremona 
> wrote:
>
>> Is it possible to specify which port the jupyter notebook server runs
>> on?  I think the default is , but sometimes a different one is used
>> (e.g.8889 if  is in use).  I am running on a remote server so that
>> other users may already be doing something on the default port.  In order
>> to view the notebooks on my local machine's browser I use ssh-tunnelling
>> and like to have the port numbers fixed in my ~/.ssh/config file.  This is
>> awkward if I do not know in advance which port will be used.
>>
>>
>
> https://jupyter.readthedocs.io/en/latest/running.html#how-do-i-start-the-notebook-using-a-custom-ip-or-port
>

Thanks:  I can confirm that adding --port=8889  to the command line (after
sage -notebook=jupyter) does exactly what I needed.

Although this is obviously a jupyter thing and note a sage specific thing,
I think it would be helpful to have this somewhere in the Sage
documentation (I could not find it) and also visible in the "sage -h"
output.

John


>
> Regards,
> Jan
>
>
> --
>   .~.
>   /V\ Jan Groenewald
>  /( )\www.aims.ac.za
>  ^^-^^
>
> --
> 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.


Re: [sage-support] Re: attaching files in a jupyter notebook

2018-12-13 Thread John Cremona
On Wed, 12 Dec 2018 at 20:44, Nils Bruin  wrote:

> I would expect magic commands to work a little differently in the jupyter
> gui than on the command line, so the possibility for an error doesn't
> surprise me too much. It can probably be fixed. However, a straight-up
> "attach('')" would hopefully work? It still needs to hook into
> the REPL to actually check for a changed file and do the reloading, but
> that has a better chance of being the same between the IPython CLI shell
> and the Jupyter notebook.
>

Thanks for the suggestion, Nils.  However

attach('testcong.py')

also gives

UsageError: Invalid GUI request 'sage', valid ones are:['osx',
'widget', 'qt5', None, 'qt', 'nbagg', 'gtk', 'qt4', 'gtk3',
'notebook', 'tk', 'ipympl', 'inline', 'asyncio', 'wx']
















Looking at the docstring attach? shows

Note: Attaching files uses the Python inputhook, which will
 conflict with other inputhook users. This generally includes GUI
 main loop integrations, for example tkinter. So you can only use
 tkinter or attach, but not both at the same time.


which presumably means something to somebody, though not me.

I have a file testcong.py which contains various functions I am developing,
>> while testing them in a jupyter notebook.  The first cell in the notebook
>> has the "magic" line "%run testcong.py" and so whenever I make a change to
>> the .py file I have to re-click on that cell.  This gets tedious,
>> especially when the testing notebook has may cells in it since I am forever
>> scrolling up and down.
>>
>> There has to be a better way.  From the command line one can use attach
>> instead of runfile (which automatically rereads the file when it changes)
>> but I cannot get that to work, even though there is a magic %attach command:
>>
>> %attach testcong.py
>>
>> fails with a weird error message which is incomprehensible to me:
>>
>> "UsageError: Invalid GUI request 'sage', valid ones are:['osx', 'widget',
>> 'qt5', None, 'qt', 'nbagg', 'gtk', 'qt4', 'gtk3', 'notebook', 'tk',
>> 'ipympl', 'inline', 'asyncio', 'wx']"
>>
>> while
>>
>> %attach "testcong.py"
>>
>> (with quotes) is better, it just cannot find the file (which is in the
>> current directory, i.e. the one I started the notebook from).  But giving
>> the full pathname
>>
>> %attach "/home/jec/congruences/testcong.py"
>>
>> also gives "IOError: did not find file
>> '/home/jec/congruences/testcong.py"' to load or attach"
>>
>> What am I doing wrong?  I did try looking for documentation but failed...
>>
>> --
> 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.


[sage-support] attaching files in a jupyter notebook

2018-12-12 Thread John Cremona
I have a file testcong.py which contains various functions I am developing,
while testing them in a jupyter notebook.  The first cell in the notebook
has the "magic" line "%run testcong.py" and so whenever I make a change to
the .py file I have to re-click on that cell.  This gets tedious,
especially when the testing notebook has may cells in it since I am forever
scrolling up and down.

There has to be a better way.  From the command line one can use attach
instead of runfile (which automatically rereads the file when it changes)
but I cannot get that to work, even though there is a magic %attach command:

%attach testcong.py

fails with a weird error message which is incomprehensible to me:

"UsageError: Invalid GUI request 'sage', valid ones are:['osx', 'widget',
'qt5', None, 'qt', 'nbagg', 'gtk', 'qt4', 'gtk3', 'notebook', 'tk',
'ipympl', 'inline', 'asyncio', 'wx']"

while

%attach "testcong.py"

(with quotes) is better, it just cannot find the file (which is in the
current directory, i.e. the one I started the notebook from).  But giving
the full pathname

%attach "/home/jec/congruences/testcong.py"

also gives "IOError: did not find file '/home/jec/congruences/testcong.py"'
to load or attach"

What am I doing wrong?  I did try looking for documentation but failed...

-- 
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.


Re: [sage-support] Quaternions, how to speed up computation

2018-11-19 Thread John Cremona
On Mon, 19 Nov 2018 at 13:45, Dima Pasechnik  wrote:

>
>
> On Monday, November 19, 2018 at 1:14:38 PM UTC, Kolen Cheung wrote:
>>
>> "shut up" is language issue? You dont know whats bad language.
>
>
> I bet I can swear in more languages than you do: English, Russian, Dutch,
> German, Ukrainian, Polish, Yiddish, French, Italian...
> And when I worked in Singapore I even picked up some Hokkein and Tamil bad
> words, and other local words such as "ang moh" :-)
>
> So, yes, I do consider "shut up" rude. Please don't use it here.
>

Seconded (by a polite Englishman).


>
>
>
>
> --
> 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.


Re: [sage-support] Re: using parallel & fork decorators with timeout

2018-10-26 Thread John Cremona
Thanks Nils.  (In case you were wondering, I am using pari/gp to compute
spaces of modular forms).  I'll do some experiments: I have examples where
one method takes 10s of hours while another only a few minutes, but other
examples where it is the other way round!  and I have not yet been able to
work out what makes the difference.

John

On Thu, 25 Oct 2018 at 19:15, Nils Bruin  wrote:

> On Thursday, October 25, 2018 at 9:12:56 AM UTC-7, Nils Bruin wrote:
>>
>> On Thursday, October 25, 2018 at 7:13:26 AM UTC-7, John Cremona wrote:
>>>
>>> sage: for res in apply([f,g]): print res; break
>>> (((,), {}), 3^2 * 12248508919 *
>>> 263416276811813669131602539468011)
>>>
>>> The first bit of the output shows that it is f which returns the
>>> result.  But I don't know if g stops working because of the 'break' -- does
>>> it?
>>>
>>> It probably does, but you might program it a little more explicitly.
>
> If you change one of the functions to
>
> def g(N):
> while True:
> continue
> return 0
>
> and do something like
>
> @parallel(ncpus=4)
> def apply(func):
> return func(29038109543453453498320938204932840238210981)
>
> you have a little better guarantee that there will be a dangling job, so
> you can check with "top" if termination happens.
>
> With
>
> A=apply([f,g])
> res=A.next()
>
> I did see a dangling job. This was killed with
>
> del A
>
> As discussed before, that's not something you can formally rely on in
> python.
>
> As you can see here:
>
>
> https://github.com/sagemath/sage/blob/6187d261eca3c980e575b53d1a31f580ba8cfdfd/src/sage/parallel/use_fork.py#L230
>
> the generator function that produces the results does clean up after
> itself (and indeed, "delete" of a generator function that is in operation
> does trigger the "finally" clauses, as you'd home). It would be much better
> if that clean-up could be triggered explicitly, but that would require
> exposing a little more of the execution state on the "Parallel" object. It
> would be a fairly straightforward and small for someone with good python
> knowledge.
>
> In fact, in Py3, the support for asynchronous operations and coroutines
> has been MUCH improved, so at some point the parallel tools in sage should
> probably be rewritten to cooperate better in that framework.
>
> --
> 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.


Re: [sage-support] Deleting all zero rows in a matrix.

2018-10-02 Thread John Cremona
On Tue, 2 Oct 2018 at 08:56,  wrote:

> If I have a matrix  [1,0,1] [0,1,1] [0,0,0], [0,0,0], how do I delete the
> zero rows? (in this case rows 2 and 3). I know how to manually delete them,
> but what about for all cases, regardless of input. I want to have all the 0
> rows deleted in any matrix. Please Help!
>

sage: M = Matrix([[1,0,1], [0,1,1], [0,0,0], [0,0,0]])
sage: M
[1 0 1]
[0 1 1]
[0 0 0]
[0 0 0]
sage: Matrix(r for r in M.rows() if r)
[1 0 1]
[0 1 1]



> --
> 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.


Re: [sage-support] Re: jupyter notebook problem with 8,3

2018-08-09 Thread John Cremona
On 9 August 2018 at 12:20, Volker Braun  wrote:

> So whats in  /home/jec/.sage/jupyter-4.1/jupyter_notebook_config.json
>

Ah!  It contains

{
  "NotebookApp": {
"password": "sha1:af540ed8f4"
  }
}

(where I have deleted most of the password).  I moved that file away and
now all is well.

I will leave it to others to work out how that got there, but it may be
worth remembering in case this happens to anyone else.  I have no idea why
that file gets created or what I did/didn't do for it to be there when no
sessions were running.

Thanks for the suggestions, and especially to Volker.

John

-- 
> 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.


Re: [sage-support] Re: jupyter notebook problem with 8,3

2018-08-09 Thread John Cremona
s/notebook/static/components/proptypes/index.js
[D 12:15:00.678 NotebookApp] Path components/preact-compat/index.js served
from
/usr/local/sage/sage-2/local/lib/python2.7/site-packages/notebook/static/components/preact-compat/index.js
[D 12:15:00.678 NotebookApp] Path components/requirejs/require.js served
from
/usr/local/sage/sage-2/local/lib/python2.7/site-packages/notebook/static/components/requirejs/require.js
[D 12:15:00.679 NotebookApp] Path base/images/logo.png served from
/usr/local/sage/sage-2/local/lib/python2.7/site-packages/notebook/static/base/images/logo.png
[D 12:15:00.680 NotebookApp] 200 GET /login?next=%2Ftree%3F (::1) 70.99ms
[D 12:15:00.710 NotebookApp] Path custom.css served from
/usr/local/sage/sage-2/local/lib/python2.7/site-packages/notebook/static/custom/custom.css
[D 12:15:00.711 NotebookApp] 304 GET /custom/custom.css (::1) 2.39ms
[D 12:15:00.763 NotebookApp] Path auth/js/main.min.js served from
/usr/local/sage/sage-2/local/lib/python2.7/site-packages/notebook/static/auth/js/main.min.js
[D 12:15:00.764 NotebookApp] 304 GET /static/auth/js/main.min.js (::1)
2.14ms

and still no token is appearing.

Luckily I have other computers all working fine with 8.3, on which I have
moved my current work...

John



>
>
>
> On Thursday, August 9, 2018 at 10:25:44 AM UTC+2, John Cremona wrote:
>>
>>
>>
>> On 9 August 2018 at 08:26, Volker Braun  wrote:
>>
>>> The token does get generated for me, are you sure you don't have any
>>> funny configuration files in ~/.jupyter
>>>
>>
>> The is nothing in there except for a file 'migrated' containing
>> 2016-09-02T15:23:38.838391
>> (with no newline).  I have never done anything to configure jupyter.
>>
>> As I said, it worked always before I built 8.3.
>>
>>
>>> Unless you override it in the config, the generated url should have this
>>> form (including the access token):
>>>
>>> [I 09:21:59.267 NotebookApp] The Jupyter Notebook is running at:
>>> [I 09:21:59.267 NotebookApp] http://localhost:8889/?token=0
>>> df6ca362c920415eb1990bcfa4122baa094a3fdfa0f3709
>>>
>>
>> Yes, that is what I have always seen before.
>>
>> I installed the package Dima suggested but that does not affect this
>> issue.  It still behaves as it did yesterday.  Now the output is
>>
>>
>> $ sage --notebook=jupyter
>> ┌┐
>> │ SageMath version 8.3, Release Date: 2018-08-03 │
>> │ Type "notebook()" for the browser-based notebook interface.│
>> │ Type "help()" for help.│
>> └┘
>> Please wait while the Sage Jupyter Notebook server starts...
>> [I 09:13:40.197 NotebookApp] Using MathJax: nbextensions/mathjax/MathJax.j
>> s
>> [I 09:13:40.455 NotebookApp] The port  is already in use, trying
>> another port.
>> [I 09:13:40.460 NotebookApp] Serving notebooks from local directory:
>> /home/jec/.jupyter
>> [I 09:13:40.460 NotebookApp] 0 active kernels
>> [I 09:13:40.460 NotebookApp] The Jupyter Notebook is running at:
>> [I 09:13:40.461 NotebookApp] http://localhost:8889/
>> [I 09:13:40.461 NotebookApp] Use Control-C to stop this server and shut
>> down all kernels (twice to skip confirmation).
>> [68140:68140:0809/091341.230252:ERROR:sandbox_linux.cc(378)]
>> InitializeSandbox() called with multiple threads in process gpu-process.
>> [I 09:13:41.671 NotebookApp] 302 GET /tree (::1) 1.48ms
>> Created new window in existing browser session.
>>
>> and the new window asks or a password.  I still think it is something to
>> do with this:
>>
>> $ ps aux | grep jupyt
>> lowry12387  0.0  0.0 137702340 844 ?   S 2017   0:00 python
>> -m sage.repl.ipython_kernel -f /run/user/1074/jupyter/kernel-
>> 6a00c63e-3725-4a1f-9675-d31f3ca4346d.json
>> lowry13787  0.0  0.0 146488296 3404 ?  S 2017   0:00 python
>> -m sage.repl.ipython_kernel -f /run/user/1074/jupyter/kernel-
>> 6a00c63e-3725-4a1f-9675-d31f3ca4346d.json
>> lowry49983  0.0  0.0 137942964 330344 ?Ssl  Jul27   9:19 python
>> -m sage.repl.ipython_kernel -f /run/user/1074/jupyter/kernel-
>> 10384626-e3c4-4112-99fc-c9f3f72db136.json
>> lowry51560  0.0  0.0 138009880 336400 ?Ssl  Jul27   0:54 python
>> -m sage.repl.ipython_kernel -f /run/user/1074/jupyter/kernel-
>> 234bb5d0-b319-4b11-91bb-b8a5d0bb4a9d.json
>> lowry56073  0.0  0.0 415368 36708 pts/51   Sl+  Feb11  41:44 python
>> /usr/local/sage/sage-2/src/bin/sage-no

Re: [sage-support] Re: jupyter notebook problem with 8,3

2018-08-09 Thread John Cremona
On 9 August 2018 at 08:26, Volker Braun  wrote:

> The token does get generated for me, are you sure you don't have any funny
> configuration files in ~/.jupyter
>

The is nothing in there except for a file 'migrated' containing
2016-09-02T15:23:38.838391
(with no newline).  I have never done anything to configure jupyter.

As I said, it worked always before I built 8.3.


> Unless you override it in the config, the generated url should have this
> form (including the access token):
>
> [I 09:21:59.267 NotebookApp] The Jupyter Notebook is running at:
> [I 09:21:59.267 NotebookApp] http://localhost:8889/?token=
> 0df6ca362c920415eb1990bcfa4122baa094a3fdfa0f3709
>

Yes, that is what I have always seen before.

I installed the package Dima suggested but that does not affect this
issue.  It still behaves as it did yesterday.  Now the output is


$ sage --notebook=jupyter
┌┐
│ SageMath version 8.3, Release Date: 2018-08-03 │
│ Type "notebook()" for the browser-based notebook interface.│
│ Type "help()" for help.│
└┘
Please wait while the Sage Jupyter Notebook server starts...
[I 09:13:40.197 NotebookApp] Using MathJax: nbextensions/mathjax/MathJax.js
[I 09:13:40.455 NotebookApp] The port  is already in use, trying
another port.
[I 09:13:40.460 NotebookApp] Serving notebooks from local directory:
/home/jec/.jupyter
[I 09:13:40.460 NotebookApp] 0 active kernels
[I 09:13:40.460 NotebookApp] The Jupyter Notebook is running at:
[I 09:13:40.461 NotebookApp] http://localhost:8889/
[I 09:13:40.461 NotebookApp] Use Control-C to stop this server and shut
down all kernels (twice to skip confirmation).
[68140:68140:0809/091341.230252:ERROR:sandbox_linux.cc(378)]
InitializeSandbox() called with multiple threads in process gpu-process.
[I 09:13:41.671 NotebookApp] 302 GET /tree (::1) 1.48ms
Created new window in existing browser session.

and the new window asks or a password.  I still think it is something to do
with this:

$ ps aux | grep jupyt
lowry12387  0.0  0.0 137702340 844 ?   S 2017   0:00 python -m
sage.repl.ipython_kernel -f
/run/user/1074/jupyter/kernel-6a00c63e-3725-4a1f-9675-d31f3ca4346d.json
lowry13787  0.0  0.0 146488296 3404 ?  S 2017   0:00 python -m
sage.repl.ipython_kernel -f
/run/user/1074/jupyter/kernel-6a00c63e-3725-4a1f-9675-d31f3ca4346d.json
lowry49983  0.0  0.0 137942964 330344 ?Ssl  Jul27   9:19 python -m
sage.repl.ipython_kernel -f
/run/user/1074/jupyter/kernel-10384626-e3c4-4112-99fc-c9f3f72db136.json
lowry51560  0.0  0.0 138009880 336400 ?Ssl  Jul27   0:54 python -m
sage.repl.ipython_kernel -f
/run/user/1074/jupyter/kernel-234bb5d0-b319-4b11-91bb-b8a5d0bb4a9d.json
lowry56073  0.0  0.0 415368 36708 pts/51   Sl+  Feb11  41:44 python
/usr/local/sage/sage-2/src/bin/sage-notebook --notebook=jupyter --port=
lowry56179  0.0  0.4 3498740 2449576 ? Ssl  Feb11  15:55
/usr/local/sage/sage-2/local/bin/python -m ipykernel_launcher -f
/run/user/1074/jupyter/kernel-10500b86-2757-4ba6-9504-7ad81c57e5c4.json
jec  67068  0.0  0.0  14220  1012 pts/5S+   09:12   0:00 grep
--color=auto jupyt

but the user in question is currently somewhere in deepest Iceland.

If I simply run chromium-browser on this machine (which I am logging in to
remotely) I see those error messages:

$ chromium-browser
[68969:68969:0809/091759.024888:ERROR:sandbox_linux.cc(378)]
InitializeSandbox() called with multiple threads in process gpu-process.
[68932:69172:0809/091759.442701:ERROR:bus.cc(394)] Failed to connect to the
bus: Could not parse server address: Unknown address type (examples of
valid types are "tcp" and on UNIX "unix")
[68932:68932:0809/091759.537307:ERROR:gpu_process_transport_factory.cc(1016)]
Lost UI shared context.

(chromium-browser:68932): LIBDBUSMENU-GLIB-WARNING **: Unable to get
session bus: Unknown or unsupported transport 'disabled' for address
'disabled:'

which at least shows that some of the error messages I get when trying to
run Sage jupyter notebook are nothing to do with Sage.




>
>
> On Wednesday, August 8, 2018 at 5:38:03 PM UTC+2, John Cremona wrote:
>>
>> I just updagred to 8.3 on a machine (ubuntu 16.04) where I have
>> frequently run Sage both command-line and jupyter notebook previously.  Now
>> when I type
>>
>> sage --notebook=jupyter
>>
>> I see
>>
>> ┌┐
>> │ SageMath version 8.3, Release Date: 2018-08-03 │
>> │ Type "notebook()" for the browser-based notebook interface.│
>> │ Type "help()" for help.│
>&g

[sage-support] jupyter notebook problem with 8,3

2018-08-08 Thread John Cremona
I just updagred to 8.3 on a machine (ubuntu 16.04) where I have frequently
run Sage both command-line and jupyter notebook previously.  Now when I type

sage --notebook=jupyter

I see

┌┐
│ SageMath version 8.3, Release Date: 2018-08-03 │
│ Type "notebook()" for the browser-based notebook interface.│
│ Type "help()" for help.│
└┘
Please wait while the Sage Jupyter Notebook server starts...
[I 16:32:21.039 NotebookApp] Using MathJax: nbextensions/mathjax/MathJax.js
[I 16:32:21.347 NotebookApp] The port  is already in use, trying
another port.
[I 16:32:21.353 NotebookApp] Serving notebooks from local directory:
/home/jec/sage-scripts
[I 16:32:21.353 NotebookApp] 0 active kernels
[I 16:32:21.353 NotebookApp] The Jupyter Notebook is running at:
[I 16:32:21.353 NotebookApp] http://localhost:8889/
[I 16:32:21.354 NotebookApp] Use Control-C to stop this server and shut
down all kernels (twice to skip confirmation).
Gtk-Message: Failed to load module "pk-gtk-module"
Gtk-Message: Failed to load module "pk-gtk-module"
[54010:54010:0808/163222.159037:ERROR:sandbox_linux.cc(378)]
InitializeSandbox() called with multiple threads in process gpu-process.
[53973:54212:0808/163222.855277:ERROR:bus.cc(394)] Failed to connect to the
bus: Could not parse server address: Unknown address type (examples of
valid types are "tcp" and on UNIX "unix")
[53973:53973:0808/163222.961497:ERROR:gpu_process_transport_factory.cc(1016)]
Lost UI shared context.

(chromium-browser:53973): LIBDBUSMENU-GLIB-WARNING **: Unable to get
session bus: Unknown or unsupported transport 'disabled' for address
'disabled:'
[I 16:32:22.976 NotebookApp] 302 GET /tree (::1) 2.53ms


and the browser which pops up has a plain login page asking for a
password.  There is a different user currently running some sessions (2 of
which look stale as they have been running since 2017) which is why it
switched from port  to 8889, but I think from the above output that the
switch is incomplete and it wants me to log into his session on port .
Perhaps.

John

-- 
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.


Re: [sage-support] binomial() puts

2018-08-08 Thread John Cremona
On 7 August 2018 at 20:56, Vincent Delecroix <20100.delecr...@gmail.com>
wrote:

> The global binomial function is to be blamed. The one
> in arith works fine
>
> sage: R. = ZZ[]
> sage: sage.arith.all.binomial(q,2)
> 1/2*q^2 - 1/2*q
> sage: sage.arith.all.binomial(q,2).parent()
> Univariate Polynomial Ring in q over Rational Field
>

Thanks.  So if I put

from sage.arith.all import binomial

at the top then all works as expected.  This does leave the questions as to
why the symbolic version is imported but not this one.  Ideally the global
function would test the type / parent of the first input and use that to
decide which function to call.  The current practice will be a cause of
bugs.

John


>
> Vincent
>
> On 07/08/2018 07:08, J E Cremona wrote:
>
>> sage: R. = ZZ[]
>> sage: b = binomial(q,2)
>> sage: b
>> 1/2*(q - 1)*q
>> sage: b.parent()
>> Symbolic Ring
>>
>> especially when compared with
>>
>> sage: binomial(q,1).parent()
>> Univariate Polynomial Ring in q over Integer Ring
>>
>> John
>>
>>
> --
> 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.


Re: [sage-support] Re: Where is (the) kash?

2018-07-10 Thread John Cremona
On 10 July 2018 at 11:02, Dima Pasechnik  wrote:

>
>
> On Tuesday, July 10, 2018 at 10:58:45 AM UTC+1, John Cremona wrote:
>>
>>
>>
>> On 10 July 2018 at 10:48, Dima Pasechnik  wrote:
>>
>>> I imagine it makes little sense to ask for open-sourcing the kash
>>> package (have they sold stuff to somewhere, maybe?), although I might be
>>> wrong.
>>>
>>
>> I could ask Michael Pohst, though he has retired.
>>
>
> it's probably hopeless, as kash uses  Magma sources, see
> ftp://ftp.math.tu-berlin.de/pub/algebra/Kant/Kash_3/README
>
> We would like to thank
>
> o   Prof. J. Cannon at the University of Sydney, for the opportunity
> of using the MAGMA C-kernel for the development of KANT V4,
> the algorithmic part of KASH.
>
>
>
Yes.  When Magma started in the 1990s it used KANT for its algebraic number
theory so there is some symbiosis there.  I think it also at one point used
PARI for multiprecision arithmetic: it does still use MPFR, MPC and some
GMP.


>
>
>>
>> John
>>
>>
>>>
>>>
>>> On Tuesday, July 10, 2018 at 10:31:52 AM UTC+1, Dima Pasechnik wrote:
>>>>
>>>> surprisingly, there are freash trac tickets proposing kash interface
>>>> improvements:
>>>> https://trac.sagemath.org/ticket/25488
>>>> https://trac.sagemath.org/ticket/25494
>>>> https://trac.sagemath.org/ticket/22982 (a meta-ticket where kash is a
>>>> part of)
>>>>
>>>> I think it's unfortunately a wasted effort (as far as kash goes)...
>>>>
>>>>
>>>> On Tuesday, July 10, 2018 at 9:02:24 AM UTC+1, John Cremona wrote:
>>>>>
>>>>> Thanks for the replies.  There should be a ticket opened for removing
>>>>> the current instructions to use kash, whether or not they are replaced by
>>>>> something else.
>>>>>
>>>>> John
>>>>>
>>>>> On 9 July 2018 at 23:48, Alexander Konovalov 
>>>>> wrote:
>>>>>
>>>>>> Note that the Alnuth package for GAP switched from KANT to PARI/GP,
>>>>>> with the support of the Bill Allombert who provided an equivalent of
>>>>>> the
>>>>>> KANT code formerly used there.
>>>>>>
>>>>>> Alex
>>>>>>
>>>>>>
>>>>>> On Monday, July 9, 2018 at 7:16:22 PM UTC+1, Dima Pasechnik wrote:
>>>>>>>
>>>>>>> Imho kash has been totally bitrotten. The last release was in 2008.
>>>>>>> We should just remove that package and references to it.
>>>>>>
>>>>>> --
>>>>>> 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...@googlegroups.com.
>>>>>> To post to this group, send email to sage-s...@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...@googlegroups.com.
>>> To post to this group, send email to sage-s...@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.
>

-- 
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.


Re: [sage-support] Re: Where is (the) kash?

2018-07-10 Thread John Cremona
On 10 July 2018 at 10:48, Dima Pasechnik  wrote:

> I imagine it makes little sense to ask for open-sourcing the kash package
> (have they sold stuff to somewhere, maybe?), although I might be wrong.
>

I could ask Michael Pohst, though he has retired.

John


>
>
> On Tuesday, July 10, 2018 at 10:31:52 AM UTC+1, Dima Pasechnik wrote:
>>
>> surprisingly, there are freash trac tickets proposing kash interface
>> improvements:
>> https://trac.sagemath.org/ticket/25488
>> https://trac.sagemath.org/ticket/25494
>> https://trac.sagemath.org/ticket/22982 (a meta-ticket where kash is a
>> part of)
>>
>> I think it's unfortunately a wasted effort (as far as kash goes)...
>>
>>
>> On Tuesday, July 10, 2018 at 9:02:24 AM UTC+1, John Cremona wrote:
>>>
>>> Thanks for the replies.  There should be a ticket opened for removing
>>> the current instructions to use kash, whether or not they are replaced by
>>> something else.
>>>
>>> John
>>>
>>> On 9 July 2018 at 23:48, Alexander Konovalov 
>>> wrote:
>>>
>>>> Note that the Alnuth package for GAP switched from KANT to PARI/GP,
>>>> with the support of the Bill Allombert who provided an equivalent of the
>>>> KANT code formerly used there.
>>>>
>>>> Alex
>>>>
>>>>
>>>> On Monday, July 9, 2018 at 7:16:22 PM UTC+1, Dima Pasechnik wrote:
>>>>>
>>>>> Imho kash has been totally bitrotten. The last release was in 2008.
>>>>> We should just remove that package and references to it.
>>>>
>>>> --
>>>> 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...@googlegroups.com.
>>>> To post to this group, send email to sage-s...@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.
>

-- 
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.


Re: [sage-support] Re: Where is (the) kash?

2018-07-10 Thread John Cremona
Thanks for the replies.  There should be a ticket opened for removing the
current instructions to use kash, whether or not they are replaced by
something else.

John

On 9 July 2018 at 23:48, Alexander Konovalov 
wrote:

> Note that the Alnuth package for GAP switched from KANT to PARI/GP,
> with the support of the Bill Allombert who provided an equivalent of the
> KANT code formerly used there.
>
> Alex
>
>
> On Monday, July 9, 2018 at 7:16:22 PM UTC+1, Dima Pasechnik wrote:
>>
>> Imho kash has been totally bitrotten. The last release was in 2008.
>> We should just remove that package and references to it.
>
> --
> 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.


[sage-support] Where is (the) kash?

2018-07-09 Thread John Cremona
If you try (in Sage-8.2)

sage: x = polygen(QQ)
sage: f = x^12-2
sage: f.galois_group()

you will see the message

NotImplementedError: the package 'kash' was not found. You can install it
by running 'sage -i kash' in a shell
Sorry, computation of Galois groups of fields of degree bigger than 11 is
not yet implemented.  Try installing the optional free (closed source) KASH
package, which supports degrees up to 21, or use algorithm='magma' if you
have magma.

Now, 'sage -i kash' tells you

Error: package 'kash' not found
Note: if it is an old-style package, use -p instead of -i to install it

However, 'sage -p kash' gives

Attempting to download package kash
>>> Checking online list of optional packages.
ERROR [transfer|run:135]: [Errno 404] Not Found: '//
www.mirrorservice.org/sites/www.sagemath.org//spkg/optional/list'
sed: can't read /home/jec/.sage//optional.list: No such file or directory
>>> Checking online list of experimental packages.
ERROR [transfer|run:135]: [Errno 404] Not Found: '//
www.mirrorservice.org/sites/www.sagemath.org//spkg/experimental/list'
sed: can't read /home/jec/.sage//experimental.list: No such file or
directory
>>> Checking online list of huge packages.
ERROR [transfer|run:135]: [Errno 404] Not Found: '//
www.mirrorservice.org/sites/www.sagemath.org//spkg/huge/list'
sed: can't read /home/jec/.sage//huge.list: No such file or directory
Error: could not find a package matching kash
   Try 'sage --package list' to see the available packages
   Did you mean: yasm, arb, flask, gap, gap3?

so it seems that the kash package has disappeared.  In which case the
original error message is not so helpful unless you have Magma:

sage: f.galois_group(algorithm='magma')
Transitive group number 28 of degree 12

John

-- 
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.


Re: [sage-support] Re: PariError: bug in LLL_cmbf [no factor], please report

2018-06-13 Thread John Cremona
On 13 June 2018 at 10:30, Jeroen Demeyer  wrote:

> Thanks for checking. In the mean time, I guess the problem might be
> related to the fact that I'm using a non-default value for primelimit in GP
> (100 instead of 50).
>
> But if you say that the problem is fixed by the PARI upgrade, I consider
> this issue closed.


Agreed.  Thanks.  I'll add a comment on the trac ticket so that when we
upgrade the pari version in Sage we can check that this is fixed.


>
>
> --
> 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.


Re: [sage-support] Re: PariError: bug in LLL_cmbf [no factor], please report

2018-06-13 Thread John Cremona
With the current latest release
GP/PARI CALCULATOR Version 2.10.0
(alpha)
  amd64
running linux (x86-64/GMP-6.1.0 kernel) 64-bit version
   compiled: Jun 13
2018, gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.5)

threading engine: single

it seems to work fine.  I see that you have opened a ticket.  Thanks,

John

On 13 June 2018 at 09:40, John Cremona  wrote:

>
>
> On 13 June 2018 at 09:34, Jeroen Demeyer  wrote:
>
>> On 2018-06-13 10:25, John Cremona wrote:
>>
>>> THanks for looking into this Jeroen (I hoped you would).  The file
>>> bug.gp <http://bug.gp> you attached causes an error in the latest gp
>>> (version 2.10.0), after increasing parisizemax I get the same error
>>> message.
>>>
>>
>> What are the *exact steps* for reproducing it? I still haven't managed so
>> far.
>
>
> At the command line (bash on Linux) I type gp, and then at the first
> prompt I type
> \r bug.gp
>
> That led to the following exactly:
>
> $ gp
>
> GP/PARI CALCULATOR Version 2.10.0 (development git-88fb5b3)
>
> amd64 running linux (x86-64/GMP-6.0.0 kernel) 64-bit version
>compiled:
> Dec 12 2017, gcc version 4.8.5 20150623 (Red Hat 4.8.5-16) (GCC)
>
>   threading engine: single
>
>(readline v6.2 enabled, extended help enabled)
>
>
>Copyright (C) 2000-2017 The PARI Group
>
> PARI/GP is free software, covered by the GNU General Public License, and
> comes WITHOUT ANY WARRANTY WHATSOEVER.
>
> Type ? for help, \q to quit.
> Type ?15 for how to get moral (and possibly technical) support.
>
> parisize = 800, primelimit = 50
> ? \r bug.gp
>   ***   at top-level: nffactor(f,g)
>   *** ^-
>   *** nffactor: the PARI stack overflows !
>   current stack size: 800 (7.629 Mbytes)
>   [hint] set 'parisizemax' to a non-zero value in your GPRC
>
>   ***   Break loop: type 'break' to go back to GP prompt
> break>
> ? default(parisize,10)
>   ***   Warning: new stack size = 10 (953.674 Mbytes).
> ? \r bug.gp
>   ***   at top-level: nffactor(f,g)
>   *** ^-
>   *** nffactor: bug in LLL_cmbf [no factor], please report.
>   ***   Break loop: type 'break' to go back to GP prompt
>
>
>
>
>>
>>
>> --
>> 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.


Re: [sage-support] Re: PariError: bug in LLL_cmbf [no factor], please report

2018-06-13 Thread John Cremona
On 13 June 2018 at 09:34, Jeroen Demeyer  wrote:

> On 2018-06-13 10:25, John Cremona wrote:
>
>> THanks for looking into this Jeroen (I hoped you would).  The file
>> bug.gp <http://bug.gp> you attached causes an error in the latest gp
>> (version 2.10.0), after increasing parisizemax I get the same error
>> message.
>>
>
> What are the *exact steps* for reproducing it? I still haven't managed so
> far.


At the command line (bash on Linux) I type gp, and then at the first prompt
I type
\r bug.gp

That led to the following exactly:

$ gp

GP/PARI CALCULATOR Version 2.10.0 (development git-88fb5b3)
  amd64
running linux (x86-64/GMP-6.0.0 kernel) 64-bit version
   compiled:
Dec 12 2017, gcc version 4.8.5 20150623 (Red Hat 4.8.5-16) (GCC)

threading engine: single

 (readline v6.2 enabled, extended help enabled)


 Copyright (C) 2000-2017 The PARI Group

PARI/GP is free software, covered by the GNU General Public License, and
comes WITHOUT ANY WARRANTY WHATSOEVER.

Type ? for help, \q to quit.
Type ?15 for how to get moral (and possibly technical) support.

parisize = 800, primelimit = 50
? \r bug.gp
  ***   at top-level: nffactor(f,g)
  *** ^-
  *** nffactor: the PARI stack overflows !
  current stack size: 800 (7.629 Mbytes)
  [hint] set 'parisizemax' to a non-zero value in your GPRC

  ***   Break loop: type 'break' to go back to GP prompt
break>
? default(parisize,10)
  ***   Warning: new stack size = 10 (953.674 Mbytes).
? \r bug.gp
  ***   at top-level: nffactor(f,g)
  *** ^-
  *** nffactor: bug in LLL_cmbf [no factor], please report.
  ***   Break loop: type 'break' to go back to GP prompt




>
>
> --
> 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.


Re: [sage-support] Re: PariError: bug in LLL_cmbf [no factor], please report

2018-06-13 Thread John Cremona
THanks for looking into this Jeroen (I hoped you would).  The file bug.gp
you attached causes an error in the latest gp (version 2.10.0), after
increasing parisizemax I get the same error message.  But I compiled that
more than a week ago so probably before we send a bug report upstream we
should test it on the latest pari git commit.

John

On 12 June 2018 at 22:08, Jeroen Demeyer  wrote:

> I haven't managed to reproduce it in GP, I have no idea why. Typically,
> it's not so hard to translate a Sage bug like this to a PARI/GP bug. It
> must be something rather subtle. I'll try again tomorrow.
>
> I did manage to reproduce it with the PARI-in-Sage by running the attached
> GP script in Sage:
>
> sage: pari('read("/tmp/bug.gp")')
> 
> ---
> PariError Traceback (most recent call last)
>  in ()
> > 1 pari('read("/tmp/bug.gp")')
>
> cypari2/pari_instance.pyx in cypari2.pari_instance.Pari.__call__()
>
> cypari2/gen.pyx in cypari2.gen.objtogen()
>
> cypari2/handle_error.pyx in cypari2.handle_error._pari_err_handle()
>
> PariError: nffactor: bug in LLL_cmbf [no factor], please report
>
> --
> 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.


[sage-support] Re: PariError: bug in LLL_cmbf [no factor], please report

2018-06-12 Thread John Cremona
Sorry, I forgot to attach the polynomials.  (Exercise for the reader:
recompute them with a few lines of Sage using the hint in my original post).

On 12 June 2018 at 17:26, John Cremona  wrote:

> The error in the subject line comes from running the attached code which
> defines two monic integral polynomials in QQ[x], both irreducible and
> defining the same number field of degree 44, and trying to find a root of
> the second in the number field defined by the first:
>
> Trying K.is_isomorphic(L) works (and returns True. so  these polynomials
> really do define the same field.  (They are the characteristic polynomials
> of Hecke operatrs T2 and T3 acting on an irreducible space of modular forms
> for Gamma_1(25)).  That is strange since I would have thought that testing
> this involves finding roots of one modulo the other.
>
>
>
> K.embeddings(L) also fails with the same error.  (No surprise)
>
> John
>

-- 
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.


pols.sage
Description: Binary data


[sage-support] PariError: bug in LLL_cmbf [no factor], please report

2018-06-12 Thread John Cremona
The error in the subject line comes from running the attached code which
defines two monic integral polynomials in QQ[x], both irreducible and
defining the same number field of degree 44, and trying to find a root of
the second in the number field defined by the first:

Trying K.is_isomorphic(L) works (and returns True. so  these polynomials
really do define the same field.  (They are the characteristic polynomials
of Hecke operatrs T2 and T3 acting on an irreducible space of modular forms
for Gamma_1(25)).  That is strange since I would have thought that testing
this involves finding roots of one modulo the other.



K.embeddings(L) also fails with the same error.  (No surprise)

John

-- 
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.


Re: [sage-support] Re: editor for sage commands

2018-05-23 Thread John Cremona
On 23 May 2018 at 15:11, Emmanuel Charpentier  wrote:

> Dear Francesco,
>
> Le dimanche 20 mai 2018 18:57:54 UTC+2, Francesco a écrit :
>>
>> I tried to use emacs with sage-shell-mode, but I have some difficulty to
>> configure all things.
>>
>
> What is (are) the problem(s) ?
>
>
>> Furthermore I am a new user of emacs..
>>
>
> Aha ! This may explain that : emacs itself as a learning curve (not unlike
> the Matterhorn , according to
> some...). You may need to invest a bit in learning it. (This investment
> usually has a huge ROI...).
>

The view from the top is worth the climb.  (https://xkcd.com/378/)


>
> I strongly recommend that to give yourself a few hours to read the emacs
> tutorial (accessible from the "Help" menu of emacs) ;  keep in mind that
> some things, such as the use of control characters as movement keys,
> predate modern keyboards, are somewhat obsolete... Also, skim at least the
> table of contents of the emacs manual
> ,
> the introduction
>  to
> emacs lisp and the emacs lisp manual
>  ;
> n particular, try to familiarize yourself with the "Info mode", which is
> used to access the online help.
>
> This will help you understanding *why* and *how* you may customize emacs
> to use sage-shell-mode. Learning to customize this customization will need
> a bit more of understanding emacs lisp. But at this point, things should
> ave become easy...
>
>
>> Is there a clear guide of the operations to configure sage-shell-mode of
>> emacs?
>>
>
> Look at the sage-shell-mode github page
> . The README.md displayed
> there has a relatively extensive set of instructions for installation,
> customization and use, which require but the very basics of emacs use
> essentially the ability to edit your .emacs file)...
>
> HTH,
>
> --
> Emmanuel Charpentier
>
> Il giorno sabato 19 maggio 2018 18:58:29 UTC+2, Francesco ha scritto:
>>>
>>> Can you tell me a good editor for sage shell commands ? I try Texmacs,
>>> but it crashes.
>>> I have kubuntu 18.04 64bit and the version of sage in the repositories,
>>> the 8.1.
>>>
>>> --
> 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.


Re: [sage-support] Re: editor for sage commands

2018-05-20 Thread John Cremona
On Sun, 20 May 2018, 17:57 Francesco,  wrote:

> I tried to use emacs with sage-shell-mode, but I have some difficulty to
> configure all things. Furthermore I am a new user of emacs..
> Is there a clear guide of the operations to configure sage-shell-mode of
> emacs?
>

That would be helpful.  But it's easy to do something simpler, namely
adding a line in your emacs config file so that it goes into python mode
automatically for .sage files. That's what I do.



>
> Il giorno sabato 19 maggio 2018 18:58:29 UTC+2, Francesco ha scritto:
>>
>> Can you tell me a good editor for sage shell commands ? I try Texmacs,
>> but it crashes.
>> I have kubuntu 18.04 64bit and the version of sage in the repositories,
>> the 8.1.
>>
>> --
> 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.


[sage-support] jupyter notebook writefile magic: no end-of-line at the end

2018-05-01 Thread John Cremona
I was using the jupyter notebook's magic %%writefile, where you put
"%%writefile [-a] filename.py" at the top of a cell and then evaluating the
cell writes the cell's contents to the file (overwriting by default, or
appending if you give the -a flag).

I found that the file so written to has the correct contents except that
there is no final newline character.  This is particularly annoying when
you try (as I did) writing the contents of several cells to the same file,
using -a on all but the first, since after doing all that, you then have to
edit the file to insert some newlines.

Putting a blank line at the bottom of the cell makes no difference, as it
is ignored.  Putting a comment character # on the last line is no better
since that gets prepended to the first line of the next cell whose contents
is appended.

This is not Sage-specific since the same happens if I run jupyter-notebook
from the command line (on ubuntu linux) and create a new python3 notebook.

I found this post
https://stackoverflow.com/questions/36520723/how-to-append-a-file-with-a-newline-using-writefile-a-command-in-jupyter
which suggests putting a blank line at the top of each appended cell, and
that does work (though the resulting file still has no final newline).

This seems rather counter-intuitive to me!

John

-- 
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.


Re: [sage-support] scalar restriction in extension field

2018-04-16 Thread John Cremona
On 16 April 2018 at 12:04, Vincent Delecroix <20100.delecr...@gmail.com>
wrote:

> On 16/04/2018 09:21, fanxue...@iie.ac.cn wrote:
>
>> I have constructed  a big prime field:
>>
>>> p=68235916425158872634653027
 F=GF(p)

>>>
> Here is what I get
>
> sage: p = 68235916425158872634653027
> sage: F = GF(p)
> Traceback (most recent call last):
> ...
> ValueError: the order of a finite field must be a prime power


OK, but apart from typos in the report there is a real bug:

sage: p=next_prime(68235916425158872634653027)
sage: F=GF(p)
sage: E2=GF(p^6)

 AttributeError: 'int' object has no attribute 'divisors'




>
> --
> 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.


Re: [sage-support] points on a Fermat curve

2018-04-13 Thread John Cremona
This looks like a bug to me:

sage: F=GF(3)
sage: R.=F[]
sage: C=Curve(X^8+Y^8-Z^8)
sage: C.count_points(1) # correct count over GF(3^1)
[4]
sage: C.count_points(8) # should give counts over GF(3^n) for n=1..8 but it
crashes

TypeError: F (=[X^8 + Y^8 - Z^8]) must be a list or tuple of polynomials of
the coordinate ring of A  (=Projective Space of dimension 2 over Finite
Field in z2 of size 3^2)

-- note that the error message looks suspicious.

Also the more naive

sage: F=GF(3^8)
sage: R.=F[]
sage: C=Curve(X^8+Y^8-Z^8)
sage: C.count_points(1)
[4696]

works but is so slow it must be doing something very basic such as testing
every point in the plane (of which there are 3^16+3^8+1...)

John


On 13 April 2018 at 11:55, David Joyner  wrote:

> Hi:
>
> The question below is posted for Gary McGuire, who is not a subscriber
> to this list:
>
> "I would like to know the number of rational points on the (projective)
> curve
> x^8+y^8=z^8
> over the field of order 3^{18}.
>
> My question is, can Sage do this calculation, and how?"
>
> - David
>
> 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.
>
> --
> 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.


Re: [sage-support] Re: Displaying Sagetex code

2018-03-19 Thread John Cremona
Harald, you might be interested in this example:
https://arxiv.org/src/1306.6818v3/anc/X13.pdf

John Cremona

On 19 March 2018 at 10:59, Emmanuel Charpentier <
emanuel.charpent...@gmail.com> wrote:

>
>
> Le dimanche 18 mars 2018 19:28:02 UTC+1, Harald Helfgott a écrit :
>>
>> it is possible to
>>
>> (a) display Sagetex code within TeX in a relatively "clean" fashion (one
>> that can be sent to referees, say, rather than just to one's friends),
>>
>
> That's what sageblock is supposed to do...
>
> If you want to refine the presentation of your code, you might use an
> external file (possibly generated froM the \LaTeX code itself, see my
> answer to my own ask.sagemath.org question
> <https://ask.sagemath.org/question/36422/sagetex-how-to-capture-sageblock-output-for-future-use/>),
> then using \lstinputlisting or \minted to your heart's content...
>
> (b) make variable names appear as footnotes to their values, when
>> displayed via \sage (as opposed to \sageblock)? Again, the purpose would be
>> debugging/refereeing.
>>
>
> ??? Could you give us an example of what you want to do ? I have trouble
> visualizing it...
>
> --
> Emmanuel Charpentier
>
> --
> 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.


[sage-support] Request for a large download of data

2018-03-13 Thread John Cremona
>From the bug-report spreadsheet:

I am a PhD student in Mathematics at Oxford interested in identifying
modular forms given their q expansions. To do this it would be useful to
have a copy of the `webnewforms` collection listed here
https://github.com/LMFDB/lmfdb-inventory/blob/master/db-modularforms2.md.
As far as I can see I can download this this from the readonly MongoDB host
at m0.lmfdb.xyz.

However, before I do it, I just wanted to check that it's ok to make a
large query direct to the database, i.e. not through the website, and that
I won't be violating some kind of (possibly informal) fair use policy.

Thanks,
Alex

-- 
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.


Re: [sage-support] Re: Is this a bug?

2018-02-28 Thread John Cremona
On 28 February 2018 at 13:49, Ralf Stephan  wrote:

> Why should I define x when Sage gives me a polynomial with x, doesn't it
> already know it?
>
> That's what a user would ask and, frankly, s/he would be right.
>

Here is one reason.  In this example:

sage: M=Matrix([[1,2,3],[4,5,6],[7,8,9]])
sage: p = M.charpoly()
sage: p.parent()
Univariate Polynomial Ring in x over Integer Ring
sage: p
x^3 - 15*x^2 - 18*x
sage: x.parent()
Symbolic Ring

when we see the polynomial displayed we see the variable displayed as x,
but there has been no assignment to the python variable 'x' behind the
scenes.  You are suggesting (it seems) that after computing p here the
python variable 'x' should be bound to p.parent().gen().  But it is surely
a very Bad Idea for a function to (re)-assign global variables?  This would
be a source of many bugs.

It would probably be less confusing if there was no globally defined 'x' at
all as has been suggested earlier in this thread.  Then the last line of my
example would raise an error, and the documentation could tell users to
enter something like 'x = p.parent().gen()' or 'x = p.variables()[0]'
 (the latter would be better if a method variable() existed for univariate
polynomials!).

John



> --
> 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.


Re: [sage-support] Memory leak in loops (SageMath 8.1)

2017-12-15 Thread John Cremona
I think Marco (who works with me) took my suggestion to simplify his
problem code as much as possible before posting a little too literally.
Marco, send in something closer to what you showed me yesterday (which was
about factorization of polynomials of degree 4 in F[X,Y,Z] with F a quite
small finite field).

Vincent, if you are still in Warwick today Marco could show you his code
directly.

John

On 15 December 2017 at 12:13, Vincent Delecroix <20100.delecr...@gmail.com>
wrote:

> You can fill your memory with something simpler
>
>   sage: l = range(10**9)
>
> As far as I can see it has nothing to do with Sage or loops. In Python2
> the range functions constructs a list. And in the above example, the list
> is huge.
>
> Vincent
>
>
> On 15/12/2017 12:06, Marco Caselli wrote:
>
>> Hello there,
>> I am currently having trouble in memory management, I wrote a code that
>> was
>> not supposed to store anything but actually it was using a massive amount
>> of memory. At a first glance, I thought it was related to some function in
>> my code, such as factor() for polynomials in a multivariate ring over a
>> finite field.  I dug a bit deeper and the problem seems even at a lower
>> level:
>>
>> def check_memory(k):
>>
>>> a=get_memory_usage()
>>> silly_function(k)
>>> return get_memory_usage()-a
>>>
>>> def silly_function(k):
>>> for i in range(10^k):
>>> 2+2
>>>
>>
>>
>> Notice that silly_function does not store neither return anything, so the
>> memory usage should be zero.
>> check_memory(9) returned 23446.37109375, this amount is in MB, so those
>> are
>> 23GB. This information is consistent with the data from top. At a second
>> run it returned just 972.62109375, which is still a lot.
>>
>>
> --
> 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.


Re: [sage-support] Re: multiuser jupyter notebook server?

2017-10-31 Thread John Cremona
Thanks -- in fact I had installed jupyterhub already so I am now
looking at how to run it securely.

John

On 31 October 2017 at 09:46, Dima Pasechnik <dimp...@gmail.com> wrote:
> Hi John,
>
> you need jupyterhub for this. There are threads here on how to set it up for
> Sage.
> It would actually be good to figure this out in a good way, under the ODK
> umbrella.
>
> Cheers,
> Dima
>
>
> On Tuesday, October 31, 2017 at 9:39:12 AM UTC, John Cremona wrote:
>>
>> With the old Sage notebook one could start a server running and allow
>> multiple users to create accounts and log into it (say behind a
>> firewall for security).  Is that possible with the Jupyter notebook?
>> I have tried but unsuccessfully except as follows: when jupyter starts
>> up (i.e. I type 'sage -n=jupyter' on the server) it automatically
>> opens up in my own browser, and  also reveals a URL of the form
>>
>> http://localhost:8889/?token=
>>
>> Now another user with an account on the server can successfully open
>> that if they use an ssh tunnel to redirect the sever's port 8889 to
>> their own machine, but if we replace localhost by the server's actual
>> name on the network it will not connect.  I don't think that this is a
>> firewall issue (though it could be) since with the old notebook server
>> there was no problem connecting to a port number such as this on the
>> local network.
>>
>> I know that there are much fancier options such as running the Cocalc
>> docker image but right now that would take me too long to set up in a
>> secure way (it is all too easy to run that with no security but that
>> is definitely not recommended!).
>>
>> John
>>
>> PS Here is exactly what I see after typing 'sage -n=jupyter' on the
>> server, with tokens redacted:
>>
>> $ sage -n=jupyter
>> ┌┐
>> │ SageMath version 8.0, Release Date: 2017-07-21 │
>> │ Type "notebook()" for the browser-based notebook interface.│
>> │ Type "help()" for help.│
>> └┘
>> Please wait while the Sage Jupyter Notebook server starts...
>> [I 09:29:57.771 NotebookApp] Using MathJax:
>> nbextensions/mathjax/MathJax.js
>> [I 09:29:58.260 NotebookApp] The port  is already in use, trying
>> another port.
>> [I 09:29:58.265 NotebookApp] Serving notebooks from local directory:
>> /home/jec
>> [I 09:29:58.265 NotebookApp] 0 active kernels
>> [I 09:29:58.265 NotebookApp] The Jupyter Notebook is running at:
>> http://localhost:8889/?token=***
>> [I 09:29:58.265 NotebookApp] Use Control-C to stop this server and
>> shut down all kernels (twice to skip confirmation).
>> [C 09:29:58.266 NotebookApp]
>>
>> Copy/paste this URL into your browser when you connect for the first
>> time,
>> to login with a token:
>> http://localhost:8889/?token=***
>> Failed to connect to Mir: Failed to connect to server socket: No such
>> file or directory
>> Unable to init server: Broadway display type not supported: localhost:11.0
>> Error: cannot open display: localhost:11.0
>> /usr/bin/xdg-open: 771: /usr/bin/xdg-open: iceweasel: not found
>> /usr/bin/xdg-open: 771: /usr/bin/xdg-open: seamonkey: not found
>> /usr/bin/xdg-open: 771: /usr/bin/xdg-open: mozilla: not found
>> /usr/bin/xdg-open: 771: /usr/bin/xdg-open: epiphany: not found
>> /usr/bin/xdg-open: 771: /usr/bin/xdg-open: konqueror: not found
>> /usr/bin/xdg-open: 771: /usr/bin/xdg-open: google-chrome: not found
>> /usr/bin/xdg-open: 771: /usr/bin/xdg-open: www-browser: not found
>> /usr/bin/xdg-open: 771: /usr/bin/xdg-open: links2: not found
>> /usr/bin/xdg-open: 771: /usr/bin/xdg-open: elinks: not found
>> /usr/bin/xdg-open: 771: /usr/bin/xdg-open: links: not found
>> /usr/bin/xdg-open: 771: /usr/bin/xdg-open: lynx: not found
>> /usr/bin/xdg-open: 771: /usr/bin/xdg-open: w3m: not found
>> xdg-open: no method available for opening
>> 'http://localhost:8889/tree?token=***'
>>
>> The first and second tokens are the same but the third is different.
>> I don't know if any of those errors is at all important.
>
> --
> 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@googlegro

[sage-support] multiuser jupyter notebook server?

2017-10-31 Thread John Cremona
With the old Sage notebook one could start a server running and allow
multiple users to create accounts and log into it (say behind a
firewall for security).  Is that possible with the Jupyter notebook?
I have tried but unsuccessfully except as follows: when jupyter starts
up (i.e. I type 'sage -n=jupyter' on the server) it automatically
opens up in my own browser, and  also reveals a URL of the form

http://localhost:8889/?token=

Now another user with an account on the server can successfully open
that if they use an ssh tunnel to redirect the sever's port 8889 to
their own machine, but if we replace localhost by the server's actual
name on the network it will not connect.  I don't think that this is a
firewall issue (though it could be) since with the old notebook server
there was no problem connecting to a port number such as this on the
local network.

I know that there are much fancier options such as running the Cocalc
docker image but right now that would take me too long to set up in a
secure way (it is all too easy to run that with no security but that
is definitely not recommended!).

John

PS Here is exactly what I see after typing 'sage -n=jupyter' on the
server, with tokens redacted:

$ sage -n=jupyter
┌┐
│ SageMath version 8.0, Release Date: 2017-07-21 │
│ Type "notebook()" for the browser-based notebook interface.│
│ Type "help()" for help.│
└┘
Please wait while the Sage Jupyter Notebook server starts...
[I 09:29:57.771 NotebookApp] Using MathJax: nbextensions/mathjax/MathJax.js
[I 09:29:58.260 NotebookApp] The port  is already in use, trying
another port.
[I 09:29:58.265 NotebookApp] Serving notebooks from local directory: /home/jec
[I 09:29:58.265 NotebookApp] 0 active kernels
[I 09:29:58.265 NotebookApp] The Jupyter Notebook is running at:
http://localhost:8889/?token=***
[I 09:29:58.265 NotebookApp] Use Control-C to stop this server and
shut down all kernels (twice to skip confirmation).
[C 09:29:58.266 NotebookApp]

Copy/paste this URL into your browser when you connect for the first time,
to login with a token:
http://localhost:8889/?token=***
Failed to connect to Mir: Failed to connect to server socket: No such
file or directory
Unable to init server: Broadway display type not supported: localhost:11.0
Error: cannot open display: localhost:11.0
/usr/bin/xdg-open: 771: /usr/bin/xdg-open: iceweasel: not found
/usr/bin/xdg-open: 771: /usr/bin/xdg-open: seamonkey: not found
/usr/bin/xdg-open: 771: /usr/bin/xdg-open: mozilla: not found
/usr/bin/xdg-open: 771: /usr/bin/xdg-open: epiphany: not found
/usr/bin/xdg-open: 771: /usr/bin/xdg-open: konqueror: not found
/usr/bin/xdg-open: 771: /usr/bin/xdg-open: google-chrome: not found
/usr/bin/xdg-open: 771: /usr/bin/xdg-open: www-browser: not found
/usr/bin/xdg-open: 771: /usr/bin/xdg-open: links2: not found
/usr/bin/xdg-open: 771: /usr/bin/xdg-open: elinks: not found
/usr/bin/xdg-open: 771: /usr/bin/xdg-open: links: not found
/usr/bin/xdg-open: 771: /usr/bin/xdg-open: lynx: not found
/usr/bin/xdg-open: 771: /usr/bin/xdg-open: w3m: not found
xdg-open: no method available for opening 'http://localhost:8889/tree?token=***'

The first and second tokens are the same but the third is different.
I don't know if any of those errors is at all important.

-- 
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.


Re: [sage-support] Re: which browser

2017-10-23 Thread John Cremona
On 20 October 2017 at 22:00, John H Palmieri <jhpalmier...@gmail.com> wrote:
> Have you tried setting the BROWSER environment variable? If that doesn't
> work, what about SAGE_BROWSER?

Thanks -- I am now feeling quite red-faced since my .bashrc file has

export BROWSER=firefox

in it.  Changing that to chromium-browser does the trick.  This is a
university-supplied & configured machine which recently had a system
upgrade.  They used not to provide chrome but now they do.  They also
provide Sage-8.0 as standard!

John

>
>   John
>
>
> On Friday, October 20, 2017 at 7:38:58 AM UTC-7, John Cremona wrote:
>>
>> On 20 October 2017 at 15:34, John Cremona <john.c...@gmail.com> wrote:
>> > I am running Sage on a linux machine which has chromium-browser as the
>> > default browser, but when I type
>> >
>> > sage --notebook=jupyter
>> >
>> > it starts firefox and opens in a tab there.  How can I get it to use
>> > chrome?
>>
>>
>> sage --notebook=jupyter --browser=chromium-browser
>>
>>
>> does work but can I make it the default?
>> >
>> > John
>
> --
> 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.


[sage-support] Re: which browser

2017-10-20 Thread John Cremona
On 20 October 2017 at 15:34, John Cremona <john.crem...@gmail.com> wrote:
> I am running Sage on a linux machine which has chromium-browser as the
> default browser, but when I type
>
> sage --notebook=jupyter
>
> it starts firefox and opens in a tab there.  How can I get it to use chrome?


sage --notebook=jupyter --browser=chromium-browser


does work but can I make it the default?
>
> John

-- 
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.


[sage-support] which browser

2017-10-20 Thread John Cremona
I am running Sage on a linux machine which has chromium-browser as the
default browser, but when I type

sage --notebook=jupyter

it starts firefox and opens in a tab there.  How can I get it to use chrome?

John

-- 
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.


Re: [sage-support] Re: dividing polynomials without ending up in quotient field

2017-10-18 Thread John Cremona
On 18 October 2017 at 10:00, Dima Pasechnik  wrote:
>
>
> On Wednesday, October 18, 2017 at 9:28:50 AM UTC+1, Robin van der veer
> wrote:
>>
>> Hello,
>>
>> If I have, say,
>>
>>  R = PolynomialRing(QQ, 'x', 5)
>>
>> And I have two polynomials, one of which divides the other. Then I can do
>> f/g
>> but the result will be an element of the fraction field of R, even though
>> it actually lives in R. I can write
>> (f/g).numerator()
>> to get back to R, but I feel that this shouldn't be necessary. Is there
>> some way to perform this division and stay in R?

f//g  will be in R.

>
>
> Please provide a concrete example showing this. Indeed, I think
> (f/g).numerator() will be in R.
>
> --
> 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.


[sage-support] Fwd: typos wanted

2017-09-08 Thread John Cremona
-- Forwarded message --
From: paul zimmermann 
Date: 8 September 2017 at 09:27
Subject: typos wanted
To: john.crem...@gmail.com


   John,

please could you post the following to sage-support (and maybe sage-devel)?
Thank you,
Paul

--
The book "Calcul Mathématique avec Sage" is now available in electronic form
in english, updated to Sage version 8.0:

https://members.loria.fr/PZimmermann/sagebook/english.html

Any typo or error reported before October 1st will be mentioned in the preface
of the final version (contact mail is given in the above web page).
--

-- 
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.


Re: [sage-support] 8.0 Installation Guide Error

2017-09-04 Thread John Cremona
On 4 September 2017 at 07:53, Pstrang Rzekle  wrote:
> Installation Guide for 8.0, Section "3.7 Installation in a Multiuser
> Environment"
> and also here:
> http://doc.sagemath.org/html/en/installation/source.html#installation-in-a-multiuser-environment
>
> erroneously inform the reader how to install in a system-wide or multi-user
> environment.
>
> Following Step 3. "Using your normal user account, build Sage.", then Step 4
> says:
>
> Make a symbolic link to the sage script in /usr/local/bin: "ln -s
> /path/to/sage-x.y/sage /usr/local/bin/sage"
>
> Really? Since the "/path/to/sage-x.y/sage" is still in your normal user
> account, no other "multiuser" can execute the sage script.

No, you can change the permissions there so all can read and execute.
But see below

>
> Can anyone properly share the process to install for a
> system-wide/multi-user environment?

This is what I do:

I create a directory /usr/local/sage owned by my normal username
(which of course has to have sudo privileges).  Everything happens in
there.  In that directory I have 2 sage builds from source, in
separate directories called sage-1 and sage-2, and a symbolic link
sage-current from one of those (the current one) say
/usr/local/sage/sage-1 is linked from /usr/local/sage/sage-current.
After building a new sage in /usr/local/sage/sage-1 I make all that
directory read/executable by all using chmod -r a+rX.  Meanwhile
/usr/local/bin/sage is set (once and for all) to be a link to
/usr/local/sage/sage-current/sage.

Now when I want to build a new sage without breaking the current one
even temporarily for users, I use the second directory (say sage-2)
for that.  When done and tested I just move the link sage-current to
point to sage-2 instead of sage-1, and users automatically get the new
version.  Next time round, the roles of sage-1 and sage-2 are
reversed.

This does use up space of course (on one machine my old 7.6 build is
using up 11G while the current 8.0 uses 9.4G).  You could of course
empty out the non-current directory, but then building the new version
will take longer.

There may be cleverer ways of doing things but this works for me.  Of
course, I have yet another sage directory under my home directory for
development work which does not touch /usr/local/sage at all.

>
> Which executables are actually needed?  Should I copy the entire 'local'
> directory to someplace like /opt/SageMath?  Then what commands to change
> owner/group and permissions from my normal user?  I don't want to 'chmod
> 755' everything.
>
> Thank you!
>
>
>
>
> --
> 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.


[sage-support] Re: [forwarded from bug tracker]

2017-08-16 Thread John Cremona
Apologies, that was supposed to go to lmfdb-support.  Ignore!

John

On 16 August 2017 at 08:48, John Cremona <john.crem...@gmail.com> wrote:
> This is a very minor comment about the description/definition of "GL_2
> type" in the genus 2 curve page (after clicking the "GL_2 type" link).
> The last sentence is a bit misleading. Perhaps it should say "the
> endomorphism algebra is 2-dimensional over Q" as opposed to "the
> endomorphism algebra is isomorphic to Q \oplus Q". The notation in the
> latter makes it seem like the endomorphism algebra is isomorphic *as
> an algebra* to Q \oplus Q, which it need not be. The first sentence of
> the paragraph points this out, but the (current) last sentence makes
> it sound like the split quadratic algebra is the only one that can
> occur among GL_2-type, genus 2 Jacobians. (And this is not the case.)
>
> Best,
> Ari Shnidman
> shnid...@bc.edu
>
> --
>
> I'll make an Issue for this.

-- 
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.


[sage-support] [forwarded from bug tracker]

2017-08-16 Thread John Cremona
This is a very minor comment about the description/definition of "GL_2
type" in the genus 2 curve page (after clicking the "GL_2 type" link).
The last sentence is a bit misleading. Perhaps it should say "the
endomorphism algebra is 2-dimensional over Q" as opposed to "the
endomorphism algebra is isomorphic to Q \oplus Q". The notation in the
latter makes it seem like the endomorphism algebra is isomorphic *as
an algebra* to Q \oplus Q, which it need not be. The first sentence of
the paragraph points this out, but the (current) last sentence makes
it sound like the split quadratic algebra is the only one that can
occur among GL_2-type, genus 2 Jacobians. (And this is not the case.)

Best,
Ari Shnidman
shnid...@bc.edu

--

I'll make an Issue for this.

-- 
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.


Re: [sage-support] Re: Polynomial factorization over modular ring

2017-08-15 Thread John Cremona
On 15 August 2017 at 18:42, Nils Bruin <nbr...@sfu.ca> wrote:
> On Tuesday, August 15, 2017 at 7:21:03 AM UTC-7, chandra chowdhury wrote:
>>
>> Is it possible to factor polynomials completely over modular ring?
>>
>> Like
>> x = var('x')
>> factor(x^5-x, IntegerModRing(25)['x'])
>> gives
>>
>> (x-1)(x+1)(x^2+1)*x
>
> The second argument is simply ignored here, by the looks of it
>
> sage: factor(x^5-x,"moo")
> (x^2 + 1)*(x + 1)*(x - 1)*x
>
> You could file that as a (mild) bug.
>
> Factorization of Z/25 directly isn't implemented:
>
> sage: R=IntegerModRing(25)
> sage: Rx.=R[]
> sage: factor(x^5-x)
> NotImplementedError: factorization of polynomials over rings with composite
> characteristic is not implemented
>
> Root finding is apparently implemented:
>
> sage: (x^5-x).roots(multiplicities=False)
> [0, 1, 7, 18, 24]
>
> Alternatively, (beccause you're working mod a prime power) you could look at
> p-adic rings:
>
> sage: R=Zp(5,2,"fixed-mod",print_mode="terse")
> sage: Rx.=R[]
> sage: (x^5-x).factor()
> ((1 + O(5^2))*x + (1 + O(5^2))) * ((1 + O(5^2))*x + (7 + O(5^2))) * ((1 +
> O(5^2))*x + (18 + O(5^2))) * ((1 + O(5^2))*x + (24 + O(5^2))) * ((1 +
> O(5^2))*x + (0 + O(5^2)))
>
> The "+O(5^2)" is a p-adic thing that would be nice to suppress here.

A relevant point, perhaps, is that polynomials over Z/25Z do not form
a unique factorization domain (or even a domain) so even the
definition of what factors you might want to see is unclear.
Following Nils, for a prime power modulus, a sensible definition is to
take an approximation of the p-adic factorization.  The for a general
modulus the Chinese remainder theorem is probably relevant.

To illustrate my non-uniqueness point, modulo 8 we have x^2-1 =
(x+1)(x-1) = (x-3)(x+3).

John Cremona

>
>
> --
> 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.


Re: [sage-support] cyclic algebras

2017-07-10 Thread John Cremona
On 10 July 2017 at 14:56, Nils Bruin <nbr...@sfu.ca> wrote:
> On Monday, July 10, 2017 at 3:38:27 PM UTC+2, John Cremona wrote:
>>
>> Sage does have a function is_norm() for number field elements so the
>> underlying algebraic problem should be solvable.
>
>
> It looks like the implementation of this routine requires a galois
> extension:

True but in the given context the base field has the p'th roots of
unity and the extensions are just Kummer extensions, Galois  with
cyclic group of order p.

>
> sage: K.=NumberField(x^3-2)
> sage: 7.is_norm(K)
> NotImplementedError: is_norm is not implemented unconditionally for norms
> from non-Galois number fields
>
> gp/pari does seem to be able to compute these things via s-unit equations,
> though:
>
> sage: len([i for i in range(100) if gp.bnfisnorm(K,i)[1].norm() == i])
> 68
>
> --
> 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.


Re: [sage-support] cyclic algebras

2017-07-10 Thread John Cremona
Sage does have a function is_norm() for number field elements so the
underlying algebraic problem should be solvable.

Example (p=3):

sage: Q3. = CyclotomicField(3)
sage: a=2+3*z
sage: b=3+4*z
sage: x=polygen(Q3)
sage: L.=Q3.extension(x^3-a)
sage: b.is_norm(L)
False

On 10 July 2017 at 14:23, Pierre  wrote:
> Hi all !
>
> I wanted to know whether Sagemath had any support for cyclic algebras. From
> the manual, I strongly suspect the answer is "no", but you never know.
>
> Let me be more concrete. For a prime p, let K be QQ with the p-th roots of
> unity adjoined. For a, b in K, there is a cyclic algebra (a,b) over K
> (technically, this depends on a choice of primitive root in K); for p=2,
> this is the quaternion algebra (a, b) over QQ.
>
> I would like to be able to answer questions such as: is (a,b) trivial? For
> p=2, Sage does this, essentially with hilbert_conductor(a,b).
>
> Also, (a,b) is trivial if and only if b is a norm from K[a^(1/p)]. Finding
> explicitly an element from this field whose norm is b would be awesome. When
> p=2 and so K=QQ, it's a matter of finding x, y in QQ such that x^2 - ay^2 =
> b, and trying random values for x and y (essentially...) works fine. Over
> more complicated fields, PARI has functions accessible through sage to find
> points on conics.
>
> If any of the above can be facilitated by Sage for p odd, it would be great.
>
> Thanks!
> Pierre
>
> --
> 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.


Re: [sage-support] Computation just stops, no output or error message

2017-06-07 Thread John Cremona
My guess is that the output is buffered, i.e. it does not get actually
written out unti lthe buffer reaches some size.  You can get python to
flush the output after every output statement and then see what is
happening a bit better.

John

On 7 June 2017 at 16:33, Robin van der veer  wrote:
> Hi,
>
> I'm running a windows 10 host, and I have sage running in virtualbox; I just
> downloaded the .ova file from the website.
> I have virutalbox set up so it uses 6/8 of my cores, and 5GB of mem.
> It could be the case the 6 processes combined exceed this 5GB. Would this
> explain Sage quitting in the way I described?
>
> Op woensdag 7 juni 2017 17:30:37 UTC+2 schreef Jan Groenewald:
>>
>> Hi
>>
>>
>> On 7 June 2017 at 17:24, Robin van der veer  wrote:
>>>
>>> I'm running Sage on my local machine (so not the sage math cloud), and
>>> some of my computations just stop with no output or error message.
>>> My code looks essentially like this:
>>>
>>> @parallel
>>> def compute(revLex):
>>> long computations
>>> print some stuff
>>> write some stuff to files
>>> return
>>>
>>> r = compute(L)
>>> for x in r:
>>> x
>>>
>>> When I work with small cases, everything is fine. However for bigger
>>> cases the computations tend to take upwards of 2 hours, and then just stop.
>>> The only reason why I know one of the computations even stopped is
>>> because I'm staring at TOP in a console window and see the uptime jump from
>>> 110 orso minutes to 0 minutes, meaning that one job was finished, and it
>>> started working on the next.
>>> When this happens no output is printen, and the file to which some stuff
>>> should have been written is empty.
>>>
>>> What could cause this (besides a programming error on my part)? Is there
>>> some timeout even when running on your local machine? Or some resource
>>> limitations that just quit Sage if its using too much memory orso?
>>>
>>> I really hope that someone has an idea here, because each of these
>>> computations takes around 2 hours, so its very impracticle to just keep
>>> trying to see what works.
>>
>>
>> What is your OS and where can you check for out of memory messages?
>>
>> Regards,
>> Jan
>>
>>
>> --
>>   .~.
>>   /V\ Jan Groenewald
>>  /( )\www.aims.ac.za
>>  ^^-^^
>
> --
> 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.


Re: [sage-support] Re: accumulating many defunct child processes

2017-06-05 Thread John Cremona
On 5 June 2017 at 20:04, John Cremona <john.crem...@gmail.com> wrote:
> Thanks for the suggestions.  I was implementing something like Dima's
> suggestion and noticed that the function has 3 different return
> statements, one of which is not normal (some runtime error in Magma)
> but two are normal and only one of those had the mag.quit() in it.
> However I don't think that this was the cause of the problem since I
> did not see any idle Magma processes lying about, and also I know from
> my output that the rogue return route was not used (I am looking for
> elliptic curves and these runs had 100% success).
>
> So I just started a run with all calls to the function using the same
> Magma() instance, and after a few minutes when the function had been
> called about 50 times there were already hundreds of these python
> processes, all clocking between 0 and 4s and asleep.  Bizarre.

Correction -- with the new version in which I only start up one Magma
process and pass it down to the function so that each call uses the
same one, all is well.

So there is a bug -- this is a workaround.

> Perhaps I'll try the @fork route.
>
> John
>
> On 5 June 2017 at 19:24, William Stein <wst...@gmail.com> wrote:
>> On Mon, Jun 5, 2017 at 11:21 AM, Dima Pasechnik <dimp...@gmail.com> wrote:
>>> I guess these zombie processes come from the function quitting Magma,
>>> something that does not destroy a Python child process used to communicate
>>> with it.
>>>
>>> Why won't you create a Magma instance just once, and do a cleanup after your
>>> function is done?
>>> (IIRC, Magma does not have a "reset" facility, but you can still "delete"
>>> variables.) (Well, this would be tedious,
>>> perhaps these deletes are called by Sage interface?)
>>
>> Another hack/workaround *might* be to use Sage's @fork or @parallel
>> decorators...
>>
>>>
>>> On the other hand, there is also stuff in sage.interfaces.quit.* you can
>>> probably use to clean up,
>>> as well as sage.interfaces.cleaner.* - which is even less documented, and
>>> it's hard to say exactly what to do
>>> with is. A documentation bug?
>>>
>>>
>>>
>>>
>>> On Monday, June 5, 2017 at 2:44:32 PM UTC+1, John Cremona wrote:
>>>>
>>>> On a linux (ubuntu 16.04) machine I am running one instance of Sage
>>>> version 7.6.  In a loop I am calling a function of my own which
>>>> interfaces to Magma; that function starts with
>>>>
>>>>  mag = Magma()
>>>>
>>>> then there are a whole lot of mag.eval() statements and af ew others
>>>> with which I collect the content of Magma variable back into Sage, and
>>>> the last line before the function returns is
>>>>
>>>>  mag.quit()
>>>>
>>>> Once this has been running for a while, I have --as expected-- exactly
>>>> one magma process running.  But there are many defunct python
>>>> processes (right now, 1375 lines like
>>>> jec  59385  0.0  0.0  0 0 pts/11   Z+   12:30   0:00
>>>> [python] 
>>>> in the output of ps -ux | grep python) whose times stamps show that
>>>> many per second were created.  These are all child processes of the
>>>> controlling Sage process.  They seem harmless since they are not using
>>>> any resources, but I had 5 such Sage sessions running overnight and
>>>> this morning could not log into the machine for a while and I suspect
>>>> (without proof) that some maximum number of processes was exceeded --
>>>> when I did log in, I saw that all 5 of the Sage processes had been
>>>> killed and showed an error message about not being able to fork().
>>>> The computer has 512g of RAM and 72 cores, and was not heavily loaded.
>>>>
>>>> Help please!
>>>>
>>>> I am attaching the function in question in case that helps.
>>>>
>>>> John
>>>
>>> --
>>> 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.
>>
>>
>>
>> --
>> William (http://ws

Re: [sage-support] Re: accumulating many defunct child processes

2017-06-05 Thread John Cremona
Thanks for the suggestions.  I was implementing something like Dima's
suggestion and noticed that the function has 3 different return
statements, one of which is not normal (some runtime error in Magma)
but two are normal and only one of those had the mag.quit() in it.
However I don't think that this was the cause of the problem since I
did not see any idle Magma processes lying about, and also I know from
my output that the rogue return route was not used (I am looking for
elliptic curves and these runs had 100% success).

So I just started a run with all calls to the function using the same
Magma() instance, and after a few minutes when the function had been
called about 50 times there were already hundreds of these python
processes, all clocking between 0 and 4s and asleep.  Bizarre.
Perhaps I'll try the @fork route.

John

On 5 June 2017 at 19:24, William Stein <wst...@gmail.com> wrote:
> On Mon, Jun 5, 2017 at 11:21 AM, Dima Pasechnik <dimp...@gmail.com> wrote:
>> I guess these zombie processes come from the function quitting Magma,
>> something that does not destroy a Python child process used to communicate
>> with it.
>>
>> Why won't you create a Magma instance just once, and do a cleanup after your
>> function is done?
>> (IIRC, Magma does not have a "reset" facility, but you can still "delete"
>> variables.) (Well, this would be tedious,
>> perhaps these deletes are called by Sage interface?)
>
> Another hack/workaround *might* be to use Sage's @fork or @parallel
> decorators...
>
>>
>> On the other hand, there is also stuff in sage.interfaces.quit.* you can
>> probably use to clean up,
>> as well as sage.interfaces.cleaner.* - which is even less documented, and
>> it's hard to say exactly what to do
>> with is. A documentation bug?
>>
>>
>>
>>
>> On Monday, June 5, 2017 at 2:44:32 PM UTC+1, John Cremona wrote:
>>>
>>> On a linux (ubuntu 16.04) machine I am running one instance of Sage
>>> version 7.6.  In a loop I am calling a function of my own which
>>> interfaces to Magma; that function starts with
>>>
>>>  mag = Magma()
>>>
>>> then there are a whole lot of mag.eval() statements and af ew others
>>> with which I collect the content of Magma variable back into Sage, and
>>> the last line before the function returns is
>>>
>>>  mag.quit()
>>>
>>> Once this has been running for a while, I have --as expected-- exactly
>>> one magma process running.  But there are many defunct python
>>> processes (right now, 1375 lines like
>>> jec  59385  0.0  0.0  0 0 pts/11   Z+   12:30   0:00
>>> [python] 
>>> in the output of ps -ux | grep python) whose times stamps show that
>>> many per second were created.  These are all child processes of the
>>> controlling Sage process.  They seem harmless since they are not using
>>> any resources, but I had 5 such Sage sessions running overnight and
>>> this morning could not log into the machine for a while and I suspect
>>> (without proof) that some maximum number of processes was exceeded --
>>> when I did log in, I saw that all 5 of the Sage processes had been
>>> killed and showed an error message about not being able to fork().
>>> The computer has 512g of RAM and 72 cores, and was not heavily loaded.
>>>
>>> Help please!
>>>
>>> I am attaching the function in question in case that helps.
>>>
>>> John
>>
>> --
>> 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.
>
>
>
> --
> William (http://wstein.org)
>
> --
> 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.


[sage-support] accumulating many defunct child processes

2017-06-05 Thread John Cremona
On a linux (ubuntu 16.04) machine I am running one instance of Sage
version 7.6.  In a loop I am calling a function of my own which
interfaces to Magma; that function starts with

 mag = Magma()

then there are a whole lot of mag.eval() statements and af ew others
with which I collect the content of Magma variable back into Sage, and
the last line before the function returns is

 mag.quit()

Once this has been running for a while, I have --as expected-- exactly
one magma process running.  But there are many defunct python
processes (right now, 1375 lines like
jec  59385  0.0  0.0  0 0 pts/11   Z+   12:30   0:00
[python] 
in the output of ps -ux | grep python) whose times stamps show that
many per second were created.  These are all child processes of the
controlling Sage process.  They seem harmless since they are not using
any resources, but I had 5 such Sage sessions running overnight and
this morning could not log into the machine for a while and I suspect
(without proof) that some maximum number of processes was exceeded --
when I did log in, I saw that all 5 of the Sage processes had been
killed and showed an error message about not being able to fork().
The computer has 512g of RAM and 72 cores, and was not heavily loaded.

Help please!

I am attaching the function in question in case that helps.

John

-- 
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.


l.sage
Description: Binary data


Re: [sage-support] EllipticCurve gens()/gens_certain() caching problem

2017-05-24 Thread John Cremona
Thanks for the report.  There are two things here:

1. confusing (or incorrect) caching.  Clearly Sage should not blindly
cache returned gens when the descent was unsuccessful (or not proved
to be successful).  I think the idea is, though, that if the descent
found some "generators" (independent points of infinite order) then
that information, and the points, are worth keeping, even if it has
not been proved that these points are a complete set of generators
(generating E(Q) up to finite index, or up to torsion).

In your example with the two repeated calls with proof=False, in the
second case you are in effect asking "give me the gens you have cached
tagged with the False flag if possible, otherwise do this computation
and cache the results with the flag set to False".  That explains the
behaviour.

The logic of the caching code does try to handle this, by using the
proof parameter (which is None by default).  There are (up to) two
different cached lists of points, one from a proof=True computation
and one from a proof=False.  If you look at the first few lines of
code with E.gens?? you will see this.

An improvement to this may be possible.  The underlying function which
does the work is E._compute_gens() which return points and also
True/False to indicate the status of these.  Since computing the
actual generators involves calling code with a large number of
parameters, it is natural for a user to make repeated calls with
increased values of these (at least, the search bound parameters as in
your example) each time, but for this to work as you expect would
require a much more complicated set of caching keys together with code
to work out whether a new set of parameters was weaker or stronger
than any which have been run before.  You are welcome to help
implement such a thing!


2. Disabling the cache is not possible without changing the code, but
you can rest it manually for each curve by
E._set_gens([])
and you can see what the cache holds with
E._EllipticCurve_rational_field__gens
(note that these methods start with an underscore to indicate that
they are internal and not normally intended for use by users).

John Cremona

On 24 May 2017 at 00:29, Lee Morgenstern <lmorgenste...@roadrunner.com> wrote:
> How do I disable caching for elliptic curve gens() results?
>
> The cache doesn't store (or check) enough information
> to return the correct results.
> A cache search slows everything down when computing
> many different elliptic curves within a programmed loop.
>
> Example:
>
> E = EllipticCurve([-157*157,0])
> G = E.gens(descent_second_limit = 13, proof=False)
> print len(G), E.gens_certain()
>
> The above takes about 15 seconds to correctly output:
>   1 True
>
> But compare that to the following
> (after reloading the kernel which clears the cache):
>
> E = EllipticCurve([-157*157,0])
> G = E.gens(descent_second_limit = 10, proof=False)
> print len(G), E.gens_certain()
> H = E.gens(descent_second_limit = 13, proof=False)
> print len(H), E.gens_certain()
>
> The above takes less than a second to correctly output
>   0 False
> and then INSTANTLY outputs the incorrect
>   0 False
> because it uses an incorrectly cached result.
>
> The descent_second_limit value either wasn't cached
> or is ignored for a matching cached gens() call.
> The second gens() call shouldn't be matching any
> previous result and still take 15 seconds to compute
> and then output: 1 True.
>
> The gens() option "use_database=False" has no effect
> on this caching operation.
>
> The only way I can clear the cache seems to be
> to reload the kernel, but I can't do that within a program.
>
> It would be nice if I could completely disable caching
> so that when my program computes many different
> elliptic curves in a loop, it wouldn't take longer
> and longer to run because sage has to search
> for previously matching cached entries which
> I know aren't there.  And I think that when there
> are too many cached elliptic curves, it stores
> them on disk, which takes a thousand times
> longer to search.
>
> Running jupyter, sage-7.6.ova, VirtualBox, Windows 10.
>
> Lee
>
> --
> 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.


Re: [sage-support] Discrete Logarithm

2017-05-11 Thread John Cremona
On 11 May 2017 at 08:16, Vincent Delecroix <20100.delecr...@gmail.com> wrote:
> Hi,
>
> "primitive element" is meant as "generator for the multiplicative group
> GF(p)^*" and not the additive group GF(p). The OP question is about the
> former and Johan answer is about the latter.

Not really: generators of the additive group are coprime to p, not to p-1.

Perhaps Johan was thinking of the fact that if g is one multiplicative
generator (aka primitive root) then g^k is another if and only if
gcd(k,p-1)=1.

John Cremona

>
> For very large p such as what you asked for is likely to be delicate (but I
> am not a specialist).
>
> Vincent
>
>
> On 11/05/2017 08:45, Johan S. H. Rosenkilde wrote:
>>
>> Hi Panos
>>
>> In GF(p) then an element g is primitive if its embedding into ZZ is
>> coprime with p-1. Since Euclidean algorithm is so fast, you can test
>> this:
>>
>> sage: p = Primes().next(2^2048) #long
>> sage: g1 = 3
>> sage: gcd(g1, p-1)
>> 3
>> sage: g2 = 5
>> sage: gcd(g2, p-1)
>> 1
>>
>> So 3 is not a primitive element in GF(p) but 5 is. (Since 5 is also a
>> prime, you could also have done g2.divides(p-1) instead)
>>
>> Best,
>> Johan
>>
>>
>> Panos Phronimos writes:
>>
>>> Hello everyone,
>>>
>>> I am trying to calculate a primitive element (g) of a big Finite Field:
>>> GF(p) where p is prime number > 2^2048
>>>
>>> So then, i could share a secret integer (r) as: m=g^r, but it seems
>>> impossible to calculate it with function primitive_element()
>>> Is there another way i can use to calculate it?
>>>
>>> Thanks in advance,
>>> Panos
>>
>>
>
> --
> 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.


Re: [sage-support] Re: Use of \Bold in latex methods, and SageTeX

2017-05-08 Thread John Cremona
Thanks John.

On 8 May 2017 at 20:45, John H Palmieri <jhpalmier...@gmail.com> wrote:
> Hi John,
>
> Within Sage, you can get the appropriate command with
>
>
> sage: from sage.misc.latex_macros import sage_configurable_latex_macros
> sage: sage_configurable_latex_macros
> ['\\newcommand{\\Bold}[1]{\\mathbf{#1}}']
> sage: print(sage_configurable_latex_macros[0])
> \newcommand{\Bold}[1]{\mathbf{#1}}
>
>
> I'm not sure how SageTeX is supposed to handle this, and I'm surprised that
> it hasn't come up before. The use of \Bold{...} in Sage dates back to 2009:
> see sage/misc/latex_macros.py.

I am also surprised since I have used SageTeX before without this
problem!  In fact I was running it on a tex file which used to work.
On a different computer though...

John

>
> --
> John
>
>
> On Monday, May 8, 2017 at 12:25:12 PM UTC-7, John Cremona wrote:
>>
>> In Sage 7.6:
>>
>> sage: latex(QQ)
>> \Bold{Q}
>>
>> but \Bold is not a standard LaTeX macro. However,
>>
>> sage: show(QQ)
>> \newcommand{\Bold}[1]{\mathbf{#1}}\Bold{Q}
>>
>> shows that the macro is defined somewhere in Sage itself.
>>
>> Next, if I create a file mini.tex containing
>>
>> \documentclass{article}
>> \usepackage{sagetex}
>> \begin{document}
>> \title{A Sage\TeX\ document}
>> The rational field is \sage{QQ}.
>> \end{document}
>>
>> and run
>>
>> pdflatex mini
>> sage mini.sagetex.sage
>> pdflatex mini
>>
>> then the second time pdflatex runs there's an error when it encounters
>> the undefined \Bold macro.  This can be fixed by adding the line
>> \newcommand{\Bold}[1]{\mathbf{#1}}
>> into the preamble, but surely this should not be necessary, and there
>> might be more "missing" macros.
>>
>> I checked that the version of sagetex.sty being used is exactly the
>> one in the Sage version I was running.
>>
>> John
>
> --
> 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.


[sage-support] Use of \Bold in latex methods, and SageTeX

2017-05-08 Thread John Cremona
In Sage 7.6:

sage: latex(QQ)
\Bold{Q}

but \Bold is not a standard LaTeX macro. However,

sage: show(QQ)
\newcommand{\Bold}[1]{\mathbf{#1}}\Bold{Q}

shows that the macro is defined somewhere in Sage itself.

Next, if I create a file mini.tex containing

\documentclass{article}
\usepackage{sagetex}
\begin{document}
\title{A Sage\TeX\ document}
The rational field is \sage{QQ}.
\end{document}

and run

pdflatex mini
sage mini.sagetex.sage
pdflatex mini

then the second time pdflatex runs there's an error when it encounters
the undefined \Bold macro.  This can be fixed by adding the line
\newcommand{\Bold}[1]{\mathbf{#1}}
into the preamble, but surely this should not be necessary, and there
might be more "missing" macros.

I checked that the version of sagetex.sty being used is exactly the
one in the Sage version I was running.

John

-- 
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.


Re: [sage-support] Re: Computing discrete logs in polynomial rings modulo another polynomial over non-prime-power

2017-04-09 Thread John Cremona
On 9 April 2017 at 15:20, Simon King  wrote:
> Hi Bill,
>
> On 2017-04-08, 'Bill Cox' via sage-support  
> wrote:
>> I want to test finding the discrete log in the circle group over Z/Zm --
>> discrete logs of g^a mod m, where g is a complex number and m is composite.
>>  Can Sage do this for large composite m, say on the order of 2^128 or more,
>> when m is smooth, containing no prime factors larger than say 1 billion?
>>
>> I can get the discrete log in the circle group for prime powers like this:
>>
>> sage: F. = FiniteField(23^2, modulus=x^2 + 1)
>> sage: F. = FiniteField(23^2, modulus=x^2 + 1)
>> sage: aliceSecret = (1 + a)^13
>> sage: sage: aliceSecret.log(1 + a)
>> 13
>
> Maybe I misunderstand your problem, but can't you simply do exactly the same
> thing with a quotient ring instead of a finite field?
>
>sage: m = 120011^2*12000239*5150237*7200233^2
>sage: m
>46147940098802341021228029866464641067
>sage: R = Integers(m)
>sage: aliceSecret = R(2)^13
>sage: aliceSecret.log(2)
>13
>sage: aliceSecret = R(19)^11231
>sage: aliceSecret.log(19)
>11231
>
> Best regards,
> Simon

Simon is right  Note that you can see what method is used via
aliceSecret?? which says

"If the modulus is prime and b is a generator, this calls Pari's ``znlog``
   function, which is rather fast. If not, it falls back on the generic
   discrete log implementation in
:meth:`sage.groups.generic.discrete_log`."

so you should not expect this to be fast, and maybe not even possible,
for large m.




>
> --
> 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.


Re: [sage-support] Incorrect output of a sum

2017-03-31 Thread John Cremona
It works fine if you insert * between the parentheses -- no implicit
multiplication:

sage: gamma3(a,b,c,j) =
1/((e^(2*pi*i*(a*j/16))-1)*(e^(2*pi*i*(b*j/16))-1)*(e^(2*pi*i*(c*j/16))-1))
sage: sum(gamma3(1,2,9,j) for j in [1..7]).n()
3.00 - 0.249*I


On 31 March 2017 at 19:17, saad khalid  wrote:
> Not what sure the issue is, but I couldn't find any typos in what I was
> doing. I define a function:
>
> gamma3(a,b,c,j) =
> 1/((e^(2*pi*i*(a*j/16))-1)(e^(2*pi*i*(b*j/16))-1)(e^(2*pi*i*(c*j/16))-1))
>
> Then I do the sum:
>
> sum(gamma3(1,2,9,j) for j in [1..7]).n()
>
> and this gives me
> 1.98224774759702 + 4.04301409838109*I
>
> This isn't right. I copy almost exactly the same code into wolframalpha
> sum for j from 1 to 7 of
> 1/((e^(2*pi*i*(1*j/16))-1)(e^(2*pi*i*(2*j/16))-1)(e^(2*pi*i*(9*j/16))-1))
> and get
> 3 - .25i
>
>
> What am I doing wrong here? Thanks!
>
>
> --
> 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.


Re: [sage-support] Using Galois fields for less than 2^16, crashes and restarts Kernel

2017-03-14 Thread John Cremona
You should not need to import anything.  For example

sage: F = GF(2^3)
sage: type(F)

sage: F = GF(2^4)
sage: type(F)

sage: F = GF(2^16)
sage: type(F)


Note that the type will depend on the cardinality since Sage uses
different backend implementations.  Unless you have very some very
unusual requirements I would use whichever implementation Sage choses
for you, but the GF() constructor does allow some choice via using the
impl parameter.  However Givaro is limited to <2^16:

sage: F = GF(2^15, impl='givaro')
sage: type(F)

sage: F = GF(2^16, impl='givaro')
...
ValueError: q must be < 2^16


On 14 March 2017 at 12:55,   wrote:
> Using a VM version on windows sage 7.4
> I import sage.rings.finite_rings.finite_field_givaro
> following this page
> http://doc.sagemath.org/html/en/reference/finite_rings/sage/rings/finite_rings/finite_field_givaro.html
>
> once I declare the field
> FiniteField_givaro(9, 'a') which is exactly as the example shown in the link
> it crashes and restarts kernel
>
> I tried GF(2^16) after importing its module it was working fine with me
> I actually wanna work with Fields of Characteristic 2
> like 2^3 and 2^4
> none of them works
>
> anybody, Help me Please
>
> --
> 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.


Re: [sage-support] Error during Laplace transform of exp(i*x)

2017-03-06 Thread John Cremona
Your question is puzzling since i is a constant, and 1/(s-i) =
(s+i)/(s^2+1) so the expressions are equal.

John Cremona

On 6 Mar 2017 17:35, "Hemanth G" <ghem...@gmail.com> wrote:

> Dear All,
>
> How do you make SageMath to consider the term "i" as a complex term.Here
> the SageMath is considering "i" as a constant.This question is
> in wake of problem faced in getting Laplace transform of exp(i*x). The
> answer should be [s/(s^2+1)] +i* [1/(s^2+1)] whereas I am getting
> 1/(s-I). The answer should be [s/(s^2+1)] +i* [1/(s^2+1)]  since this
> infers to cos(x)+i*sin(x) when we take the inverse Laplace transform.
> Please refer the codes below.
>
> ##codes used in SageMath
> var('s,x')
> i=sqrt(-1)
> f=exp(i*x)
> f.laplace()
> ## Answer from this code is 1/(s-I)
> ##Required answer is [s/(s^2+1)] +i*[1/(s^2+1)]
>
> Could anyone help me in this matter.Thank you.
>
> With Best Regards/ Mit Besten Grüßen / Sincères Salutations
> Hemanth Gaekwad
>
>
>
>
> --
> 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.


Re: [sage-support] Silly Cython question

2017-02-22 Thread John Cremona
On 21 February 2017 at 22:02, Watson Ladd  wrote:
>
>
> On Tuesday, February 21, 2017 at 1:07:43 PM UTC-8, Jeroen Demeyer wrote:
>>
>> On 2017-02-21 22:02, Watson Ladd wrote:
>> > I am having trouble figuring out which imports I need to get the
>> > right names to appear
>>
>> Use the import_statements() function to determine which import
>> statements you need. There shouldn't be a difference between Python and
>> Cython regarding import statements.

After newarly 10 years of work on Sage I did not know of
import_statements()!  Just yesterday I was doing things like
search_src("import", "primes") when I could have just done
import_staements(primes).

Thanks, Jeroen.



>
>
> Thank you! That solved the problem.
>
> --
> 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.


Re: [sage-support] Re: Lattice reduction over polynomial lattice

2017-02-21 Thread John Cremona
On 21 February 2017 at 08:38, 'Martin R. Albrecht' via sage-support
 wrote:
> Hi,
>
> I don’t think this is implemented in Sage.

I think it is: searching for weak_popov_form finds results in
matrix/matrix2.pyx with a method M.weak_popov_form(), though
admittedly the docstring for that says

".. WARNING:: This function currently does **not** compute the weak
Popov form of a matrix, but rather a row reduced form (which is a
slightly weaker requirement). See :meth:`row_reduced_form`."

John

>
> Cheers,
> Martin
>
> Santanu Sarkar writes:
>>
>> Dear all,
>>   I am searching lattice reduction for polynomial matrices in   Sage.
>> Kindly help me.
>>
>> T. Mulders and A. Storjohann. On lattice reduction for polynomial
>> matrices.
>> Journal of Symbolic Computation, 35(4):377 – 401, 2003
>>
>>
>>
>> On 20 February 2017 at 21:19, Santanu Sarkar
>> 
>> wrote:
>>
>>> Dear all,
>>>I have polynomial lattice over a finite field. So eachcomponent of
>>> the
>>> vectors v_1, v_2, v_3 are polynomials over a finite field say F_11. Hence
>>> v_1=(f_1(x), f_2(x), f_3(x)),  v_2=(g_1(x), g_2(x), g_3(x)) and
>>> v_3=(h_1(x), h_2(x), h_3(x)). Here norm is the maximum degree of each
>>>  component. Does there exist LLL algorithm for this lattice in  Sage?
>>>
>>>
>>>
>
>
> --
>
> _pgp: https://keybase.io/martinralbrecht
> _www: https://martinralbrecht.wordpress.com
> _jab: martinralbre...@jabber.ccc.de
> _otr: 47F43D1A 5D68C36F 468BAEBA 640E8856 D7951CCF
>
>
> --
> 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.


Re: [sage-support] v3 (3d vector gives an error)

2017-02-06 Thread John Cremona
Not every object in Sage has a plot() method.  As the error message
says, integers do not have a plot() method.  Can you think of a
sensible way of plotting a single integer?  Perhaps there is, but
no-one has thought of it yet.

On 6 February 2017 at 07:10, Henri Girard <henri.gir...@gmail.com> wrote:
> Yes, I didn't know exactly the name, but thinking about it I came to the
> same conclusion, thank. But my concern is why doesn't it display and gives
> an error ?
>
>
>
> Le 06/02/2017 à 03:03, Jorge Garcia a écrit :
>
> V3 is a scalar = -60...
>
> On Feb 5, 2017 5:38 PM, "Henri Girard" <henri.gir...@gmail.com> wrote:
>>
>> Thanks
>>
>>
>> Le 05/02/2017 à 23:32, John Cremona a écrit :
>>
>> V3 is not a vector!
>>
>> On 5 Feb 2017 21:42, "Henri Girard" <henri.gir...@gmail.com> wrote:
>>>
>>> The third vector is an error, is it a bug ?
>>>
>>> v1=vector([3,4,-6])
>>> v2=vector([-4,3,10])
>>> v3=v1.dot_product(v2)
>>> p1=v1.plot(color='red')
>>> p2=v2.plot(color='green')
>>> p3=v3.plot()
>>>
>>>
>>> ---
>>> AttributeErrorTraceback (most recent call
>>> last)
>>>  in ()
>>>   4 p1=v1.plot(color='red')
>>>   5 p2=v2.plot(color='green')
>>> > 6 p3=v3.plot()
>>>
>>> /home/pi/git/sage/src/sage/structure/element.pyx in
>>> sage.structure.element.Element.__getattr__
>>> (/home/pi/git/sage/src/build/cythonized/sage/structure/element.c:4254)()
>>> 457 AttributeError:
>>> 'LeftZeroSemigroup_with_category.element_class' object has no attribute
>>> 'blah_blah'
>>> 458 """
>>> --> 459 return self.getattr_from_category(name)
>>> 460
>>> 461 cdef getattr_from_category(self, name):
>>>
>>> /home/pi/git/sage/src/sage/structure/element.pyx in
>>> sage.structure.element.Element.getattr_from_category
>>> (/home/pi/git/sage/src/build/cythonized/sage/structure/element.c:4363)()
>>> 470 else:
>>> 471 cls = P._abstract_element_class
>>> --> 472 return getattr_from_other_class(self, cls, name)
>>> 473
>>> 474 def __dir__(self):
>>>
>>> /home/pi/git/sage/src/sage/structure/misc.pyx in
>>> sage.structure.misc.getattr_from_other_class
>>> (/home/pi/git/sage/src/build/cythonized/sage/structure/misc.c:1928)()
>>> 298 dummy_error_message.cls = type(self)
>>> 299 dummy_error_message.name = name
>>> --> 300 raise dummy_attribute_error
>>> 301 attribute = attr
>>> 302 # Check for a descriptor (__get__ in Python)
>>>
>>> AttributeError: 'sage.rings.integer.Integer' object has no attribute
>>> 'plot'
>>>
>>> -- 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.
>>
>> -- 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 

Re: [sage-support] v3 (3d vector gives an error)

2017-02-05 Thread John Cremona
V3 is not a vector!

On 5 Feb 2017 21:42, "Henri Girard"  wrote:

> The third vector is an error, is it a bug ?
>
> v1=vector([3,4,-6])
> v2=vector([-4,3,10])
> v3=v1.dot_product(v2)
> p1=v1.plot(color='red')
> p2=v2.plot(color='green')
> p3=v3.plot()
>
> ---AttributeError
> Traceback (most recent call 
> last) in ()  4 
> p1=v1.plot(color='red')  5 p2=v2.plot(color='green')> 6 p3=v3.plot()
> /home/pi/git/sage/src/sage/structure/element.pyx in 
> sage.structure.element.Element.__getattr__ 
> (/home/pi/git/sage/src/build/cythonized/sage/structure/element.c:4254)()
> 457 AttributeError: 
> 'LeftZeroSemigroup_with_category.element_class' object has no attribute 
> 'blah_blah'458 """--> 459 return 
> self.getattr_from_category(name)460 461 cdef 
> getattr_from_category(self, name):
> /home/pi/git/sage/src/sage/structure/element.pyx in 
> sage.structure.element.Element.getattr_from_category 
> (/home/pi/git/sage/src/build/cythonized/sage/structure/element.c:4363)()
> 470 else:471 cls = P._abstract_element_class--> 472   
>   return getattr_from_other_class(self, cls, name)473 474 def 
> __dir__(self):
> /home/pi/git/sage/src/sage/structure/misc.pyx in 
> sage.structure.misc.getattr_from_other_class 
> (/home/pi/git/sage/src/build/cythonized/sage/structure/misc.c:1928)()298  
>dummy_error_message.cls = type(self)299 
> dummy_error_message.name = name--> 300 raise dummy_attribute_error
> 301 attribute = attr302 # Check for a descriptor (__get__ 
> in Python)
> AttributeError: 'sage.rings.integer.Integer' object has no attribute 'plot'
>
>
> --
> 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.


Re: [sage-support] Re: How to resume working in SAGE after 10 years?

2017-01-13 Thread John Cremona
Go to https://cloud.sagemath.com/ and make yourself a free account.
You can upload .sws files, but yours are very old so may not convert
cleanly.  SageMathCloud has its own mailing list.

People may have been put off by the date 2005 since I think Sage was
only created around then.  Version 4.8 is certainly old (7.5 has just
been released)!

John Cremona

On 13 January 2017 at 15:17, Charles Pique <wvphysic...@gmail.com> wrote:
> The online site where I worked with SAGE (sagenb.org) was taken down because
> of spammers according to
> https://ask.sagemath.org/question/36274/what-happened-to-my-user-name-10-years-ago/.
> I had noticed some restrictions and comments about it back then.  I went my
> way for some years and now a number of my bookmarks get an error.  I erased
> them yesterday but they all contain "sagenb.org".  I have seen websites
> disappear before so I copied all my files to my hard drive.  They had the
> extension .sws.  I also got a large file with the name SAGE-4.8.ova which
> might be a software package. I still have my old user name and password but
> nowhere to try them.  I think I have a new password with same old name at
> https://ask.sagemath.org/account/signin/?next=/  but that gets a blog.  I
> don't know how to get the interactive web page that does all the nice things
> that I used to play with. I never could find instructions for basic things.
> I never heard of the Sage store before.
> Today I have a need to solve cubic equations as part of a root locus plot in
> electronic circuit analysis.
>
> On Friday, January 13, 2017 at 4:30:15 AM UTC-5, Charles Pique wrote:
>>
>> I used Sage sometime around 2005 +/-5 and had a user name and password.
>> Now my login doesn't work and I can't even register.
>> I had a bunch of work saved on the site and I downloaded it too in case
>> the site lost it.   Years ago the stuff could have been uploaded and
>> restored.  I don't know if the format is the same after all this time.  Back
>> then I could not find basic help that I needed.   It appears to be better
>> today.   Is there a registration page?
>
> --
> 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.


Re: [sage-support] Re: splitting field vs. Galois closure

2017-01-06 Thread John Cremona
On 5 January 2017 at 20:01, Nils Bruin <nbr...@sfu.ca> wrote:
> On Thursday, January 5, 2017 at 11:27:05 AM UTC-8, John Cremona wrote:
>>
>> > I'm tempted to say: beware of memory leaks. Caching an extension on the
>> > base
>> > field would probably imply that both fields are now participating in a
>> > reference cycle, anchored in the global UniqueRepresentation cache, so
>> > they
>> > would be uncollectable by the GC.
>>
>> I see.  But in a situation where I was processing 500 elliptic curves
>> each defined over a quintic field whose galois closure took 15 minutes
>> to compute, I think you can understand why I added the cache decorator
>> in my local development branch!
>
>
> Yes, of course. For your purposes the field is basically globally defined
> anyway, so you don't mind it it's immortal. If you'd be working with 500
> elliptic curves defined over *different* quintic number fields, you'd feel
> differently.

In fact I have 6000 curves defined over a total of 34 quintic fields...

>
>>
>> It is not so bad now I am using
>> splitting field.  By the way, this is at line 885 of
>>
>> https://github.com/sagemath/sage/blob/develop/src/sage/schemes/elliptic_curves/gal_reps_number_field.py,
>> where replacing
>>
>> Kgal = K.galois_closure('b')
>>
>> by
>>
>> Kgal = K.defining_polynomial().splitting_field('b')
>>
>> had a rather dranmatic effect!
>>
>
> Funnily enough, if you'd use a (weak) caching function GaloisClosure(K,'b')
> for this instead, you'd be fine. Of course, if you use a weakvalue cache,
> you'd run the risk that the closure gets garbage collected if you don't hold
> a reference and a weakkey cache wouldn't help, because the closure would
> keep K alive anyway.
>
> As often happens in these cases, if we want limited lifetime cached
> information, it's up to you to keep a reference to keep the cache alive. And
> if you have the reference anyway, why do you need to store it in a cache?
> I'm not sure if there is a fits-all solution to these issues, but while the
> "@cached_function" or "@cached_method" decorators are convenient ways to get
> caching, it's often too crude to be suitable for inclusion in a
> general-purpose distribution, where the same routines might end up in
> tight-ish  loops that could fill the memory with cached info. Caching is
> hard ...

Nils, this technical talk about caching should probably move to
sage-devel.  So while I have a couple of other ideas about that I'll
not add them to his threa.d


>
> --
> 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.


Re: [sage-support] Re: splitting field vs. Galois closure

2017-01-05 Thread John Cremona
On 5 January 2017 at 18:15, Nils Bruin <nbr...@sfu.ca> wrote:
> On Thursday, January 5, 2017 at 2:27:06 AM UTC-8, John Cremona wrote:
>>
>> I have a degree 5 polynomial whose Galois group is large (S_5):
>>
>> sage: x = polygen(QQ)
>> sage: f = x^5 - 6*x^3 - x^2 + 6*x - 1
>>
>> I can compute its splitting field easily, thanks to code written by
>> Jeroen Demeyer I believe:
>>
>> sage: %time L = f.splitting_field(names='b')
>> CPU times: user 1min 1s, sys: 272 ms, total: 1min 2s
>> Wall time: 1min 2s
>>
>> Note that the result is a number field of degree 120.  However, if I
>> form the degree 5 field by adjoining one root of f first, and then ask
>> for its Galois closure, it takes very much longer:
>>
>> sage: K. = NumberField(f)
>> sage: %time L = K.galois_closure(names='b')
>> CPU times: user 15min 24s, sys: 36 ms, total: 15min 24s
>> Wall time: 15min 25s
>>
>> Any idea why?  Essentailly the only difference I can see is that in
>> the second case the polynomial f is first base-changed to K and then
>> the method splitting_field is applied to that, but it is not clear to
>> me why that should be slower since I think the first step of computing
>> f.splitting_field() would do just that anyway?
>
>
> I haven't looked at the code but that's certainly not the only way to arrive
> at the galois closure. Some smart resolvent manipulations could give you (a
> multiple of) the minimal polynomial of a generator of the galois closure.
> You would never be factoring polynomials that are explicitly given over a
> proper extension. I don't know if that would be faster, but polynomial
> aritmetic over ZZ and QQ is so much more optimized than over number fields,
> it wouldn't surprise me if there is a good range where it is.

I was basing my remarks on what I remembered from having reviewed
Jeroen Demeyer's code for splitting fields.  And hoping he might have
something to say!

>
>>
>> It would be very convenient for me to gain this speedup, by changing
>> the method galois_closure() if necessary.  I already plan to make the
>> latter a @cached_method.
>
>
> I'm tempted to say: beware of memory leaks. Caching an extension on the base
> field would probably imply that both fields are now participating in a
> reference cycle, anchored in the global UniqueRepresentation cache, so they
> would be uncollectable by the GC.

I see.  But in a situation where I was processing 500 elliptic curves
each defined over a quintic field whose galois closure took 15 minutes
to compute, I think you can understand why I added the cache decorator
in my local development branch!  It is not so bad now I am using
splitting field.  By the way, this is at line 885 of
https://github.com/sagemath/sage/blob/develop/src/sage/schemes/elliptic_curves/gal_reps_number_field.py,
where replacing

Kgal = K.galois_closure('b')

by

Kgal = K.defining_polynomial().splitting_field('b')

had a rather dranmatic effect!


>
> --
> 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.


[sage-support] splitting field vs. Galois closure

2017-01-05 Thread John Cremona
I have a degree 5 polynomial whose Galois group is large (S_5):

sage: x = polygen(QQ)
sage: f = x^5 - 6*x^3 - x^2 + 6*x - 1

I can compute its splitting field easily, thanks to code written by
Jeroen Demeyer I believe:

sage: %time L = f.splitting_field(names='b')
CPU times: user 1min 1s, sys: 272 ms, total: 1min 2s
Wall time: 1min 2s

Note that the result is a number field of degree 120.  However, if I
form the degree 5 field by adjoining one root of f first, and then ask
for its Galois closure, it takes very much longer:

sage: K. = NumberField(f)
sage: %time L = K.galois_closure(names='b')
CPU times: user 15min 24s, sys: 36 ms, total: 15min 24s
Wall time: 15min 25s

Any idea why?  Essentailly the only difference I can see is that in
the second case the polynomial f is first base-changed to K and then
the method splitting_field is applied to that, but it is not clear to
me why that should be slower since I think the first step of computing
f.splitting_field() would do just that anyway?

It would be very convenient for me to gain this speedup, by changing
the method galois_closure() if necessary.  I already plan to make the
latter a @cached_method.

John

-- 
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.


  1   2   3   4   5   6   7   >