Re: [sage-support] Re: Sagemanifolds: object has no attribute 'exterior_der'

2024-02-07 Thread G. M.-S.
Just to say that
https://ask.sagemath.org
gives me
502 Bad Gateway

Guillermo

On Wed, 7 Feb 2024 at 19:35, Eric Gourgoulhon 
wrote:

> Le mercredi 7 février 2024 à 15:46:05 UTC+1, Dominic Steinitz a écrit :
>
> The example here https://sagemanifolds.obspm.fr/examples.html of
>
>
>- Electromagnetism in Minkowski spacetime
>
> 
> [ipynb
>
> ]
>(Electromagnetic field 2-form from E and B, Maxwell equations, conserved
>current, Lorentz force, Poynting vector)
>
> Fails with the error in the title and in more detail below.
>
>
> For reference: this is discussed in the new thread
> https://groups.google.com/g/sage-support/c/yD6k655EWOA/m/3AMzKdpaAQAJ
>
> Besides, the question about the connection forms has been answered on
> https://ask.sagemath.org/
>
> Eric.
>

-- 
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/CANnG18-Hv7Q4Wf0vqFD4epzQ1VXqq_q6c4YL9hDcXTZu5nHxCw%40mail.gmail.com.


Re: [sage-support] Re: ideal intersection in ZZ

2023-10-30 Thread G. M.-S.
Nils,

Thanks for your patience and sorry for my ignorance.

Guillermo

On Sun, 29 Oct 2023 at 21:31, Nils Bruin  wrote:

> On Monday, 30 October 2023 at 00:26:55 UTC+13 G. M.-S. wrote:
>
> If I understand you correctly, SageMath is a bit loose at the moment about
> its categories.
>
>
> That's not what I meant also not what is indicated by what I noticed: by
> the looks of it, sage does know about euclidean domains and has quite a bit
> of ED-specific functionality. It's just that no-one has bothered
> specializing the *ideals* of euclidean domains. The definition of a
> Euclidean domain doesn't really mention ideals and indeed the subsequent
> properties of its ideals are established by lemmas and propositions.
> Basically, no-one has bothered making sagemath aware of those theorems (or
> even put the infrastructure in place to teach it about those results). So,
> no evidence of looseness in its categories. Just a little uneducated.
>

-- 
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/CANnG18-9u7TLVQkPQfXAZMS59LVj9a5isPQcTmajE%3DG8O%2BsxpQ%40mail.gmail.com.


Re: [sage-support] Re: ideal intersection in ZZ

2023-10-29 Thread G. M.-S.
Nils,

Thank you again for your explanations and insights, with which I agree.

As confirmed by the intersection methods you mention, I was thinking
about consistency.

I try to make my students grasp the concepts of integral domains, GCD
domains, UFDs, PIDs, Euclidean domains and fields.
One tool might be using SageMath to experiment with examples, but of course
it will not replace doing mathematics.
If I understand you correctly, SageMath is a bit loose at the moment about
its categories.
That is not a problem:  not to trust a computer blindly is part of my
teaching.

Guillermo

On Sat, 28 Oct 2023 at 20:04, Nils Bruin  wrote:

