Re: [sage-devel] Re: Is there a math alternative to range and interval?

2018-10-18 Thread Kwankyu Lee
On Friday, October 19, 2018 at 10:16:28 AM UTC+9, William wrote: > > > > (4) is this "range" the vanilla python built-in? > > Yes. Type "range??" in Sage to see. > Right. I didn't know that range first converts the argument to int, which is why "range(Integer(10))" works. By the way, I am h

[sage-devel] Re: Piecewise affine functions

2018-10-18 Thread Matthias Koeppe
Xavier, For code for piecewise linear functions of several variables, see here: https://github.com/mkoeppe/cutgeneratingfunctionology/blob/master/piecewise_functions.sage I'd be quite interested in getting something like this into sage. There's no ticket for this yet. Also, you might be intere

Re: [sage-devel] Re: Is there a math alternative to range and interval?

2018-10-18 Thread William Stein
On Thu, Oct 18, 2018 at 5:58 PM Kwankyu Lee wrote: > (2) interval should be redefined to give a list of Integers. Do you agree? I wouldn't change it, because that code that depends on how it works will break. And having a 1-year deprecation policy for this would be very ugly. Also, it doesn't s

[sage-devel] Re: Is there a math alternative to range and interval?

2018-10-18 Thread Kwankyu Lee
Thanks for your inputs. Let me summarize: ellipsis notation: gives a list of Integers sage: [0..9] [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] sage: preparse('[0..9]') '(ellipsis_range(Integer(0),Ellipsis,Integer(9)))' sage: type([0..9].pop()) ZZ.range: gives a list of integers sage: ZZ.range(10) [0, 1, 2

[sage-devel] Piecewise affine functions

2018-10-18 Thread Xavier Caruso
Hello, For some application I have in mind (related to ticket #26471 for those who are interested), I need to have support for piecewise affine functions in Sage. More precisely, what I mostly need is: . to add, compose, take the sup/inf of these functions . to check continuity, convexity, bijec

[sage-devel] Re: no conversion between number fields (extensions) over base rings which have conversion

2018-10-18 Thread Nils Bruin
On Thursday, October 18, 2018 at 11:55:14 AM UTC-7, Simon Brandhorst wrote: > I would say because there is no canonically defined embedding as one can > send i to -i as well. > > That's in principle true, but in sage names of generators carry essential information. For instance: sage: parent(QQ

[sage-devel] Re: no conversion between number fields (extensions) over base rings which have conversion

2018-10-18 Thread Simon Brandhorst
I would say because there is no canonically defined embedding as one can send i to -i as well. On Thursday, October 18, 2018 at 1:38:24 PM UTC+2, Daniel Krenn wrote: > > sage: CyclotomicField(3).extension(x^2+1, 'i')(QQ.extension(x^2+1, > 'i').gen()) > > returns > > TypeError: Cannot coerce el

Re: [sage-devel] Is there a math alternative to range and interval?

2018-10-18 Thread Dima Pasechnik
IMHO the concept of type is mathematical enough to be mentioned early on, otherwise they'll continue to be confused by the difference between floats, ints, rationals, etc etc. So this is a very instructive for students kind of error you have hit. On Thu, 18 Oct 2018, 13:10 Kwankyu Lee, wrote: >

[sage-devel] Re: Is there a math alternative to range and interval?

2018-10-18 Thread Eric Gourgoulhon
Le jeudi 18 octobre 2018 14:13:33 UTC+2, Simon King a écrit : > > > Such as srange(i,j)? > > Btw, I've just noticed that in Python3-built Sage 8.4.rc1, srange returns a list. Shouldn't it return an iterator instead? Eric. -- You received this message because you are subscribed to the Google G

[sage-devel] Re: Is there a math alternative to range and interval?

2018-10-18 Thread Eric Gourgoulhon
Hi, An alternative to Simon's answer is sage: [i.is_prime() for i in [1..9]] [False, True, True, False, True, False, True, False, False] Best wishes, Eric. -- You received this message because you are subscribed to the Google Groups "sage-devel" group. To unsubscribe from this group and sto

[sage-devel] Re: Is there a math alternative to range and interval?

2018-10-18 Thread Simon King
Hi Kwankyu, On 2018-10-18, Kwankyu Lee wrote: > I am teaching sage to a class of first year math students. Today I was > embarrassed when I tried > > [i.is_prime() for i in range(1,10)] > > because this raises an error. Until this point, I deliberately did not > mention that there are in fact

[sage-devel] Is there a math alternative to range and interval?

2018-10-18 Thread Kwankyu Lee
Hi, I am teaching sage to a class of first year math students. Today I was embarrassed when I tried [i.is_prime() for i in range(1,10)] because this raises an error. Until this point, I deliberately did not mention that there are in fact two kinds of "integers" in sage and avoided to explain

[sage-devel] no conversion between number fields (extensions) over base rings which have conversion

2018-10-18 Thread Daniel Krenn
sage: CyclotomicField(3).extension(x^2+1, 'i')(QQ.extension(x^2+1, 'i').gen()) returns TypeError: Cannot coerce element into this number field Does anyone have some idea why this is not working? (This is https://trac.sagemath.org/ticket/26443) Best, Daniel -- You received this message becaus