> On Saturday, 28 October 2023 at 10:22:15 UTC-7 G. M.-S. wrote:
>
>
> Thanks, Nils.
>
> My question was motivated by using SageMath in my teachings.
>
> Do you think it would be difficult/worthwhile taking care of this?
> I mean, ideals in euclidean rings (or at least in ZZ).
>
>
> Mathematically or algorithmically not difficult of course. I'd expect that
> to make it play nice with the category framework you'll need to do a lot of
> work. By the looks of ZZ.categories(), there is a category of "euclidean
> domains". The parent of ideals in ZZ, however, looks rather generic. I
> don't think the euclidean properties are propagated to the monoid of ideals
> at all at the moment. The "appropriate" level of generality would be there.
> However, there's not much to be gained from ideals in euclidean domains: we
> already have lcm and gcd! So I suspect that's why it's not implemented at
> the moment.
>
> I can see how having such ideals may seem instructive for teaching. I
> think that's a matter of philosophy / opinion. I happen to not believe that
> teaching students formalisms in computer algebra packages without real
> benefit/content (beyond lcm and gcd that they'll learn anyway) helps them
> much, so I wouldn't think it's worthwhile. Perhaps for having facilities
> for ideals universally available, it could be useful if ideals in ZZ have
> "intersection" implemented, but I have trouble seeing where that would come
> up.
>
> There are rings with ZZ as a subring for which intersection works on
> ideals proper, since we have groebner bases over ZZ, apparently:
>
> sage: R.=ZZ['x','y']
> sage: I=R.ideal(15)
> sage: J=R.ideal(35)
> sage: I.intersection(J)
>
> So you could use that ... or if you manage to define a multivariate
> polynomial ring over ZZ in 0 variables, you'd be good to go too. Free
> ZZ-modules of rank 1 would also get you the right behaviour.
>
>
> Guillermo
>
> On Sat, 28 Oct 2023 at 18:44, Nils Bruin  wrote:
>
> I'm sure its omission is just an oversight. For fractional ideals in
> number fields it is defined:
>
> sage: K.=QuadraticField(7)
> sage: I=K.fractional_ideal(5)
> sage: J=K.fractional_ideal(3)
> sage: I.intersection(J)
> Fractional ideal (15)
>
> I doubt that just knowing a ring is a PID makes computing intersections of
> ideals easy. So the omission may be because there doesn't seem to be
> ZZ-specific (or euclidean ring-specific) ideal code. And with lcm around,
> the need for it has been low, I expect.
>
> On Saturday, 28 October 2023 at 02:36:51 UTC-7 G. M.-S. wrote:
>
>
> I wonder why SageMath cannot compute the intersection of 2 ideals in ZZ.
>
> Is this due to the fact that ZZ would "only" be a PID?
>
> Guillermo
>
> ┌┐
>
> │ SageMath version 10.1, Release Date: 2023-08-20│
>
> │ Using Python 3.11.1. Type "help()" for help.   │
>
> └┘
>
> sage: n1,n2=720,756
>
> sage: d,m=gcd(n1,n2),lcm(n1,n2)
>
> sage: n1,n2,d,m
>
> (720, 756, 36, 15120)
>
> sage: I1,I2=ZZ.ideal(n1),ZZ.ideal(n2)
>
> sage: I1,I2
>
> (Principal ideal (720) of Integer Ring, Principal ideal (756) of Integer
> Ring)
>
> sage: I1+I2
>
> Principal ideal (36) of Integer Ring
>
> sage: I1.intersection(I2)
>
> ---
>
> AttributeErrorTraceback (most recent call
> last)
>
> Cell In [7], line 1
>
> > 1 I1.intersection(I2)
>
>
> File
> /private/var/tmp/sage-10.1-current/local/var/lib/sage/venv-python3.11.1/lib/python3.11/site-packages/sage/structure/element.pyx:488,
> in sage.structure.element.Element.__getattr__
> (build/cythonized/sage/structure/element.c:4846)()
>
> *486* AttributeError:
> 'LeftZeroSemigroup_with_category.element_class' object has no attribute
> 'blah_blah'
>
> *487* ""

Re: [sage-support] Re: ideal intersection in ZZ

2023-10-28 Thread G. M.-S.
Thanks, Nils.

My question was motivated by using SageMath in my teachings.

Do you think it would be difficult/worthwhile taking care of this?
I mean, ideals in euclidean rings (or at least in ZZ).

Guillermo

On Sat, 28 Oct 2023 at 18:44, Nils Bruin  wrote:

> I'm sure its omission is just an oversight. For fractional ideals in
> number fields it is defined:
>
> sage: K.=QuadraticField(7)
> sage: I=K.fractional_ideal(5)
> sage: J=K.fractional_ideal(3)
> sage: I.intersection(J)
> Fractional ideal (15)
>
> I doubt that just knowing a ring is a PID makes computing intersections of
> ideals easy. So the omission may be because there doesn't seem to be
> ZZ-specific (or euclidean ring-specific) ideal code. And with lcm around,
> the need for it has been low, I expect.
>
> On Saturday, 28 October 2023 at 02:36:51 UTC-7 G. M.-S. wrote:
>
>>
>> I wonder why SageMath cannot compute the intersection of 2 ideals in ZZ.
>>
>> Is this due to the fact that ZZ would "only" be a PID?
>>
>> Guillermo
>>
>> ┌┐
>>
>> │ SageMath version 10.1, Release Date: 2023-08-20│
>>
>> │ Using Python 3.11.1. Type "help()" for help.   │
>>
>> └┘
>>
>> sage: n1,n2=720,756
>>
>> sage: d,m=gcd(n1,n2),lcm(n1,n2)
>>
>> sage: n1,n2,d,m
>>
>> (720, 756, 36, 15120)
>>
>> sage: I1,I2=ZZ.ideal(n1),ZZ.ideal(n2)
>>
>> sage: I1,I2
>>
>> (Principal ideal (720) of Integer Ring, Principal ideal (756) of Integer
>> Ring)
>>
>> sage: I1+I2
>>
>> Principal ideal (36) of Integer Ring
>>
>> sage: I1.intersection(I2)
>>
>>
>> ---
>>
>> AttributeErrorTraceback (most recent call
>> last)
>>
>> Cell In [7], line 1
>>
>> > 1 I1.intersection(I2)
>>
>>
>> File
>> /private/var/tmp/sage-10.1-current/local/var/lib/sage/venv-python3.11.1/lib/python3.11/site-packages/sage/structure/element.pyx:488,
>> in sage.structure.element.Element.__getattr__
>> (build/cythonized/sage/structure/element.c:4846)()
>>
>> *486* AttributeError:
>> 'LeftZeroSemigroup_with_category.element_class' object has no attribute
>> 'blah_blah'
>>
>> *487* """
>>
>> --> 488 return self.getattr_from_category(name)
>>
>> *489*
>>
>> *490* cdef getattr_from_category(self, name):
>>
>>
>> File
>> /private/var/tmp/sage-10.1-current/local/var/lib/sage/venv-python3.11.1/lib/python3.11/site-packages/sage/structure/element.pyx:501,
>> in sage.structure.element.Element.getattr_from_category
>> (build/cythonized/sage/structure/element.c:4958)()
>>
>> *499* else:
>>
>> *500* cls = P._abstract_element_class
>>
>> --> 501 return getattr_from_other_class(self, cls, name)
>>
>> *502*
>>
>> *503* def __dir__(self):
>>
>>
>> File
>> /private/var/tmp/sage-10.1-current/local/var/lib/sage/venv-python3.11.1/lib/python3.11/site-packages/sage/cpython/getattr.pyx:362,
>> in sage.cpython.getattr.getattr_from_other_class
>> (build/cythonized/sage/cpython/getattr.c:2773)()
>>
>> *360* dummy_error_message.cls = type(self)
>>
>> *361* dummy_error_message.name = name
>>
>> --> 362 raise AttributeError(dummy_error_message)
>>
>> *363* attribute = attr
>>
>> *364* # Check for a descriptor (__get__ in Python)
>>
>>
>> AttributeError: 'Ideal_pid' object has no attribute 'intersection'
>>
>> sage:
>>
>

-- 
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/CANnG18_Mj3vkO62hj%2B2-oO%2BiV4mcx5vtzukRJSNYrU5evPgZOg%40mail.gmail.com.


[sage-support] ideal intersection in ZZ

2023-10-28 Thread G. M.-S.
I wonder why SageMath cannot compute the intersection of 2 ideals in ZZ.

Is this due to the fact that ZZ would "only" be a PID?

Guillermo

┌┐

│ SageMath version 10.1, Release Date: 2023-08-20│

│ Using Python 3.11.1. Type "help()" for help.   │

└┘

sage: n1,n2=720,756

sage: d,m=gcd(n1,n2),lcm(n1,n2)

sage: n1,n2,d,m

(720, 756, 36, 15120)

sage: I1,I2=ZZ.ideal(n1),ZZ.ideal(n2)

sage: I1,I2

(Principal ideal (720) of Integer Ring, Principal ideal (756) of Integer
Ring)

sage: I1+I2

Principal ideal (36) of Integer Ring

sage: I1.intersection(I2)

---

AttributeErrorTraceback (most recent call last)

Cell In [7], line 1

> 1 I1.intersection(I2)


File
/private/var/tmp/sage-10.1-current/local/var/lib/sage/venv-python3.11.1/lib/python3.11/site-packages/sage/structure/element.pyx:488,
in sage.structure.element.Element.__getattr__
(build/cythonized/sage/structure/element.c:4846)()

*486* AttributeError:
'LeftZeroSemigroup_with_category.element_class' object has no attribute
'blah_blah'

*487* """

--> 488 return self.getattr_from_category(name)

*489*

*490* cdef getattr_from_category(self, name):


File
/private/var/tmp/sage-10.1-current/local/var/lib/sage/venv-python3.11.1/lib/python3.11/site-packages/sage/structure/element.pyx:501,
in sage.structure.element.Element.getattr_from_category
(build/cythonized/sage/structure/element.c:4958)()

*499* else:

*500* cls = P._abstract_element_class

--> 501 return getattr_from_other_class(self, cls, name)

*502*

*503* def __dir__(self):


File
/private/var/tmp/sage-10.1-current/local/var/lib/sage/venv-python3.11.1/lib/python3.11/site-packages/sage/cpython/getattr.pyx:362,
in sage.cpython.getattr.getattr_from_other_class
(build/cythonized/sage/cpython/getattr.c:2773)()

*360* dummy_error_message.cls = type(self)

*361* dummy_error_message.name = name

--> 362 raise AttributeError(dummy_error_message)

*363* attribute = attr

*364* # Check for a descriptor (__get__ in Python)


AttributeError: 'Ideal_pid' object has no attribute 'intersection'

sage:

-- 
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/CANnG18_BEyzLdcmikDNi8j9%3D%2BYHQLVdpMgaTw6UtWkg%3DoJCUAw%40mail.gmail.com.


[sage-support] Display order not respected

2023-05-05 Thread G. M.-S.
I am not sure this is a SageMath question, so I am asking for advice.

In some interactive code run in a Jupyter notebook, I have plenty of
show(html(…))
followed by
ans=input(…)
The problem is that too often, the prompt for input appears *before* the
result of the preceding show, which is confusing.

Is this a known issue?  Should I try to construct a MWE?

TIA,

Guillermo

-- 
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/CANnG189GZyjp4ynrVmuSoH04mA__fsyp%3DNRrBq36AFgecJ1cMg%40mail.gmail.com.


Re: [sage-support] Re: test for floats and co.

2023-05-03 Thread G. M.-S.
Thanks Nils.

I shall try to manage with the information you have given me.

(In case you are curious, this is for code aimed at my students.)

Guillermo

On Wed, 3 May 2023 at 17:58, Nils Bruin  wrote:

> On Wednesday, 3 May 2023 at 08:21:39 UTC-7 G. M.-S. wrote:
>
>
> Related to a recent discussion, is there a (simple) way to find whether an
> expression contains non exact explicit numbers?
>
> For symbolic expression you should probably walk the entire expression
> tree.
>
> For sage objects, examining the parents involved should do the trick:
>
> sage: QQ.is_exact()
> True
> sage: RR.is_exact()
> False
>
> However, be careful:
>
> sage: A=matrix(RR,2,2,[1,2,3,4])
> sage: parent(A).is_exact()
> True
>
> because matrix rings presently aren't aware of inexactness of their base
> rings. So you should walk the construction of a parent and see if there are
> any inexact constituents:
>
> sage: parent(A).construction()
> (MatrixFunctor, Real Field with 53 bits of precision)
>

-- 
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/CANnG189YsBhjH%3DU1u9gYD4oYz%3DvBSOpVOkmaRRj5z3jU41gHrA%40mail.gmail.com.


Re: [sage-support] Re: '' in CC fails

2023-05-03 Thread G. M.-S.
Thanks Nils.
This is now
https://github.com/sagemath/sage/issues/35607

Guillermo

On Wed, 3 May 2023 at 17:51, Nils Bruin  wrote:

> On Wednesday, 3 May 2023 at 08:11:25 UTC-7 G. M.-S. wrote:
>
>
> This gives an error:
>
> sage: '' *in* CC
>
> […]
>
>
>
> ^
>
> SyntaxError: invalid syntax
>
> It looks like this error comes from the fact that "eval('')" raises this.
> Apparently an empty string is not valid python for the parser. It is a
> little strange that an empty string is getting parsed to test for
> membership in CC. Many non-empty strings that are invalid python code do
> return "False", so it looks like the empty string ends up in a wrong code
> path somewhere. Worth a bug report, I'd say.
>

-- 
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/CANnG189b-3RCDUfo_3fbDrXbDYqzF_p7avfo0N6yy1YiHgh-%2BA%40mail.gmail.com.


[sage-support] test for floats and co.

2023-05-03 Thread G. M.-S.
Related to a recent discussion, is there a (simple) way to find whether an
expression contains non exact explicit numbers?

For example:

M1=matrix(1,2,[1,x+2])
M2=matrix(1,2,[1,x+2.])
mytest(M1)
→ True
mytest(M2)
→ False

Guillermo

-- 
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/CANnG188HmGcf4TG_V1PDiMZ5FpH7B3KRzJZ5Ay_FYaXE-nKjQA%40mail.gmail.com.


[sage-support] '' in CC fails

2023-05-03 Thread G. M.-S.
This works:

sage: *for* i *in* [ZZ,QQ,RR]:

: print('empty string in',i,':','' *in* i)

:

empty string in Integer Ring : False

empty string in Rational Field : False

empty string in Real Field with 53 bits of precision : False

This gives an error:

sage: '' *in* CC

[…]



^

SyntaxError: invalid syntax

Why?

TIA,

Guillermo

-- 
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/CANnG189my7k1HMw8FGrkDN2Roxr0e36PC4tB32ZYEWKPC_prmQ%40mail.gmail.com.


Re: [sage-support] evaluate a string in the current scope

2023-04-16 Thread G. M.-S.
Thanks Dima.
I think that
sage: eval(preparse(string))
does what I need.

Guillermo

On Sun, 16 Apr 2023 at 23:45, Dima Pasechnik  wrote:

> On Sun, Apr 16, 2023 at 9:32 PM G. M.-S.  wrote:
> >
> > Is there a way to evaluate a string in the current scope?
> >
> > So that
> > sage: expression
> > and
> > sage: some_evaluate(str(expression))
> > give the same thing at the same place.
> > I know about sage_eval, but it seems to need a dictionary of everything
> in the local scope.
> >
> > For instance,
> > sage: a=3
> > sage: a^2
> > 9
> > sage: some_evaluate('a^2')
> > 9
> > instead of
> > sage: a=3
> > sage: sage_eval('a^2')
> > NameError: name 'a' is not defined
> > (of course this is a trivial example).
>
> there is a plain eval():
>
> sage: a=2
> sage: eval("a^2")
> 0
> sage: eval("a+a")
> 4
> sage: eval("a**2")
> 4
>
> (it looks like it doesn't do preparsing, but is the "normal" Python,
> but it's a minor issue IMHO)
>

-- 
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/CANnG188WNXrtAr8zO9trRH%3D7Jzy0_s9bK5n%2BDehUhQ1ry%2BJ%3DUg%40mail.gmail.com.


[sage-support] evaluate a string in the current scope

2023-04-16 Thread G. M.-S.
Is there a way to evaluate a string in the current scope?

So that
sage: expression
and
sage: some_evaluate(str(expression))
give the same thing at the same place.
I know about sage_eval, but it seems to need a dictionary of everything in
the local scope.

For instance,
sage: a=3
sage: a^2
9
sage: some_evaluate('a^2')
9
instead of
sage: a=3
sage: sage_eval('a^2')
NameError: name 'a' is not defined
(of course this is a trivial example).

Guillermo

-- 
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/CANnG18-6kgPsA1jZTKEZKsOVNxEpvRdMJi_xyv37r6po_r1fsw%40mail.gmail.com.


Re: [sage-support] Testing forked branches

2023-04-09 Thread G. M.-S.
You are right, John.  I did not read it carefully enough.

Guillermo

On Sun, 9 Apr 2023 at 05:38, John H Palmieri  wrote:

> I have found the instructions at
> https://github.com/sagemath/trac-to-github/blob/master/docs/Migration-Trac-to-Github.md
> useful for me, as someone used to the old trac interface.
>
> On Saturday, April 8, 2023 at 1:23:06 PM UTC-7 G. M.-S. wrote:
>
>>
>> Thanks Dima and Drew.
>>
>> I had the very same question, but zero ways for doing it, so I did not
>> dare ask…
>>
>> Guillermo
>>
>> On Sat, 8 Apr 2023 at 22:14, Dima Pasechnik  wrote:
>>
>>>
>>> On Sat, 8 Apr 2023, 20:24 Drew Shotwell,  wrote:
>>>
>>>> I'm looking into working on an issue in git, and I'm wondering how to
>>>> properly go about testing someone else's branch. Let's take for instance
>>>> https://github.com/sagemath/sage/pull/35414.
>>>
>>>
>>> suppose you have remote foo set to
>>> https://github.com/sagemath/sage
>>> <https://github.com/sagemath/sage/pull/35414>
>>>
>>> then
>>>
>>> git fetch foo pull/35414 <https://github.com/sagemath/sage/pull/35414>
>>> /head:pr35414
>>>
>>> will create the branch named pr35414 you want
>>>
>>> Essentially what I want to do is get the code changes from the forked
>>>> branch videlec:complex-root-of-to-algebraic into my repository so I can
>>>> test them in parallel with the develop branch. My own research has opened
>>>> an overwhelming number of different ways for doing this, so I figured I'd
>>>> ask here to get the most straight forward answer. 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 view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-support/CANnG18-p_u8WaHggnxdwte%2BfnNLJL33vyJszfBUb2Oe_QDHyoA%40mail.gmail.com.


Re: [sage-support] Testing forked branches

2023-04-08 Thread G. M.-S.
Thanks Dima and Drew.

I had the very same question, but zero ways for doing it, so I did not dare
ask…

Guillermo

On Sat, 8 Apr 2023 at 22:14, Dima Pasechnik  wrote:

>
> On Sat, 8 Apr 2023, 20:24 Drew Shotwell,  wrote:
>
>> I'm looking into working on an issue in git, and I'm wondering how to
>> properly go about testing someone else's branch. Let's take for instance
>> https://github.com/sagemath/sage/pull/35414.
>
>
> suppose you have remote foo set to
> https://github.com/sagemath/sage
> 
>
> then
>
> git fetch foo pull/35414 
> /head:pr35414
>
> will create the branch named pr35414 you want
>
>
> Essentially what I want to do is get the code changes from the forked
>> branch videlec:complex-root-of-to-algebraic into my repository so I can
>> test them in parallel with the develop branch. My own research has opened
>> an overwhelming number of different ways for doing this, so I figured I'd
>> ask here to get the most straight forward answer. 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 view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-support/CANnG189Fgm1N0NHvW2T-6BssFTxeQ288ogg3%3DA8f%3DVcZRTjzuA%40mail.gmail.com.


Re: [sage-support] Cannot factor 71281426948143699070565 with ecm.factor()

2023-01-29 Thread G. M.-S.
Thanks Dima, you taught me something new today.

Guillermo

On Sun, 29 Jan 2023 at 20:50, Dima Pasechnik  wrote:

> On Sun, Jan 29, 2023 at 3:04 PM G. M.-S.  wrote:
> >
> > For me, with SageMath version 9.8.beta7
> > sage: ecm.factor(71281426948143699070565)
> > does not return quickly either.
> > Indeed, running
> > sage: ecm.interact()
> > seems to show a strange behaviour for 71281426948143699070565 when
> factoring the factors found.
> > As this is probabilistic and the output changes every time, I do not
> copy it here.
>
> Basically, the default B1 value is too large in this case.
>
> sage: ecm.factor(71281426948143699070565,B1=200) # almost instant
> [5, 53, 337, 1873, 2833, 7507, 20037791]
> sage: ecm.factor(71281426948143699070565,B1=2000) # takes looong time
>
> the docs say:
>
>* "B1" -- initial lower bound, defaults to 2000 (15 digit factors).
>  Used if "factor_digits" is not specified.
>
> > Guillermo
> >
> > On Sun, 29 Jan 2023 at 15:41, Bill Witzke  wrote:
> >>
> >> Hi,
> >>
> >> I have a hard time factoring the number 71281426948143699070565 using
> ecm.factor().  No result is given after a few minutes runtime.  Though,
> plain factor() happily factors the number.  Factoring smaller or larger
> numbers  work fine with ecm.factor(), too.  Just the single given number
> seems to be problematic.
> >>
> >> Am I doing something wrong?  Can someone confirm?
> >>
> >> system:
> >> Ubuntu 22.04
> >> sagemath 9.5-4 (via apt)
> >> Intel Pentium N5000
> >> (SageMath and Python beginner)
> >>
> >> example code factoring numbers in the range [71281426948143699070565  -
> L, 71281426948143699070565 + L]:
> >>
> >> # Odd number.
> >> n = 71281426948143699070565
> >> # Limit.
> >> L = 2
> >> # Iterate over interval [-L, L].
> >> for i in range(-L, L + 1):
> >> m = n + i
> >> print("%d  =>  %s" % (m, ecm.factor(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 view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-support/CANnG18_HSRJZKhmC8%3DQ476x-FY9s%2BQZToXOKtk0NV1QBquUxtA%40mail.gmail.com.


Re: [sage-support] Cannot factor 71281426948143699070565 with ecm.factor()

2023-01-29 Thread G. M.-S.
For me, with SageMath version 9.8.beta7

sage: ecm.factor(71281426948143699070565)
does not return quickly either.

Indeed, running

sage: ecm.interact()
seems to show a strange behaviour for 71281426948143699070565 when
factoring the factors found.
As this is probabilistic and the output changes every time, I do not copy
it here.

Guillermo

On Sun, 29 Jan 2023 at 15:41, Bill Witzke  wrote:

> Hi,
>
> I have a hard time factoring the number 71281426948143699070565 using
> ecm.factor().  No result is given after a few minutes runtime.  Though,
> plain factor() happily factors the number.  Factoring smaller or larger
> numbers  work fine with ecm.factor(), too.  Just the single given number
> seems to be problematic.
>
> Am I doing something wrong?  Can someone confirm?
>
> system:
> Ubuntu 22.04
> sagemath 9.5-4 (via apt)
> Intel Pentium N5000
> (SageMath and Python beginner)
>
> example code factoring numbers in the range [71281426948143699070565  - L,
> 71281426948143699070565 + L]:
>
> # Odd number.
> n = 71281426948143699070565
> # Limit.
> L = 2
> # Iterate over interval [-L, L].
> for i in range(-L, L + 1):
> m = n + i
> print("%d  =>  %s" % (m, ecm.factor(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 view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-support/CANnG18_ogCA_MTZ%3DgvC9em6_5PtwxxW7J2dr7PiW5Pq-f-q43A%40mail.gmail.com.


Re: [sage-support] exponentialize not working with sinh

2022-09-12 Thread G. M.-S.
Hi Andrius.

Perhaps your version of SageMath is too old.
With a recent version I get the following.
I know that for Windows there is no version more recent than 9.3 that can
be installed very quickly.
Look at
https://doc.sagemath.org/html/en/installation/index.html
to see the possibilities.

% sage

┌┐

│ SageMath version 9.7.beta5, Release Date: 2022-07-10   │

│ Using Python 3.10.5. Type "help()" for help.   │

└┘

┏┓

┃ Warning: this is a prerelease version, and it may be unstable. ┃

┗┛

sage: sinh(x).exponentialize()

-1/2*e^(-x) + 1/2*e^x

sage: cosh(x).exponentialize()

1/2*e^(-x) + 1/2*e^x

sage: tanh(x).exponentialize()

-(e^(-x) - e^x)/(e^(-x) + e^x)

sage:

Guillermo

On Mon, 12 Sept 2022 at 19:19, Andrius Tamulis 
wrote:

> Simply as stated. Version 'SageMath version 9.3, Release Date: 2021-05-09'.
> Windows 10, 64 bit. Copied and pasted from
> https://doc.sagemath.org/html/en/reference/calculus/sage/symbolic/expression.html#sage.symbolic.expression.Expression.exponentialize
> in to Jupyter notebook:
>
> x = SR.var("x")
> sinh(x).exponentialize()
>
> and got the following:
>
> ---
> AttributeError Traceback (most recent call last)
>  in  > 1 sinh(x).exponentialize(
> )
> /opt/sagemath-9.3/local/lib/python3.7/site-packages/sage/structure/element.pyx
> in sage.structure.element.Element.__getattr__
> (build/cythonized/sage/structure/element.c:4709)() 491 AttributeError:
> 'LeftZeroSemigroup_with_category.element_class' object has no attribute
> 'blah_blah' 492 """ --> 493 return self.getattr_from_category(name) 494
> 495 cdef getattr_from_category(self, name):
> /opt/sagemath-9.3/local/lib/python3.7/site-packages/sage/structure/element.pyx
> in sage.structure.element.Element.getattr_from_category
> (build/cythonized/sage/structure/element.c:4821)() 504 else: 505 cls = 
> P._abstract_element_class
> --> 506 return getattr_from_other_class(self, cls, name) 507 508 def
> __dir__(self):
> /opt/sagemath-9.3/local/lib/python3.7/site-packages/sage/cpython/getattr.pyx
> in sage.cpython.getattr.getattr_from_other_class
> (build/cythonized/sage/cpython/getattr.c:2618)() 370 dummy_error_message.cls
> = type(self) 371 dummy_error_message.name = name --> 372 raise
> AttributeError(dummy_error_message) 373 attribute = attr 374 #
> Check for a descriptor (__get__ in Python) AttributeError:
> 'sage.symbolic.expression.Expression' object has no attribute
> 'exponentialize'
>
> Thank you,
>
> Andrius
>

-- 
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/CANnG18_93hQtos3jVnYW9hCrNAW0rzRUGcp8Jz3Z%3Dt47Lwq1mg%40mail.gmail.com.


Re: [sage-support] Error while finding a solution of the non linear equation by bisection method using loop in SageCellServer

2022-08-29 Thread G. M.-S.
Implicit assumptions are a great source of disasters (in programming and
elsewhere).
There are many other things that can go wrong in this "bisection"
procedure, I was just pointing at some of them.
Anyway, I am sorry if you took it badly.  I was only trying to help.

Best,

Guillermo

On Mon, 29 Aug 2022 at 10:48, Varun Kumar  wrote:

> In my problem the Bisection means a bisection method in numerical analysis.
> In this method, b > a always because we find the root of the equation in
> the interval (a, b) so for the formation of the interval it is necessary b
> > a.
>
> On Mon, Aug 29, 2022 at 12:18 AM G. M.-S.  wrote:
>
>>
>> Hi Varun.
>>
>> There are several problems (besides the confusion between "Bisection" and
>> "bisection").
>>
>> 1) As you know, in Python blocks are delimited by indentation.  So it
>> should be
>>
>> sage: *def* *bisection*(f, a, b, errorBound):
>>
>> : xm = (a+b)/*2*
>>
>> : *while* f(x) != *0* and (b-a) >= errorBound:
>>
>> : *if* f(a)*f(xm) < *0*:
>>
>> : b = xm
>>
>> : *else*:
>>
>> : a = xm
>>
>> : xm = (a+b)/*2*
>>
>> : *return* xm
>>
>> 2) The second problem is you suppose b>a which is not always true:
>>
>> sage: bisection(f,*3*,*2*,*.001*).n()
>>
>> 2.50
>>
>> which is totally wrong.
>>
>> 3) There is a third problem, as you can see with
>>
>> sage: f(x) = x^*2*-*9*
>>
>> sage: x = *3*
>>
>> sage: bisection(f,-*2*,*10*,*1*)
>>
>> 4
>>
>> which is totally wrong.
>>
>> This is because you use x instead of xm inside *bisection*.
>>
>>
>> 4) Also, the while loop is not guaranteed to terminate, so a finite loop
>> is better.
>>
>>
>> 5) Finally, as you are looking for a root, it is perhaps best to bound
>> both |f(xm)| and |b–a|.
>>
>>
>> 6) Do not forget that xm is a local variable, so it is not defined
>> outside *bisection*.
>>
>>
>> So you could do something similar to the following:
>>
>>
>> sage: *def* *mybisection*(f, aa, bb, maxvalueerror, maxrooterror,
>> maxiter):
>>
>> : *if* abs(f(aa)) < maxrooterror:
>>
>> : print("Solution found after 0 iterations.")
>>
>> : *return* aa
>>
>> : *if* abs(f(bb)) < maxrooterror:
>>
>> : print("Solution found after 0 iterations.")
>>
>> : *return* bb
>>
>> : *if* aa < bb:
>>
>> : a,b = aa,bb
>>
>> : *else*:
>>
>> : a,b = bb,aa
>>
>> : *if* f(a)*f(b) > *0*:
>>
>> : print("No guaranteed solution, stopping.")
>>
>> : *return* *None*
>>
>> : *for* i in range(maxiter):
>>
>> : xm = (a+b)/*2*
>>
>> : *if* abs(f(xm)) < maxvalueerror and (b-a)/*2* <
>> maxrooterror:
>>
>> : print("Solution found after "+str(i+*1*)+" iterations."
>> )
>>
>> : *return* xm
>>
>> : *if* f(a)*f(xm) < *0*:
>>
>> : b = xm
>>
>> : *else*:
>>
>> : a = xm
>>
>> : print("No solution found after "+str(maxiter)+" iterations")
>>
>> : *return* *None*
>>
>> :
>>
>> sage: *def* *f*(x):
>>
>> : *return* x^*3*-*9**x+*1*
>>
>> :
>>
>> sage: x0 = mybisection(f,*2*,*3*,*10*^-*12*,*10*^-*12*,*1000*)
>>
>> Solution found after 40 iterations.
>>
>> sage: x0.n(),f(x0).n()
>>
>> (2.94282005779587, 5.45047701991629e-13)
>>
>> sage:
>>
>> (Notice the name, to avoid any clash in case *bisection* already exists.)
>>
>> HTH,
>>
>> Guillermo
>>
>> On Sun, 28 Aug 2022 at 13:31, Varun Kumar  wrote:
>>
>>>  def Bisection(f, a, b, errorBound):
>>> xm = (a+b)/2
>>> while( f(x)!=0 and (b-a) >= errorBound):
>>> if(f(a)*f(xm)<0):
>>> b = xm
>>> else:
>>> a = xm
>>> xm = (a+b)/2
>>> return xm
>>> def f(x):
>>> return x^3-9*x+1
>>> bisection(f,2,3,0.001)
>>> print("root=", xm,"f(x)=",f(x))
>>> *After evaluating we get an error like: *
>>>
>>> * File "/tmp/ipykernel_997521/4223205321.py", line 6 else: ^
>>> SyntaxError: invalid syntax*
>>>
>>> What can I do and what is the tool that I can use?
>>> Help me
>>> Your's
>>> Varun
>>>
>>

-- 
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/CANnG18_STOtHiDrwbgp8ZR4x3G0np_GG4YYUks-A%3DCKyS45Azw%40mail.gmail.com.


Re: [sage-support] Error while finding a solution of the non linear equation by bisection method using loop in SageCellServer

2022-08-28 Thread G. M.-S.
Hi Varun.

There are several problems (besides the confusion between "Bisection" and
"bisection").

1) As you know, in Python blocks are delimited by indentation.  So it
should be

sage: *def* *bisection*(f, a, b, errorBound):

: xm = (a+b)/*2*

: *while* f(x) != *0* and (b-a) >= errorBound:

: *if* f(a)*f(xm) < *0*:

: b = xm

: *else*:

: a = xm

: xm = (a+b)/*2*

: *return* xm

2) The second problem is you suppose b>a which is not always true:

sage: bisection(f,*3*,*2*,*.001*).n()

2.50

which is totally wrong.

3) There is a third problem, as you can see with

sage: f(x) = x^*2*-*9*

sage: x = *3*

sage: bisection(f,-*2*,*10*,*1*)

4

which is totally wrong.

This is because you use x instead of xm inside *bisection*.


4) Also, the while loop is not guaranteed to terminate, so a finite loop is
better.


5) Finally, as you are looking for a root, it is perhaps best to bound both
|f(xm)| and |b–a|.


6) Do not forget that xm is a local variable, so it is not defined outside
*bisection*.


So you could do something similar to the following:


sage: *def* *mybisection*(f, aa, bb, maxvalueerror, maxrooterror, maxiter):

: *if* abs(f(aa)) < maxrooterror:

: print("Solution found after 0 iterations.")

: *return* aa

: *if* abs(f(bb)) < maxrooterror:

: print("Solution found after 0 iterations.")

: *return* bb

: *if* aa < bb:

: a,b = aa,bb

: *else*:

: a,b = bb,aa

: *if* f(a)*f(b) > *0*:

: print("No guaranteed solution, stopping.")

: *return* *None*

: *for* i in range(maxiter):

: xm = (a+b)/*2*

: *if* abs(f(xm)) < maxvalueerror and (b-a)/*2* < maxrooterror:

: print("Solution found after "+str(i+*1*)+" iterations.")

: *return* xm

: *if* f(a)*f(xm) < *0*:

: b = xm

: *else*:

: a = xm

: print("No solution found after "+str(maxiter)+" iterations")

: *return* *None*

:

sage: *def* *f*(x):

: *return* x^*3*-*9**x+*1*

:

sage: x0 = mybisection(f,*2*,*3*,*10*^-*12*,*10*^-*12*,*1000*)

Solution found after 40 iterations.

sage: x0.n(),f(x0).n()

(2.94282005779587, 5.45047701991629e-13)

sage:

(Notice the name, to avoid any clash in case *bisection* already exists.)

HTH,

Guillermo

On Sun, 28 Aug 2022 at 13:31, Varun Kumar  wrote:

>  def Bisection(f, a, b, errorBound):
> xm = (a+b)/2
> while( f(x)!=0 and (b-a) >= errorBound):
> if(f(a)*f(xm)<0):
> b = xm
> else:
> a = xm
> xm = (a+b)/2
> return xm
> def f(x):
> return x^3-9*x+1
> bisection(f,2,3,0.001)
> print("root=", xm,"f(x)=",f(x))
> *After evaluating we get an error like: *
>
> * File "/tmp/ipykernel_997521/4223205321.py", line 6 else: ^ SyntaxError:
> invalid syntax*
>
> What can I do and what is the tool that I can use?
> Help me
> Your's
> Varun
>

-- 
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/CANnG18-hKhNKG6HFatdOVN1Q9D0A6cxDgpaEqS5Ne5zhsjCyHg%40mail.gmail.com.


[sage-support] building SageMath on macOS

2022-06-21 Thread G. M.-S.
When building SageMath on macOS from source, I think it is important to
stress that
$ source .homebrew-build-env
must be done before
$ ./configure
(I have not found this in the instructions, and I have spent some time
trying to guess why ./configure did not find system packages from Homebrew).

I could make a note myself, but I am not sure where and how.

Guillermo

-- 
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/CANnG189inSkpBpHp6h%3Dt6fTz1JWEH2h%3DP3mqDUipA57ejnrxWQ%40mail.gmail.com.


Re: [sage-support] Sage Days: link

2022-06-01 Thread G. M.-S.
Thanks Dima, I thought the beginning was at 10:00 UTC.

On Wed, 1 Jun 2022 at 13:51, Dima Pasechnik  wrote:

> the 1st talk is not on yet, it's Wednesday June 1, 14:45–15:45 UTC,
> according to https://wiki.sagemath.org/days112.358
>
> On Wed, Jun 1, 2022 at 12:39 PM G. M.-S.  wrote:
> >
> > No Zoom links there, AFAICT.
> > Is "Self-organized SageMath coding sprints" still ongoing?
> > How to connect?
> >
> > On Wed, 1 Jun 2022 at 13:30, Dima Pasechnik  wrote:
> >>
> >> On Wed, Jun 1, 2022 at 12:24 PM Dima Pasechnik 
> wrote:
> >> >
> >> > zoom link is
> >> > https://sagemath.zulipchat.com/#narrow/stream/321245-sd112.2E358
> >>
> >> as far as I understand, zoom links will be posted there.
> >>
> >> > On Wed, Jun 1, 2022 at 12:22 PM G. M.-S.  wrote:
> >> > >
> >> > >
> >> > > I must be stupid, but I have been unable to find any Zoom link (or
> any other link) to connect to Sage Days live stream.
> >> > >
> >> > > Any help is appreciated.
> >> > >
> >> > > Guillermo
>

-- 
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/CANnG18-wW_FaHj9V5XeyqXvToMebxfD77bTiesUXrZKjn5jf%3Dg%40mail.gmail.com.


Re: [sage-support] Sage Days: link

2022-06-01 Thread G. M.-S.
No Zoom links there, AFAICT.
Is "Self-organized SageMath coding sprints" still ongoing?
How to connect?

On Wed, 1 Jun 2022 at 13:30, Dima Pasechnik  wrote:

> On Wed, Jun 1, 2022 at 12:24 PM Dima Pasechnik  wrote:
> >
> > zoom link is
> > https://sagemath.zulipchat.com/#narrow/stream/321245-sd112.2E358
>
> as far as I understand, zoom links will be posted there.
>
> > On Wed, Jun 1, 2022 at 12:22 PM G. M.-S.  wrote:
> > >
> > >
> > > I must be stupid, but I have been unable to find any Zoom link (or any
> other link) to connect to Sage Days live stream.
> > >
> > > Any help is appreciated.
> > >
> > > Guillermo
>

-- 
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/CANnG188jRvJ%3DwsZe8oWd32K-OEsNPKdrZaAYY3jUYf2WqixLBA%40mail.gmail.com.


[sage-support] Sage Days: link

2022-06-01 Thread G. M.-S.
I must be stupid, but I have been unable to find any Zoom link (or any
other link) to connect to Sage Days live stream.

Any help is appreciated.

Guillermo

-- 
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/CANnG18_tJKa1b%3D1nJH4vG2RHf3X3V5k4Hi4B%3D%3D2-Hp_9yehQvw%40mail.gmail.com.


Re: [sage-support] Sagemath 9.5 kernel crash from GF(2) empty vector dot product

2022-05-06 Thread G. M.-S.
I think that if k is a field, then k^n is a k-vector space for any
nonnegative integer n, including 0.
And the empty sum is equal to 0.

In the same vein, all matrices of size (m,0) and (0,n) are equal and square
and have determinant 1 (empty product).

Guillermo

On Fri, 6 May 2022 at 12:20, Dima Pasechnik  wrote:

> On Fri, May 6, 2022 at 5:04 AM Tracy Hall  wrote:
> >
> > The following two lines crash the kernel in 9.5 but not 9.4:
> >
> > xx = vector(GF(2), [])
> > xx * xx
> >
> > It works correctly (with answer 0) over other finite fields or over QQ.
>
> IMHO the bug is in accepting vector(..., []) as a valid object - it's
> a "vector" of length 0, after all.
>
> Dima
>
> > Installation is Sagemath 9.5 in Ubuntu running under WSL for Windows;
> tested also in CoCalc Sagemath 9.5 (where it crashes) and CoCalc Sagemath
> 9.4 (where it correctly produces 0).
>

-- 
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/CANnG18_7oqwpzZvNZr4S4x3P6XBkGSi4xDMJLy-svbtgZWOKRQ%40mail.gmail.com.


Re: [sage-support] ./sage -br fails

2022-04-25 Thread G. M.-S.
Thanks Matthias.

This is on the latest develop branch.

I have added a comment to the ticket you mention.

Guillermo

On Mon, 25 Apr 2022 at 04:32, Matthias Koeppe 
wrote:

> Which version of Sage is this?
> We fixed a bug like this recently that showed up when the environment
> variable MAKE was set in a particular way.
> See also https://trac.sagemath.org/ticket/33587
>
> On Sunday, April 24, 2022 at 3:17:08 AM UTC-7 list...@gmail.com wrote:
>
>>
>> Thanks, Maxime.
>>
>> Here is what I did.
>> Starting from scratch, cloned develop branch, make, make pytest, make
>> ptestlong with no problems.
>> New branch with a very minor modification in one file (typo in a doc
>> string).
>> So I think this applies:
>>
>> *Rebuilding Sage*
>> Once you have made any changes you of course want to build Sage and try
>> out your edits. As long as you only modified the Sage library (that is,
>> Python and Cython files under src/sage/...) you just have to run:
>> ./sage -br
>> to rebuild the Sage library and then start Sage. This should be quite
>> fast. If you made changes to third-party packages, then you have to run
>> make build
>> as if you were installing Sage from scratch.
>>
>>  Of course make build works, but my question is why ./sage -br fails with
>> /bin/sh: @cd: command not found
>>
>> Guillermo
>>
>> On Sun, 24 Apr 2022 at 11:30, Maxime Bombar  wrote:
>>
>>> On 4/24/22 00:37, G. M.-S. wrote:
>>> >
>>> > Following the advice in
>>> >
>>> >
>>> https://doc.sagemath.org/html/en/developer/walk_through.html#rebuilding-sage
>>> >
>>> > when trying
>>> >
>>> > ./sage -br
>>> >
>>> > I get
>>> >
>>> > [...]
>>> > ***
>>> > /bin/sh: @cd: command not found
>>> > make: *** [sagelib-SAGE_VENV-no-deps] Error 127
>>> >
>>> > real 0m0.029s
>>> > user 0m0.024s
>>> > sys 0m0.003s
>>> > ***
>>> > Error building Sage.
>>> >
>>> > The following package(s) may have failed to build (not necessarily
>>> > during this run of 'make sagelib-no-deps'):
>>> >
>>> > It is safe to delete any log files [...]
>>> >
>>> > What can I do?
>>> >
>>> > Guillermo
>>> >
>>> Hi Guillermo,
>>>
>>> if you have upgraded your system, especially python version, and/or
>>> other Sage dependencies, it might be necessary to rebuild sage from
>>> scratch, with a `make build`.
>>>
>>> --
>>> Maxime
>>>
>> --
> 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/275b0149-3c16-4b83-a196-a8d0f1170ecen%40googlegroups.com
> <https://groups.google.com/d/msgid/sage-support/275b0149-3c16-4b83-a196-a8d0f1170ecen%40googlegroups.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/CANnG18-a7iRoxwMWz3XE3_V22UBN68JzHVC1PQjE_R58frV4Qw%40mail.gmail.com.


Re: [sage-support] ./sage -br fails

2022-04-24 Thread G. M.-S.
Thanks, Maxime.

Here is what I did.
Starting from scratch, cloned develop branch, make, make pytest, make
ptestlong with no problems.
New branch with a very minor modification in one file (typo in a doc
string).
So I think this applies:

*Rebuilding Sage*
Once you have made any changes you of course want to build Sage and try out
your edits. As long as you only modified the Sage library (that is, Python
and Cython files under src/sage/...) you just have to run:
./sage -br
to rebuild the Sage library and then start Sage. This should be quite fast.
If you made changes to third-party packages, then you have to run
make build
as if you were installing Sage from scratch.

 Of course make build works, but my question is why ./sage -br fails with
/bin/sh: @cd: command not found

Guillermo

On Sun, 24 Apr 2022 at 11:30, Maxime Bombar  wrote:

> On 4/24/22 00:37, G. M.-S. wrote:
> >
> > Following the advice in
> >
> >
> https://doc.sagemath.org/html/en/developer/walk_through.html#rebuilding-sage
> >
> > when trying
> >
> > ./sage -br
> >
> > I get
> >
> > [...]
> > ***
> > /bin/sh: @cd: command not found
> > make: *** [sagelib-SAGE_VENV-no-deps] Error 127
> >
> > real 0m0.029s
> > user 0m0.024s
> > sys 0m0.003s
> > ***
> > Error building Sage.
> >
> > The following package(s) may have failed to build (not necessarily
> > during this run of 'make sagelib-no-deps'):
> >
> > It is safe to delete any log files [...]
> >
> > What can I do?
> >
> > Guillermo
> >
> Hi Guillermo,
>
> if you have upgraded your system, especially python version, and/or
> other Sage dependencies, it might be necessary to rebuild sage from
> scratch, with a `make build`.
>
> --
> Maxime
>

-- 
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/CANnG189J4QwAK51-OKf6UaKjGZd_zr-ZiKzi1PU0k8WgcS%2BH8g%40mail.gmail.com.


[sage-support] ./sage -br fails

2022-04-23 Thread G. M.-S.
Following the advice in

https://doc.sagemath.org/html/en/developer/walk_through.html#rebuilding-sage

when trying

./sage -br

I get

[...]
***
/bin/sh: @cd: command not found
make: *** [sagelib-SAGE_VENV-no-deps] Error 127

real 0m0.029s
user 0m0.024s
sys 0m0.003s
***
Error building Sage.

The following package(s) may have failed to build (not necessarily
during this run of 'make sagelib-no-deps'):

It is safe to delete any log files [...]

What can I do?

Guillermo

-- 
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/CANnG18_L1M%2BM1%2BNbfHc%3Do9zQ%2Bf-AwcCS2ubT0CwvgkMEwf51iQ%40mail.gmail.com.


Re: [sage-support] Re: \ZZ not defined

2022-04-18 Thread G. M.-S.
Thanks Emmanuel, this is
https://trac.sagemath.org/ticket/33729

Guillermo

On Mon, 18 Apr 2022 at 23:14, Emmanuel Charpentier <
emanuel.charpent...@gmail.com> wrote:

> This means that Mathjax, which is used by Jupyter to interpret LaTeX
> expressions, has no definition of a `\ZZ` LaTeX macro.
>
> On 9.6.rc0, I get `\Bold푍/6\Bold푍`, which is not interpreted by
> `mathjax` either. I don't know how to work around this with Mathjax.
>
> Would you mind filing a ticket ?
>
> Le lundi 18 avril 2022 à 13:11:22 UTC+2, list...@gmail.com a écrit :
>
>>
>> This is on SageMath 9.5, Jupyter notebook.
>>
>> Am I missing something?
>>
>> Guillermo
>>
>

-- 
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/CANnG1888sQTc94-iUbFB%2BGm_0kq2nMONKo2YGN%2BMFf_fG8cZuw%40mail.gmail.com.


[sage-support] \ZZ not defined

2022-04-18 Thread G. M.-S.
This is on SageMath 9.5, Jupyter notebook.

Am I missing something?

Guillermo

-- 
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/CANnG18_jr_-D%2BBk5FTo%3DSZMimdMOHDN%2BOdQi8RJEQuPOmAsBiA%40mail.gmail.com.


Re: [sage-support] Re: 2 questions on var

2022-04-16 Thread G. M.-S.
Thanks for the explanation, Nils (even if I am not sure to have understood
everything).

Guillermo

On Sat, 16 Apr 2022 at 22:56, Nils Bruin  wrote:

> On Saturday, 16 April 2022 at 05:37:16 UTC-7 list...@gmail.com wrote:
>
>>
>> Thanks Samuel and Emmanuel.
>>
>> Follow up question:  Why does
>> var('lambda',n=1)
>> fail?
>>
>
> Because the code in question tests the string actually passed in for
> whether it's a valid python identifier.
>
> Probably this is because the "n" optional argument was only added later.
> However, there's been quite a discussion on what the appropriate binding
> behaviour should be. One option would be to bind the actual returned result
> (a tuple of the constructed symbols) to a name in the current namespace.
> i.e., the result of
>
> x = SR.var('x',n=3)
>
> For that behaviour, the passed-in name would have to be a valid
> identifier. So to future-proof sage, perhaps it's better to have this
> stricter check.
>
> You can create symbols without the check: SR.symbol('lambda') works just
> fine. To create the symbols you'd like, you can do:
>
> L = (SR.symbol("lambda{}".format(i)) for i in range(3))
>
> binding them to corresponding symbols would require a little more work .
> It's basically
>
> for c in L:
> globals()[str(c)] = c
>
> which works when typed in as-is, but requires some more trickery if it is
> wrapped in a function in some module, due to the semantics of the actual
> "globals()" call in python.
>
> [in general, for anything other than direct interactive use, you should
> probably not rely on binding injections]
>

-- 
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/CANnG18_GP8Y0Ftx-Gt0RFM4KUd3%2B%3Dueh%3DQTBQ_jGsrAJoPKwpg%40mail.gmail.com.


Re: [sage-support] Re: 2 questions on var

2022-04-16 Thread G. M.-S.
Thanks Samuel and Emmanuel.

Follow up question:  Why does
var('lambda',n=1)
fail?

I know that the name "lambda" is not a valid Python identifier, but I am
asking for "lambda0", "lambda1".

Guillermo

On Tue, 8 Mar 2022 at 19:19, Emmanuel Charpentier <
emanuel.charpent...@gmail.com> wrote:

> even more simpler :-) :
>
> sage: V=var("v", n=8)
> sage: V
> (v0, v1, v2, v3, v4, v5, v6, v7)
> sage: v2
> v2
> sage: V[2]
> v2
>
> *“Who could ask for anything more ?”*
> Le mardi 8 mars 2022 à 08:20:07 UTC+1, slelievre a écrit :
>
>> Even more practical, I find, is to name the tuple of indexed variables:
>> ```
>> sage: v = SR.var('v', n=8)
>> sage: v
>> (v0, v1, v2, v3, v4, v5, v6, v7)
>> ```
>> and to use index notation `v[k]` instead of `vk` to use the variables.
>> ```
>> sage: v[0]
>> v0
>> sage: v[7]
>> v7
>> ```
>>
>> That does not assign the variables to the names `v0` to `v7`:
>> ```
>> sage: v2
>> Traceback (most recent call last)=
>> ...
>> NameError: name 'v2' is not defined
>> ```
>>
>> If you really want to use `v0` to `v7` instead of `v[0]` to `v[7]`,
>> follow the implementation in `var` (accessed with `var??`),
>> which simply amounts to:
>> ```
>> G = globals()
>> for vk in v:
>> G[repr(vk)] = vk
>> ```
>>
>> After that:
>> ```
>> sage: v2
>> v2
>> ```
>>
>

-- 
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/CANnG18_%2BFg%2B5xuwgJBN_-HH5UgGnmCwdz_3si10hgfv3HhU8tA%40mail.gmail.com.


Re: [sage-support] Re: 2 questions on var

2022-03-06 Thread G. M.-S.
I mean, the implementation of top-level var, of course.

On Sun, 6 Mar 2022 at 23:35, G. M.-S.  wrote:

>
> Thanks, Nils.
>
> A further question is thus how to do something like
> v0,...,v*k*=SR.var('v', n=*k*)
> when *k* varies.
>
> Should I look at the implementation of SR.var?
>
> Guillermo
>
> On Sun, 6 Mar 2022 at 19:26, Nils Bruin  wrote:
>
>> On Sunday, 6 March 2022 at 09:13:42 UTC-8 list...@gmail.com wrote:
>>
>>>
>>> Beginner's questions, I guess.
>>>
>>> Some time ago, Emmanuel Charpentier wrote
>>>
>>> var("v", n=2)
>>>
>>> which gives
>>>
>>> (v0, v1)
>>>
>>> Where is this documented?  I have been unable to find keywords for var
>>> other than domain and latex_name.  Are there any others?
>>>
>>
>> This is documented on SR.var , which is slightly different from the
>> top-level "var" you are referring to. It looks like the documentation on
>> the top-level one wasn't updated when the feature was added to SR.var.
>> Since top-level var just wraps SR.var, it automatically got the feature too.
>>
>>
>>> Another question:
>>> I have learnt to write
>>> x,y,z=var('x,y,z')
>>>
>>
>> You can do that, but with the top-level var it's not necessary (this is
>> exactly where it differs from SR.var) :
>> it will inject bindings for the created symbols in the current name
>> space. This is a hack that is convenient for interactive use. In library
>> code, you must use SR.var instead, in which case you have to write
>>
>> x,y,z = SR.var('x,y,z')
>>
>> ( with just "SR.var('x,y,z')" you'd create the symbols but you wouldn't
>> bind them to anything).
>>
>> Is it possible to do the same for
>>> v0,v1,v2=var('v', n=3)
>>> without having to write explicitly the LHS?
>>>
>>
>> Yes, that already works. If you use
>>
>> var('v', n=3)
>>
>> the names v0,v1,v2 in your current scope will be bound to the newly
>> created symbols.
>>
>> There's been discussion about this when it was implemented:
>>
>> https://trac.sagemath.org/ticket/22813
>>
>
>

-- 
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/CANnG18-qtiW4%3DYxC2RQznLt1g%2BYEa6VvQhu8byt3aiifsbWtsg%40mail.gmail.com.


Re: [sage-support] Re: 2 questions on var

2022-03-06 Thread G. M.-S.
Thanks, Nils.

A further question is thus how to do something like
v0,...,v*k*=SR.var('v', n=*k*)
when *k* varies.

Should I look at the implementation of SR.var?

Guillermo

On Sun, 6 Mar 2022 at 19:26, Nils Bruin  wrote:

> On Sunday, 6 March 2022 at 09:13:42 UTC-8 list...@gmail.com wrote:
>
>>
>> Beginner's questions, I guess.
>>
>> Some time ago, Emmanuel Charpentier wrote
>>
>> var("v", n=2)
>>
>> which gives
>>
>> (v0, v1)
>>
>> Where is this documented?  I have been unable to find keywords for var
>> other than domain and latex_name.  Are there any others?
>>
>
> This is documented on SR.var , which is slightly different from the
> top-level "var" you are referring to. It looks like the documentation on
> the top-level one wasn't updated when the feature was added to SR.var.
> Since top-level var just wraps SR.var, it automatically got the feature too.
>
>
>> Another question:
>> I have learnt to write
>> x,y,z=var('x,y,z')
>>
>
> You can do that, but with the top-level var it's not necessary (this is
> exactly where it differs from SR.var) :
> it will inject bindings for the created symbols in the current name space.
> This is a hack that is convenient for interactive use. In library code, you
> must use SR.var instead, in which case you have to write
>
> x,y,z = SR.var('x,y,z')
>
> ( with just "SR.var('x,y,z')" you'd create the symbols but you wouldn't
> bind them to anything).
>
> Is it possible to do the same for
>> v0,v1,v2=var('v', n=3)
>> without having to write explicitly the LHS?
>>
>
> Yes, that already works. If you use
>
> var('v', n=3)
>
> the names v0,v1,v2 in your current scope will be bound to the newly
> created symbols.
>
> There's been discussion about this when it was implemented:
>
> https://trac.sagemath.org/ticket/22813
>

-- 
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/CANnG18_zOP4UAiywXz-UbN4ok0Hwc2PMb9VoGuk64X%2BowZdUdQ%40mail.gmail.com.


[sage-support] 2 questions on var

2022-03-06 Thread G. M.-S.
Beginner's questions, I guess.

Some time ago, Emmanuel Charpentier wrote

var("v", n=2)

which gives

(v0, v1)

Where is this documented?  I have been unable to find keywords for var
other than domain and latex_name.  Are there any others?

Another question:
I have learnt to write
x,y,z=var('x,y,z')

Is it possible to do the same for
v0,v1,v2=var('v', n=3)
without having to write explicitly the LHS?

Guillermo

-- 
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/CANnG18_qXCuCFVDihusDFA7X43bBhM8WZoq0rOwqd8H9%3D2Dwbg%40mail.gmail.com.


Re: [sage-support] Re: SageMath on Microsoft Windows

2022-02-27 Thread G. M.-S.
Thanks Dima.

However, this is for students to get SageMath on their PCs working quickly,
so I think we will install SageMath 9.3 for the time being (they are not
very savvy).

Guillermo

On Sun, 27 Feb 2022 at 16:05, Dima Pasechnik  wrote:

>
> On Sun, 27 Feb 2022, 14:37 G. M.-S.,  wrote:
>
>>
>> Thanks, Samuel.
>>
>> I think it is a pity there is nothing more straightforward…
>>
>> But you will tell me (to look for somebody) to do it.
>>
>
> some Linux distributions have pretty much up to date Sage binary packages.
>
> E.g. archlinux has Sage 9.5. Thus, having it installed as WSL2 (cf
> https://gist.github.com/ld100/3376435a4bb62ca0906b0cff9de4f94b) should be
> getting you Sage 9.5 quite quickly.
>
> Guillermo
>>
>> On Sun, 27 Feb 2022 at 15:28, slelievre 
>> wrote:
>>
>>> The Cygwin-based Sage-Windows installer has not been released
>>> for SageMath 9.4 or SageMath 9.5 yet.
>>>
>>> To get the latest version of Sage running on Windows, one option
>>> is to activate Windows Subsystem for Linux (also known as WSL),
>>> select WSL2, and install any Linux distribution there, then follow
>>> the Linux installation guide.
>>>
>>

-- 
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/CANnG189CiOcWn%3D10VgXnuv%2B14sarFPxS9ZY21HsR2oD0-B%2BAFQ%40mail.gmail.com.


Re: [sage-support] Re: SageMath on Microsoft Windows

2022-02-27 Thread G. M.-S.
Thanks, Samuel.

I think it is a pity there is nothing more straightforward…

But you will tell me (to look for somebody) to do it.

Guillermo

On Sun, 27 Feb 2022 at 15:28, slelievre  wrote:

> The Cygwin-based Sage-Windows installer has not been released
> for SageMath 9.4 or SageMath 9.5 yet.
>
> To get the latest version of Sage running on Windows, one option
> is to activate Windows Subsystem for Linux (also known as WSL),
> select WSL2, and install any Linux distribution there, then follow
> the Linux installation guide.
>

-- 
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/CANnG188whX6fJTbj1qdPvB-rdeNVm3H_mNmpC3mohE%2B7tM9rMw%40mail.gmail.com.


[sage-support] SageMath on Microsoft Windows

2022-02-27 Thread G. M.-S.
What is the recommended way to install SageMath on Microsoft Windows?

In
https://www.sagemath.org/download-windows.html
it says to go to
https://github.com/sagemath/sage-windows/releases
where I only see
SageMath 9.3 (Windows installer 0.6.3)

Guillermo

-- 
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/CANnG18-3vdJKM1MH-0EwFQsVHXuQuz%3DUW3_%3DU8nFQyhfKMXKOA%40mail.gmail.com.


[sage-support] Re: defining a binary operation

2022-01-12 Thread G. M.-S.
I have found that modifying

local/lib/python3.9/site-packages/sage/sets/set.py
by adding in
class Set_add_sub_operators:
the lines
def _mul_(self, X):
"""
Return the intersection of ``self`` and ``X``.
"""
return self.intersection(X)
works, but this is temporary and I am not sure it is the right way.

I am aware of the overloading in real_set.py, but it seems they are
compatible?

Help welcome.

On Thu, 13 Jan 2022 at 03:08, G. M.-S.  wrote:

>
> Sorry, I just noticed that A+B works.
>
> What about intersections? A*B does not seem to be implemented.
>
> On Thu, 13 Jan 2022 at 03:05, G. M.-S.  wrote:
>
>>
>> Hello.
>>
>> Is it possible to define a binary operation ∪ such that
>> A ∪ B
>> gives
>> A.union(B)
>> with the latter taking care of all problems (not a Set, etc.)?
>>
>> And if so, would it be possible to have an n-ary operation (n > 1) such
>> that for instance
>> A ∪ B ∪ C
>> gives
>> A.union(B).union(C)
>> without having to write (A ∪ B) ∪ C ?
>>
>> Guillermo
>>
>
>

-- 
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/CANnG189-%3DoVP0H26CJUP69CQt3%2BhhiU4SwWmW51BqH%3DaXHrV4w%40mail.gmail.com.


[sage-support] Re: defining a binary operation

2022-01-12 Thread G. M.-S.
Sorry, I just noticed that A+B works.

What about intersections? A*B does not seem to be implemented.

On Thu, 13 Jan 2022 at 03:05, G. M.-S.  wrote:

>
> Hello.
>
> Is it possible to define a binary operation ∪ such that
> A ∪ B
> gives
> A.union(B)
> with the latter taking care of all problems (not a Set, etc.)?
>
> And if so, would it be possible to have an n-ary operation (n > 1) such
> that for instance
> A ∪ B ∪ C
> gives
> A.union(B).union(C)
> without having to write (A ∪ B) ∪ C ?
>
> Guillermo
>

-- 
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/CANnG18_Y8E1B8hgSRnB2Xv_vtr%2BjWspG-J546CwH4_CFeNTbvQ%40mail.gmail.com.


[sage-support] defining a binary operation

2022-01-12 Thread G. M.-S.
Hello.

Is it possible to define a binary operation ∪ such that
A ∪ B
gives
A.union(B)
with the latter taking care of all problems (not a Set, etc.)?

And if so, would it be possible to have an n-ary operation (n > 1) such
that for instance
A ∪ B ∪ C
gives
A.union(B).union(C)
without having to write (A ∪ B) ∪ C ?

Guillermo

-- 
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/CANnG1888y49%2BYkMmu3n5Qp%2BNvbfnNKCk42kuf1AdDWOYFzhqpA%40mail.gmail.com.


[sage-support] SageMath: new macOS app not working on Big Sur

2021-03-31 Thread G. M.-S.
FWIW, I have opened an issue about the new SageMath-9-2.app:

https://github.com/3-manifolds/Sage_macOS/issues/1

Guillermo

-- 
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/CANnG1880-h_8zfmdKiy8EMK11933mk1eM4NPw0uz%3DY%2BWLwz1yA%40mail.gmail.com.


Re: [sage-support] Re: SageMath on macOS

2021-03-07 Thread G. M.-S.
Perfect!

This command gave me a file I was able to modify.

Thanks,

Guillermo

On Sun, 7 Mar 2021 at 23:12, julian...@gmail.com 
wrote:

> Hi Guillermo,
>
> On Sunday, March 7, 2021 at 10:40:30 PM UTC+1 list...@gmail.com wrote:
> > Do you happen to know if one can configure a default directory?
>
> `sage -n --generate-config` creates a configuration file. I think you can
> set the default directory in this configuration file. This is regular
> Jupyter configuration, so it should be easy to find documentation on it.
>
> julian
>

-- 
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/CANnG18_Rdk1nQe-TDUX-naHpNmYE-z82uDAjbCwZXMAx-Dfykw%40mail.gmail.com.


Re: [sage-support] Re: SageMath on macOS

2021-03-07 Thread G. M.-S.
Thanks, Julian.  I forgot about using the recursive help option…

Do you happen to know if one can configure a default directory?

(It is true I also can create an alias.)

Guillermo

On Sun, 7 Mar 2021 at 22:30, julian...@gmail.com 
wrote:

> Hi Guillermo,
>
> sage -n --help prints this for me
>
> > [...]
> > * Run Jupyter notebook in custom directory:
> >sage --notebook=jupyter --notebook-dir=/home/foo/bar
> > [...]
>
> Is this what you are looking for?
>
> julian
>
> On Sunday, March 7, 2021 at 10:11:05 PM UTC+1 list...@gmail.com wrote:
>
>>
>> Hi Dima.
>>
>> I am trying to follow your advice, using conda to install SageMath on
>> macOS (mainly to help others doing it), and I have one question:
>>
>> How do I tell the new "sage -n" where to look for my jupyter notebooks?
>>
>> Presently, it shows me
>> ~
>> whereas all my .ipynb files are in
>> ~/Documents/SageMath
>>
>> I am aware this is surely not a SageMath question at all, but I have been
>> unable to find an answer.
>>
>> TIA,
>>
>> Guillermo
>>
>> On Fri, 5 Feb 2021 at 00:25, Dima Pasechnik  wrote:
>>
>>> use conda to install SageMath on macOS.
>>>
>>

-- 
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/CANnG188oZXcWbwrdmQjOyGzqLy_x6%3DO221eVf62mWAd8teVKVQ%40mail.gmail.com.


[sage-support] SageMath on macOS

2021-03-07 Thread G. M.-S.
Hi Dima.

I am trying to follow your advice, using conda to install SageMath on macOS
(mainly to help others doing it), and I have one question:

How do I tell the new "sage -n" where to look for my jupyter notebooks?

Presently, it shows me
~
whereas all my .ipynb files are in
~/Documents/SageMath

I am aware this is surely not a SageMath question at all, but I have been
unable to find an answer.

TIA,

Guillermo

On Fri, 5 Feb 2021 at 00:25, Dima Pasechnik  wrote:

> use conda to install SageMath on macOS.
>

-- 
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/CANnG188079YcWpk%3DFN9O5spkP%3DGCSmt%2BMY6phZiOLmRCBSRyZg%40mail.gmail.com.


Re: [sage-support] Calling Words in a function gives an error

2021-01-27 Thread G. M.-S.
So if I understand you well, "x in P" should not be used for serious work?

Guillermo

On Wed, 27 Jan 2021 at 08:55, Vincent Delecroix <20100.delecr...@gmail.com>
wrote:

> Oups, I forgot to copy all the relevant input
>
> sage: a = 1.
>
> Vincent
>
> Le 26/01/2021 à 19:38, G. M.-S. a écrit :
> > Just out of curiosity:  What is "a"?
> >
> > Guillermo
> >
> > On Tue, 26 Jan 2021 at 09:29, Vincent Delecroix <
> 20100.delecr...@gmail.com>
> > wrote:
> >>
> >> And what should be thought about "4.0 in ZZ" ?
> >>
> >> Even more fun
> >>
> >> sage: a in ZZ
> >> False
> >> sage: 4 / a in ZZ
> >> False
> >> sage: 4.0 / a in ZZ
> >> True
> >>
> >> Does Sage even have any clear specification for "x in P"?
> >>
> >> Concerning input that are of the wrong type, it is common
> >> in Python (?) to just throw error
> >>
> >>   >>> list(range(4))
> >> [0, 1, 2, 3]
> >>   >>> list(range(4.0))
> >> Traceback (most recent call last):
> >> ...
> >> TypeError: 'float' object cannot be interpreted as an integer
> >>
> >> Vincent
>

-- 
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/CANnG18-sN3eDaAbVufpa4Eyss_xdaUXxZ6-2hzGEpsXy8O1nvQ%40mail.gmail.com.


Re: [sage-support] Calling Words in a function gives an error

2021-01-26 Thread G. M.-S.
Just out of curiosity:  What is "a"?

Guillermo

On Tue, 26 Jan 2021 at 09:29, Vincent Delecroix <20100.delecr...@gmail.com>
wrote:

>
> And what should be thought about "4.0 in ZZ" ?
>
> Even more fun
>
> sage: a in ZZ
> False
> sage: 4 / a in ZZ
> False
> sage: 4.0 / a in ZZ
> True
>
> Does Sage even have any clear specification for "x in P"?
>
> Concerning input that are of the wrong type, it is common
> in Python (?) to just throw error
>
>  >>> list(range(4))
> [0, 1, 2, 3]
>  >>> list(range(4.0))
> Traceback (most recent call last):
> ...
> TypeError: 'float' object cannot be interpreted as an integer
>
> Vincent
>

-- 
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/CANnG18_hXZ%3Dcr088zKc1%2Bez3GpQ7yb%3DVGC8U14v1rWpkbk_q2w%40mail.gmail.com.


Re: [sage-support] Re: Install of sage on macOS

2020-12-03 Thread G. M.-S.
Hi Dima.

As you said, "brew install sage" does nothing more than downloading a
sage-*.app.dmg and copying it to /Applications, at least on an older OS.

Details follow for macOS High Sierra (10.13.6).  Yes, I know it is an
"obsolete" version.

$ brew info sage

sage: 9.1,10.11.6

https://www.sagemath.org/

Not installed

From: https://github.com/Homebrew/homebrew-cask/blob/HEAD/Casks/sage.rb

==> *Name*

Sage

==> *Description*

None

==> *Artifacts*

SageMath-9.1.app (App)

/Applications/SageMath-9.1.app/Contents/Resources/sage/sage (Binary)

==> *Analytics*

install: 261 (30 days), 529 (90 days), 1,740 (365 days)

$

One can see in the file
https://github.com/Homebrew/homebrew-cask/blob/HEAD/Casks/sage.rb
that it downloads
https://mirrors.mit.edu/sage/osx/intel/sage-9.1-OSX_10.11.6-x86_64.app.dmg
or
https://mirrors.mit.edu/sage/osx/intel/sage-9.2-OSX_10.15.7-x86_64.app.dmg
(which will not work for recent OS).

I tried to install it:

$ brew install sage

[…]


==> *Downloading
https://mirrors.mit.edu/sage/osx/intel/sage-9.1-OSX_10.11.6-x86_64.app.dmg
*


100.0%

==> *Installing Cask **sage*

==> *Creating Caskroom at /usr/local/Caskroom*

==> *We'll set permissions properly so we won't need sudo in the future.*

Password:

==> *Moving App 'SageMath-9.1.app' to '/Applications/SageMath-9.1.app'.*

==> *Linking Binary 'sage' to '/usr/local/bin/sage'.*

  sage was successfully installed!

$

But it is quarantined:

$ ls -al@ /Applications/SageMath-9.1.app

total 0

drwxr-xr-x@   4 128 May 23  2020 .

com.apple.quarantine   67

drwxr-xr-x@   6 192 May 23  2020 Contents

com.apple.quarantine   67

lrwxr-xr-x@   1  28 Dec  4 01:39 sage -> Contents/Resources/sage/sage

com.apple.quarantine   67

$

and you get the classical

*“SageMath-9.1.app” can’t be opened because the identity of the developer
cannot be confirmed.*

Opening it anyway, it is exactly the same as downloading the .app.dmg
yourself (which I had already done).

I do not know if Homebrew does something more on a more recent OS.

Guillermo

P.S. After some trial and error, I have managed to
install sage-9.2-OSX_10.15.7-x86_64.app.dmg on macOS 10.13.6, but I would
be unable to say what made it work.

On Fri, 4 Dec 2020 at 01:08, Dima Pasechnik  wrote:

> On Thu, Dec 3, 2020 at 5:39 PM Mathieu Dutour 
> wrote:
> >
> > Thank you for providing this. Keep that in mind for future.
> >
> > As it turns out, the solution to installing was incredibly simple:
> > "brew install sage"
>
> dima@oucl13243 sage % brew install sage
> ==> Searching for similarly named formulae...
> This similarly named formula was found:
> imessage-ruby
> To install it, run:
>   brew install imessage-ruby
> Error: No available formula or cask with the name "sage".
> ==> Searching for a previously deleted formula (in the last month)...
> Error: No previously deleted formula found.
> ==> Searching taps on GitHub...
> Error: No formulae found in taps.
>
> dima@oucl13243 sage % brew install --cask sage
> Error: Cask 'sage' is unavailable: No Cask with this name exists.
>
> > I think this should be mentioned on the "Sage Installation Guide"
> > as this is a very convenient and standard procedure on Macintosh.
> >
> doesn't even install for me, see above.
>
> > Your mention of "sudo xattr ..." should be mentioned as well
> > I think.
> >
> >   Mathieu
> > On Thursday, 3 December 2020 at 18:10:12 UTC+1 john_perry_usm wrote:
> >>
> >> Have you tried this?
> >>
> >>sudo xattr -r -d com.apple.quarantine 
> >>
> >> It removes the "quarantine" signal on files. I used it to get Sage
> running on Catalina. I've had to use this with some other things, too. I
> learned of it through one of the StackOverflow sites, and it may also be in
> Sage's documentation somewhere.
> >>
> >> john perry
> >>
> >> On Wednesday, December 2, 2020 at 12:54:29 PM UTC-6 Mathieu Dutour
> wrote:
> >>>
> >>> I would like to install SAGE on a macOS MacBook Pro16 computer.
> >>>
> >>> The problem I have is that Sage is killed when trying to install it
> >>> by the system. The reasons is laudable: Do not run untrusted binaries
> >>> on a macintosh.
> >>>
> >>> But in that case, it makes installation kind of impossible. The reason
> >>> is that the first binary to be allowed on "Security & Privacy" is
> Python3.8
> >>> If the story stopped here, then that would be perfectly fine. However,
> after
> >>> I allow the Python3.8 I have further libraries to allow and it does
> not appear
> >>> to converge as I keep allowing the same libraries over and over.
> >>>
> >>> I tried two ways of installing:
> >>> 1) Downloading the .tar.bz2 and installing it in my $HOME/opt directory
> >>> just as I do on Linux.
> >>> 2) Downloading the .dmg archive and installing sage in /Application
> directory.
> >>> I would have expected that it worked since /Application is a root
> directory
> >>> 

Re: [sage-support] Re: factorial

2020-11-29 Thread G. M.-S.
Hi Nils.

I agree with you, but at the same time I wonder what would be wrong with
replacing
'!' → '.factorial()'

Best regards,

Guillermo

On Sun, 29 Nov 2020 at 22:02, Nils Bruin  wrote:

> With the current regexp-based rewriting we'd need a pattern of the kind
> '!' -> 'factorial( are doing an operator substitution already '^' -> '**" but that's very
> basic and doesn't need any context. To change an implicit unary postfix
> operator to an explicitly parenthesized prefix operator need almost
> complete parsing. Had the factorial been explicitly parenthesized as well,
> it would be a little easier, since now you could do it with parenthesis
> counting -- still not regex territory, but possibly reasonably efficiently
> done if one concentrates on the case where the expected string before the !
> is short.
>
> Insisting on parens does not satisfy the people who'd request this, I
> imagine. Writing (5)! instead of 5! doesn't really do the trick.
>
> I consider this weird postfix notation as a peculiarity that works
> somewhat OK in written math but, just as implicit multiplication, as bad in
> CAS use. So I'm not in favour of it. I estimate that the number of
> arguments against it is at least 3!
>
> On Sunday, November 29, 2020 at 5:32:30 AM UTC-8 Simon King wrote:
>
>> On 2020-11-29, Simon King  wrote:
>> > Hi Emmanuel,
>> >
>> > On 2020-10-28, Emmanuel Charpentier  wrote:
>> >> Nope. This syntactic sugar is provided by `Maxima`'s and
>> `Mathematica`'s
>> >> readers, but not by Sage preparser.
>> >
>> > Would it be nice (and easy) to have in Sage? What prevents the
>> preparser
>> > from understanding "!"?
>>
>> To be more precise: If I understand correctly, the preparser can be made
>> to accept any syntax, provided that this syntax is in no conflict with
>> valid Python syntax.
>>
>> There is a special meaning of "?" and "??" in Python, but I think there
>> isn't a special meaning to "!". Sage accepts "!" at the beginning of a
>> line, meaning that it executes a shell command, such as
>> sage: !ls
>> But it should be possible that the preparser could turn "(expression)!"
>> into
>> "gamma(expression+1)".
>>
>> Do people agree? Unfortunately I do not volonteer to implement it, I'
>> not familiar with the innards of the preparser.
>>
>> Best regards,
>> Simon
>>
>> --
> 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/0f70ad8a-bf21-4352-a863-0b8d596e509cn%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/CANnG18_HN6QkQWFEjVzmF20bH2veMwHFiadt9WHwK6bP%3DbaqoA%40mail.gmail.com.


[sage-support] ticks on the right

2020-10-22 Thread G. M.-S.
I am plotting a function between -9500 and 0 (included), using the standard
*plot* function:

[image: C14a.png]

So I would like to have the ticks of the vertical axis on the right instead
of on the left.

The "best" I have been able to get is this:

[image: C14b.png]

by plotting between -9500 and -187 (for -186 it does the same as before).

But this is not very elegant.

I do not know if *matplotlib* has an option for this, and in that case, how
to tell SageMath to use it (I have been unable to access *tick_params*()).

I do not include any code, as I think it is irrelevant to the question.

Guillermo

-- 
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/CANnG18_A9BaDLENi47DD%3DgSv6ZPp01kFLoo0gpcrLS%3DR%3DQ2U0w%40mail.gmail.com.


Re: [sage-support] Re: Sorting a list of variables

2019-04-22 Thread G. M.-S.
It works with strings:

sage: natsorted(a,key=*lambda* z:str(z))

[x8, x9, x10, x11]

Thank you to all of you for your help.

On Mon, 22 Apr 2019 at 22:56, G. M.-S.  wrote:

>
> So I got the tarball and it got installed but complaining still about SSL
> (why?):
>
> $ ./sage --pip install /src/natsort-6.0.0.tar.gz
>
> pip is configured with locations that require TLS/SSL, however the ssl
> module in Python is not available.
>
> Processing /src/natsort-6.0.0.tar.gz
>
> Installing collected packages: natsort
>
>   Running setup.py install for natsort ... done
>
> Successfully installed natsort-6.0.0
>
> pip is configured with locations that require TLS/SSL, however the ssl
> module in Python is not available.
>
> Could not fetch URL https://pypi.org/simple/pip/: There was a problem
> confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org',
> port=443): Max retries exceeded with url: /simple/pip/ (Caused by
> SSLError("Can't connect to HTTPS URL because the SSL module is not
> available.",)) - skipping
>
> $
>
> Then I tried natsorted, but it does not work:
>
> ┌┐
>
> │ SageMath version 8.7, Release Date: 2019-03-23 │
>
> │ Using Python 2.7.15. Type "help()" for help.   │
>
> └┘
>
> sage: *from* *natsort* *import* natsorted
>
> sage: var('x10,x8,x11,x9')
>
> (x10, x8, x11, x9)
>
> sage: natsorted([x10,x8,x11,x9])
>
> [x10, x8, x11, x9]
>
> sage: x = SR.var('x', *20*)
>
> sage: a = [x[*11*], x[*8*], x[*10*], x[*9*]]
>
> sage: a
>
> [x11, x8, x10, x9]
>
> sage: natsorted(a)
>
> [x11, x8, x10, x9]
>
> sage:
>
> Am I doing something wrong?
>
> On Mon, 22 Apr 2019 at 22:10, slelievre  wrote:
>
>> Mon 2019-04-22 19:23:32 UTC, John H Palmieri:
>> >
>> > Alternatively, you should be able to download
>> > a tar.gz file from https://pypi.org/project/natsort/#files, and then do
>> >
>> > ./sage --pip install /path/to/natsort-6.0.0.tar.gz
>>
>> Thanks for the reminder! I often forget one can download
>> the tarball oneself and then "pip install" the downloaded
>> tarball, allowing "pip installation" with a Python whose
>> openssl module is missing.
>>
>

-- 
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: Sorting a list of variables

2019-04-22 Thread G. M.-S.
So I got the tarball and it got installed but complaining still about SSL
(why?):

$ ./sage --pip install /src/natsort-6.0.0.tar.gz

pip is configured with locations that require TLS/SSL, however the ssl
module in Python is not available.

Processing /src/natsort-6.0.0.tar.gz

Installing collected packages: natsort

  Running setup.py install for natsort ... done

Successfully installed natsort-6.0.0

pip is configured with locations that require TLS/SSL, however the ssl
module in Python is not available.

Could not fetch URL https://pypi.org/simple/pip/: There was a problem
confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org',
port=443): Max retries exceeded with url: /simple/pip/ (Caused by
SSLError("Can't connect to HTTPS URL because the SSL module is not
available.",)) - skipping

$

Then I tried natsorted, but it does not work:

┌┐

│ SageMath version 8.7, Release Date: 2019-03-23 │

│ Using Python 2.7.15. Type "help()" for help.   │

└┘

sage: *from* *natsort* *import* natsorted

sage: var('x10,x8,x11,x9')

(x10, x8, x11, x9)

sage: natsorted([x10,x8,x11,x9])

[x10, x8, x11, x9]

sage: x = SR.var('x', *20*)

sage: a = [x[*11*], x[*8*], x[*10*], x[*9*]]

sage: a

[x11, x8, x10, x9]

sage: natsorted(a)

[x11, x8, x10, x9]

sage:

Am I doing something wrong?

On Mon, 22 Apr 2019 at 22:10, slelievre  wrote:

> Mon 2019-04-22 19:23:32 UTC, John H Palmieri:
> >
> > Alternatively, you should be able to download
> > a tar.gz file from https://pypi.org/project/natsort/#files, and then do
> >
> > ./sage --pip install /path/to/natsort-6.0.0.tar.gz
>
> Thanks for the reminder! I often forget one can download
> the tarball oneself and then "pip install" the downloaded
> tarball, allowing "pip installation" with a Python whose
> openssl module is missing.
>

-- 
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: Sorting a list of variables

2019-04-22 Thread G. M.-S.
Thank you, Dima.

This does not work for me. I get

$ ./sage --pip install natsort

pip is configured with locations that require TLS/SSL, however the ssl
module in Python is not available.

I think I have to install openssl first.  I shall give it a try later.

Guillermo

On Mon, 22 Apr 2019 at 11:02, Dima Pasechnik  wrote:

> On Sun, Apr 21, 2019 at 11:36 PM G. M.-S.  wrote:
> >
> >
> > Thank you very much, Nils.
> >
> > As I have a list of variables, I changed it to
> >
> > sorted(L, key=lambda v: (str(v)[:1],int(str(v)[1:])))
> >
> > Another question:  How can I get natsort?
> > from natsort import natsorted
> > gives
> > ImportError: No module named natsort
>
> install it using pip; quit Sage and run (in Sage's root directory):
>
> ./sage --pip install natsort
>
> now this works:
> ./sage
> ...
>
> sage: from natsort import natsorted
> sage: a = ['2 ft 7 in', '1 ft 5 in', '10 ft 2 in', '2 ft 11 in', '7 ft 6
> in']
> sage: natsorted(a)
> ['1 ft 5 in', '2 ft 7 in', '2 ft 11 in', '7 ft 6 in', '10 ft 2 in']
> sage:
>
> > On Sun, 21 Apr 2019 at 23:59, Nils Bruin  wrote:
> >>
> >> sorted(L, key=lambda v: (v[:1],int(v[1:])))
> >>
> >> would do the trick. In general, you could look at something like
> https://pypi.org/project/natsort/. It might be able to make a more
> natural sortkey in more examples (in general, the idea would be to split
> your string in alphabetic and numerical substrings and make a tuple of
> strings and integers out of it and sort that).
>

-- 
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: Sorting a list of variables

2019-04-21 Thread G. M.-S.
Thank you very much, Nils.

As I have a list of variables, I changed it to

sorted(L, key=lambda v: (str(v)[:1],int(str(v)[1:])))

Another question:  How can I get natsort?
from natsort import natsorted
gives
ImportError: No module named natsort

On Sun, 21 Apr 2019 at 23:59, Nils Bruin  wrote:

> sorted(L, key=lambda v: (v[:1],int(v[1:])))
>
> would do the trick. In general, you could look at something like
> https://pypi.org/project/natsort/. It might be able to make a more
> natural sortkey in more examples (in general, the idea would be to split
> your string in alphabetic and numerical substrings and make a tuple of
> strings and integers out of it and sort that).
>

-- 
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] Sorting a list of variables

2019-04-21 Thread G. M.-S.
Hello.

I would like to sort a list like
[x11,x8,x10,x9]
so as to get
[x8,x9,x10,x11]

This does not work, of course:
sorted([x11,x8,x10,x9],key=repr)
as it gives
[x10,x11,x8,x9]

Any ideas? Thanks in advance.

Guillermo

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