Re: [sage-devel] Speed question re the sigma function

2016-11-15 Thread Vincent Delecroix
On 15 November 2016 at 21:44, Jori Mäntysalo  wrote:
> On Tue, 15 Nov 2016, John H Palmieri wrote:
>
>> Also, should we switch to a naive implementation of sigma: essentially
>> just
>> return sum(divisors(n))?
>
>
> The answer to questions like this is always the same, I guess:
>
> Add string-valued parameter 'algorithm' with None as default. For None use
> some kind of heuristic to guess what will be the fastest way.

I do not think so. "divisors" use the same "factor" function. If the
command "sum(divisors(n))" takes less time there is a problem with
"prod" or the arithmetic operations involved.

Though for numbers like 2^30 it is easy to guess which one will be the fastet.

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-devel] why chrome kiosk mode in sage appliance??

2016-11-15 Thread William Stein
On Tue, Nov 15, 2016 at 2:35 PM, Dima Pasechnik  wrote:
>
>
> On Tuesday, November 15, 2016 at 9:35:23 PM UTC, William wrote:
>>
>> On Tue, Nov 15, 2016 at 1:18 PM, Dima Pasechnik  wrote:
>> > as
>> > https://docs.docker.com/docker-for-windows/#download-docker-for-windows
>> > says:
>> > "Docker for Windows requires 64bit Windows 10 Pro, Enterprise and
>> > Education
>> > (1511 November update, Build 10586 or later) and Microsoft Hyper-V."
>> > So this looks like we are SOL with Docker as the primary way to provide
>> > Sage
>> > on Windows...
>>
>> I don't know anything about the current Windows install ecosystem
>> among our target audience.  On what basis do you conclude that a very
>> substantial fraction don't have the ability to run Docker?
>
>
> Well, go to something like dell.com and see for yourself.
> A standard Windows edition sold with budget laptops is not Professional, it
> is Home.
> (and still Windows 8.1 is available, and people choose it for a variety of
> reasons)

OK, you win.  And it costs $100 to upgrade, evidently.Forget my
remarks about Docker for windows. It's clear Docker has very much
become mainly a developer tool -- at least on Windows  -- not a
software delivery system.   Oh well.

William

>
>
>
>>
>>
>> ** Hey Stan Schymanski ** does your student have the ability to run
>> Docker?
>> https://docs.docker.com/docker-for-windows/
>>
>> William
>>
>> --
>> William (http://wstein.org)
>
> --
> You received this message because you are subscribed to the Google Groups
> "sage-devel" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to sage-devel+unsubscr...@googlegroups.com.
> To post to this group, send email to sage-devel@googlegroups.com.
> Visit this group at https://groups.google.com/group/sage-devel.
> For more options, visit https://groups.google.com/d/optout.



-- 
William (http://wstein.org)

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-devel] why chrome kiosk mode in sage appliance??

2016-11-15 Thread Dima Pasechnik


On Tuesday, November 15, 2016 at 9:35:23 PM UTC, William wrote:
>
> On Tue, Nov 15, 2016 at 1:18 PM, Dima Pasechnik  > wrote: 
> > as 
> https://docs.docker.com/docker-for-windows/#download-docker-for-windows 
> > says: 
> > "Docker for Windows requires 64bit Windows 10 Pro, Enterprise and 
> Education 
> > (1511 November update, Build 10586 or later) and Microsoft Hyper-V." 
> > So this looks like we are SOL with Docker as the primary way to provide 
> Sage 
> > on Windows... 
>
> I don't know anything about the current Windows install ecosystem 
> among our target audience.  On what basis do you conclude that a very 
> substantial fraction don't have the ability to run Docker? 
>

Well, go to something like dell.com and see for yourself.
A standard Windows edition sold with budget laptops is not Professional, it 
is Home.
(and still Windows 8.1 is available, and people choose it for a variety of 
reasons)


 

>
> ** Hey Stan Schymanski ** does your student have the ability to run 
> Docker? 
> https://docs.docker.com/docker-for-windows/ 
>
> William 
>
> -- 
> William (http://wstein.org) 
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


[sage-devel] run doctests of a single function

2016-11-15 Thread Franco Saliola
Hello,

I'm wondering whether there is a way to run the doctests of a single
function. Something like this:

def f():
r"""
sage: f()
42
"""
return 41

run_doctests(f)


(Note: there is a command called run_doctests, which runs all tests in a
file / module, which I find very useful; thanks!)

I see at least two advantages of such a function:

1. It can help with development.

2. Users who like working in a notebook can write doctests to test their
code.

Thanks,

Franco

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-devel] why chrome kiosk mode in sage appliance??

2016-11-15 Thread William Stein
On Tue, Nov 15, 2016 at 1:18 PM, Dima Pasechnik  wrote:
> as https://docs.docker.com/docker-for-windows/#download-docker-for-windows
> says:
> "Docker for Windows requires 64bit Windows 10 Pro, Enterprise and Education
> (1511 November update, Build 10586 or later) and Microsoft Hyper-V."
> So this looks like we are SOL with Docker as the primary way to provide Sage
> on Windows...

I don't know anything about the current Windows install ecosystem
among our target audience.  On what basis do you conclude that a very
substantial fraction don't have the ability to run Docker?

** Hey Stan Schymanski ** does your student have the ability to run Docker?
https://docs.docker.com/docker-for-windows/

William

-- 
William (http://wstein.org)

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-devel] why chrome kiosk mode in sage appliance??

2016-11-15 Thread Dima Pasechnik


On Tuesday, November 15, 2016 at 5:10:40 PM UTC, William wrote:
>
>
>
> On Tuesday, November 15, 2016, Dima Pasechnik  > wrote:
>
>>
>>
>> On Tuesday, November 15, 2016 at 2:29:30 PM UTC, Erik Bray wrote:
>>>
>>> On Mon, Nov 14, 2016 at 6:43 PM, William Stein  
>>> wrote: 
>>> > On Mon, Nov 14, 2016 at 8:40 AM, Erik Bray  
>>> wrote: 
>>> >> On Mon, Nov 14, 2016 at 4:49 PM, William Stein  
>>> wrote: 
>>> >>> On Mon, Nov 14, 2016 at 6:21 AM, Stan  wrote: 
>>>  Dear all, 
>>>  
>>>  A student of mine has been using SMC because the sage appliance in 
>>>  virtualbox did not appear very useful with the jupyter notebook. 
>>> Now that he 
>>>  encountered a critical bug in SMC (reported offline), he is back 
>>> with the 
>>> >>> 
>>> >>> I'm not aware of this bug.  I don't know of any critical bugs in 
>>> SMC. 
>>> >>> There are exactly 22 known SMC *bugs*, which you can see listed 
>>> here, 
>>> >>> all of which we plan to fix ASAP: 
>>> >>> 
>>> >>>
>>> https://github.com/sagemathinc/smc/issues?utf8=%E2%9C%93=is%3Aissue%20is%3Aopen%20label%3AI-bug%20sort%3Acreated-asc%20-label%3Ablocked
>>>  
>>> >>> 
>>> >>> On can also use SMC via docker on Windows, Linux and OS X, as 
>>> explained here: 
>>> >>> 
>>> >>>   
>>> https://github.com/sagemathinc/smc/blob/master/src/dev/docker/README.md 
>>> >>> 
>>> >>> I wish I could recommend the official sagemath docker images, but it 
>>> >>> looks like they haven't been updated in 6 months to 1 year ago? 
>>> (What 
>>> >>> the heck?) 
>>> >>> 
>>> >>>https://hub.docker.com/u/sagemath/ 
>>> >> 
>>> >> 
>>> >> I'm not sure where you're looking-- 
>>> > 
>>> > 
>>> > Click on the link above.  I clicked on sagemath/sage since it is ON 
>>> > TOP (hence what you find with a typical google search), and it has 
>>> > vastly more downloads than all other docker Sage images put together. 
>>> > It's clearly the one people are getting for some reason. 
>>> > 
>>> > I then clicked on the sagemath-jupyter one, since -- based on the name 
>>> > -- I imagine that's the other reasonable choice if a person wants a 
>>> > web interface... and it is 6 months old. 
>>> > 
>>> > Clicking on all of them now, only sagemath/sagemath has been updated 
>>> > recently.  All others are out of date. 
>>> > 
>>> >> the image called sagemath/sage is 
>>> >> definitely deprecated and should be removed. 
>>> > 
>>> > OK.   Who has the power to do that?  Also, I wonder what is driving so 
>>> > much traffic there? 
>>>
>>> Please see https://github.com/sagemath/docker/issues/4 
>>> 
>>>  
>>>
>>> I don't know what's driving so much traffic there, but I need to find 
>>> a way to *clearly* deprecate it without breaking things for whoever it 
>>> is that's relying on it. 
>>
>>
>> Oh dear. It seems that the barrier to posting "official" docker images
>> is way too low.
>> There is also swenson/sage, dieudonne/sage, gissehel/sagemath, 
>> xuyouwen/sagemath,
>> and probably many more sagemath docker images over there, some old, some 
>> not...
>>
>> Probably the best way for the time being just post the "latest" image 
>> with 7.4
>> to sagemath/sage (previous images would still available via tags, IMHO)
>> so that it is in sync with sagemath/sagemath.
>>
>>  
>>
>>>  Anyways, the docker containers really should 
>>> be preferred over the VM.  Forcing people on Windows to use a VM is 
>>> terrible.  I tried to push on this a few months ago but it either 
>>> wasn't ready or nobody listened. 
>>>
>>
>> The main problem with using VM is setting it properly. AFAIK on Windows 
>> you still have VM
>> in the play, so you basically provide something that is meant to work 
>> better, right?
>>
>
> I don't know exactly the situation with docket + windows, but Docker on OS 
> X uses a very lightweight hypervisor and automatically forwards networks 
> and makes OS X host paths available.  It's pretty damn amazing, and it's 
> also very new - just out of beta!   They do something very similar for 
> Windows. 
>

as https://docs.docker.com/docker-for-windows/#download-docker-for-windows 
says: 
"Docker for Windows requires 64bit Windows 10 Pro, Enterprise and Education 
(1511 November update, Build 10586 or later) and Microsoft Hyper-V."
So this looks like we are SOL with Docker as the primary way to provide 
Sage on Windows...




 

>  
>
>>
>> How about we do some more testing of the sagemath/sagemath image, in 
>> particular
>> on Windows and OSX, and then (if we're happy) advertise it on 
>> sagemath.org
>> and elsewhere?
>>
>> Dima
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "sage-devel" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to 

Re: [sage-devel] Speed question re the sigma function

2016-11-15 Thread Jori Mäntysalo

On Tue, 15 Nov 2016, John H Palmieri wrote:


Also, should we switch to a naive implementation of sigma: essentially just
return sum(divisors(n))?


The answer to questions like this is always the same, I guess:

Add string-valued parameter 'algorithm' with None as default. For None use 
some kind of heuristic to guess what will be the fastest way.


--
Jori Mäntysalo


Re: [sage-devel] Speed question re the sigma function

2016-11-15 Thread Vincent Delecroix
I guess that it would be much better to also propose access to

1) the flint function

void fmpz_divisor_sigma ( fmpz_t res , const fmpz_t n , ulong k )

2) the pari function sigma

For example, pari timing is competitive in this range

$ sage -c "timeit('L = [sigma(n) for n in range(10**13, 10**13 + 5)]',
number=1, repeat=1)"
1 loops, best of 1: 3.47 ms per loop
$ sage -c "timeit('L = [pari(n).sigma() for n in range(10**13, 10**13
+ 5)]', number=1, repeat=1)"
1 loops, best of 1: 688 µs per loop

Vincent

On 15 November 2016 at 21:01, William Stein  wrote:
> On Tue, Nov 15, 2016 at 11:47 AM, John H Palmieri
>  wrote:
>> Inspired by the ask.sagemath question
>> https://ask.sagemath.org/question/35587/why-sigman-seems-not-so-performant-for-small-n/,
>> I started looking at timings for the sigma function (sigma(n) = sum of the
>> divisors of n, sigma(n, k) = sum of the kth powers of the divisors of n). On
>> my computer, a naive implementation of sigma is faster than what we have in
>> Sage for small values of n. When n is between 10^13 and 10^14, Sage's
>> implementation of sigma speeds up: it is much faster to compute
>> sigma(10**14) than sigma(10**13):
>>
>> $ sage -c "timeit('L = [sigma(n) for n in range(10**13, 10**13 + 5)]',
>> number=1, repeat=1)"
>> 1 loops, best of 1: 2.4 ms per loop
>> $ sage -c "timeit('L = [sigma(n) for n in range(10**14, 10**14 + 5)]',
>> number=1, repeat=1)"
>> 1 loops, best of 1: 607 µs per loop
>>
>> (I used "sage -c ..." and timeit with a single loop in case results were
>> being cached.)
>>
>> Any ideas why? Can we speed it up for smaller values?
>
> Idea -- try
>
> proof.all(False)
>
> That may be relevant to whether factoring is also proving correctness or not.
>
>  -- William
>>
>> Also, should we switch to a naive implementation of sigma: essentially just
>> return sum(divisors(n))? I think the main difference between the current
>> version and the naive one is that the current version uses "factor(n)"
>> instead of "divisors(n)", and I think both of those functors just call Pari.
>> Has Pari's implementation of "divisors" improved lately, especially as
>> compared to "factor"? (By "lately" I may mean since 2007, which may have
>> been when sigma was last changed.)
>>
>> --
>> John
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "sage-devel" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to sage-devel+unsubscr...@googlegroups.com.
>> To post to this group, send email to sage-devel@googlegroups.com.
>> Visit this group at https://groups.google.com/group/sage-devel.
>> For more options, visit https://groups.google.com/d/optout.
>
>
>
> --
> William (http://wstein.org)
>
> --
> You received this message because you are subscribed to the Google Groups 
> "sage-devel" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to sage-devel+unsubscr...@googlegroups.com.
> To post to this group, send email to sage-devel@googlegroups.com.
> Visit this group at https://groups.google.com/group/sage-devel.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-devel] Speed question re the sigma function

2016-11-15 Thread William Stein
On Tue, Nov 15, 2016 at 11:47 AM, John H Palmieri
 wrote:
> Inspired by the ask.sagemath question
> https://ask.sagemath.org/question/35587/why-sigman-seems-not-so-performant-for-small-n/,
> I started looking at timings for the sigma function (sigma(n) = sum of the
> divisors of n, sigma(n, k) = sum of the kth powers of the divisors of n). On
> my computer, a naive implementation of sigma is faster than what we have in
> Sage for small values of n. When n is between 10^13 and 10^14, Sage's
> implementation of sigma speeds up: it is much faster to compute
> sigma(10**14) than sigma(10**13):
>
> $ sage -c "timeit('L = [sigma(n) for n in range(10**13, 10**13 + 5)]',
> number=1, repeat=1)"
> 1 loops, best of 1: 2.4 ms per loop
> $ sage -c "timeit('L = [sigma(n) for n in range(10**14, 10**14 + 5)]',
> number=1, repeat=1)"
> 1 loops, best of 1: 607 µs per loop
>
> (I used "sage -c ..." and timeit with a single loop in case results were
> being cached.)
>
> Any ideas why? Can we speed it up for smaller values?

Idea -- try

proof.all(False)

That may be relevant to whether factoring is also proving correctness or not.

 -- William
>
> Also, should we switch to a naive implementation of sigma: essentially just
> return sum(divisors(n))? I think the main difference between the current
> version and the naive one is that the current version uses "factor(n)"
> instead of "divisors(n)", and I think both of those functors just call Pari.
> Has Pari's implementation of "divisors" improved lately, especially as
> compared to "factor"? (By "lately" I may mean since 2007, which may have
> been when sigma was last changed.)
>
> --
> John
>
> --
> You received this message because you are subscribed to the Google Groups
> "sage-devel" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to sage-devel+unsubscr...@googlegroups.com.
> To post to this group, send email to sage-devel@googlegroups.com.
> Visit this group at https://groups.google.com/group/sage-devel.
> For more options, visit https://groups.google.com/d/optout.



-- 
William (http://wstein.org)

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


[sage-devel] Speed question re the sigma function

2016-11-15 Thread John H Palmieri
Inspired by the ask.sagemath question 
https://ask.sagemath.org/question/35587/why-sigman-seems-not-so-performant-for-small-n/,
 
I started looking at timings for the sigma function (sigma(n) = sum of the 
divisors of n, sigma(n, k) = sum of the kth powers of the divisors of n). 
On my computer, a naive implementation of sigma is faster than what we have 
in Sage for small values of n. When n is between 10^13 and 10^14, Sage's 
implementation of sigma speeds up: it is much faster to compute 
sigma(10**14) than sigma(10**13):

$ sage -c "timeit('L = [sigma(n) for n in range(10**13, 10**13 + 5)]', 
number=1, repeat=1)"
1 loops, best of 1: 2.4 ms per loop
$ sage -c "timeit('L = [sigma(n) for n in range(10**14, 10**14 + 5)]', 
number=1, repeat=1)"
1 loops, best of 1: 607 µs per loop

(I used "sage -c ..." and timeit with a single loop in case results were 
being cached.)

Any ideas why? Can we speed it up for smaller values?

Also, should we switch to a naive implementation of sigma: essentially just 
return sum(divisors(n))? I think the main difference between the current 
version and the naive one is that the current version uses "factor(n)" 
instead of "divisors(n)", and I think both of those functors just call 
Pari. Has Pari's implementation of "divisors" improved lately, especially 
as compared to "factor"? (By "lately" I may mean since 2007, which may have 
been when sigma was last changed.)

-- 
John

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


[sage-devel] Re: Errors from importing abs

2016-11-15 Thread Nils Bruin
On Monday, November 14, 2016 at 10:49:56 PM UTC-8, Ralf Stephan wrote:
>
>
> so it seems the Python abs can be overridden. 
>

Yes, abs is not a keyword. It's just a name that's by default bound to 
__builtin__.abs . However, given that python's "abs" gives access to a 
protocol that allows custom behaviour, there is no need to override "abs".

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-devel] why chrome kiosk mode in sage appliance??

2016-11-15 Thread William Stein
On Tuesday, November 15, 2016, Dima Pasechnik  wrote:

>
>
> On Tuesday, November 15, 2016 at 2:29:30 PM UTC, Erik Bray wrote:
>>
>> On Mon, Nov 14, 2016 at 6:43 PM, William Stein  wrote:
>> > On Mon, Nov 14, 2016 at 8:40 AM, Erik Bray  wrote:
>> >> On Mon, Nov 14, 2016 at 4:49 PM, William Stein 
>> wrote:
>> >>> On Mon, Nov 14, 2016 at 6:21 AM, Stan  wrote:
>>  Dear all,
>> 
>>  A student of mine has been using SMC because the sage appliance in
>>  virtualbox did not appear very useful with the jupyter notebook. Now
>> that he
>>  encountered a critical bug in SMC (reported offline), he is back
>> with the
>> >>>
>> >>> I'm not aware of this bug.  I don't know of any critical bugs in SMC.
>> >>> There are exactly 22 known SMC *bugs*, which you can see listed here,
>> >>> all of which we plan to fix ASAP:
>> >>>
>> >>>https://github.com/sagemathinc/smc/issues?utf8=%E2%9C%93=
>> is%3Aissue%20is%3Aopen%20label%3AI-bug%20sort%3Acreat
>> ed-asc%20-label%3Ablocked
>> >>>
>> >>> On can also use SMC via docker on Windows, Linux and OS X, as
>> explained here:
>> >>>
>> >>>   https://github.com/sagemathinc/smc/blob/master/src/dev/
>> docker/README.md
>> >>>
>> >>> I wish I could recommend the official sagemath docker images, but it
>> >>> looks like they haven't been updated in 6 months to 1 year ago? (What
>> >>> the heck?)
>> >>>
>> >>>https://hub.docker.com/u/sagemath/
>> >>
>> >>
>> >> I'm not sure where you're looking--
>> >
>> >
>> > Click on the link above.  I clicked on sagemath/sage since it is ON
>> > TOP (hence what you find with a typical google search), and it has
>> > vastly more downloads than all other docker Sage images put together.
>> > It's clearly the one people are getting for some reason.
>> >
>> > I then clicked on the sagemath-jupyter one, since -- based on the name
>> > -- I imagine that's the other reasonable choice if a person wants a
>> > web interface... and it is 6 months old.
>> >
>> > Clicking on all of them now, only sagemath/sagemath has been updated
>> > recently.  All others are out of date.
>> >
>> >> the image called sagemath/sage is
>> >> definitely deprecated and should be removed.
>> >
>> > OK.   Who has the power to do that?  Also, I wonder what is driving so
>> > much traffic there?
>>
>> Please see https://github.com/sagemath/docker/issues/4
>> 
>>
>> I don't know what's driving so much traffic there, but I need to find
>> a way to *clearly* deprecate it without breaking things for whoever it
>> is that's relying on it.
>
>
> Oh dear. It seems that the barrier to posting "official" docker images
> is way too low.
> There is also swenson/sage, dieudonne/sage, gissehel/sagemath,
> xuyouwen/sagemath,
> and probably many more sagemath docker images over there, some old, some
> not...
>
> Probably the best way for the time being just post the "latest" image with
> 7.4
> to sagemath/sage (previous images would still available via tags, IMHO)
> so that it is in sync with sagemath/sagemath.
>
>
>
>>  Anyways, the docker containers really should
>> be preferred over the VM.  Forcing people on Windows to use a VM is
>> terrible.  I tried to push on this a few months ago but it either
>> wasn't ready or nobody listened.
>>
>
> The main problem with using VM is setting it properly. AFAIK on Windows
> you still have VM
> in the play, so you basically provide something that is meant to work
> better, right?
>

I don't know exactly the situation with docket + windows, but Docker on OS
X uses a very lightweight hypervisor and automatically forwards networks
and makes OS X host paths available.  It's pretty damn amazing, and it's
also very new - just out of beta!   They do something very similar for
Windows.


>
> How about we do some more testing of the sagemath/sagemath image, in
> particular
> on Windows and OSX, and then (if we're happy) advertise it on sagemath.org
> and elsewhere?
>
> Dima
>
> --
> You received this message because you are subscribed to the Google Groups
> "sage-devel" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to sage-devel+unsubscr...@googlegroups.com
> 
> .
> To post to this group, send email to sage-devel@googlegroups.com
> .
> Visit this group at https://groups.google.com/group/sage-devel.
> For more options, visit https://groups.google.com/d/optout.
>


-- 
Sent from my massive iPhone 6 plus.

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this 

Re: [sage-devel] why chrome kiosk mode in sage appliance??

2016-11-15 Thread Dima Pasechnik


On Tuesday, November 15, 2016 at 2:29:30 PM UTC, Erik Bray wrote:
>
> On Mon, Nov 14, 2016 at 6:43 PM, William Stein  > wrote: 
> > On Mon, Nov 14, 2016 at 8:40 AM, Erik Bray  > wrote: 
> >> On Mon, Nov 14, 2016 at 4:49 PM, William Stein  > wrote: 
> >>> On Mon, Nov 14, 2016 at 6:21 AM, Stan  
> wrote: 
>  Dear all, 
>  
>  A student of mine has been using SMC because the sage appliance in 
>  virtualbox did not appear very useful with the jupyter notebook. Now 
> that he 
>  encountered a critical bug in SMC (reported offline), he is back with 
> the 
> >>> 
> >>> I'm not aware of this bug.  I don't know of any critical bugs in SMC. 
> >>> There are exactly 22 known SMC *bugs*, which you can see listed here, 
> >>> all of which we plan to fix ASAP: 
> >>> 
> >>>
> https://github.com/sagemathinc/smc/issues?utf8=%E2%9C%93=is%3Aissue%20is%3Aopen%20label%3AI-bug%20sort%3Acreated-asc%20-label%3Ablocked
>  
> >>> 
> >>> On can also use SMC via docker on Windows, Linux and OS X, as 
> explained here: 
> >>> 
> >>>   
> https://github.com/sagemathinc/smc/blob/master/src/dev/docker/README.md 
> >>> 
> >>> I wish I could recommend the official sagemath docker images, but it 
> >>> looks like they haven't been updated in 6 months to 1 year ago? (What 
> >>> the heck?) 
> >>> 
> >>>https://hub.docker.com/u/sagemath/ 
> >> 
> >> 
> >> I'm not sure where you're looking-- 
> > 
> > 
> > Click on the link above.  I clicked on sagemath/sage since it is ON 
> > TOP (hence what you find with a typical google search), and it has 
> > vastly more downloads than all other docker Sage images put together. 
> > It's clearly the one people are getting for some reason. 
> > 
> > I then clicked on the sagemath-jupyter one, since -- based on the name 
> > -- I imagine that's the other reasonable choice if a person wants a 
> > web interface... and it is 6 months old. 
> > 
> > Clicking on all of them now, only sagemath/sagemath has been updated 
> > recently.  All others are out of date. 
> > 
> >> the image called sagemath/sage is 
> >> definitely deprecated and should be removed. 
> > 
> > OK.   Who has the power to do that?  Also, I wonder what is driving so 
> > much traffic there? 
>
> Please see https://github.com/sagemath/docker/issues/4 
> 
>  
>
> I don't know what's driving so much traffic there, but I need to find 
> a way to *clearly* deprecate it without breaking things for whoever it 
> is that's relying on it. 


Oh dear. It seems that the barrier to posting "official" docker images
is way too low.
There is also swenson/sage, dieudonne/sage, gissehel/sagemath, 
xuyouwen/sagemath,
and probably many more sagemath docker images over there, some old, some 
not...

Probably the best way for the time being just post the "latest" image with 
7.4
to sagemath/sage (previous images would still available via tags, IMHO)
so that it is in sync with sagemath/sagemath.

 

>  Anyways, the docker containers really should 
> be preferred over the VM.  Forcing people on Windows to use a VM is 
> terrible.  I tried to push on this a few months ago but it either 
> wasn't ready or nobody listened. 
>

The main problem with using VM is setting it properly. AFAIK on Windows you 
still have VM
in the play, so you basically provide something that is meant to work 
better, right?

How about we do some more testing of the sagemath/sagemath image, in 
particular
on Windows and OSX, and then (if we're happy) advertise it on sagemath.org
and elsewhere?

Dima

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


[sage-devel] Re: Building 7.4.beta5 after building 7.5 betas

2016-11-15 Thread Travis Scrimshaw


>  Or is the current recommendation to always merge develop after every new 
>>> beta?
>>>
>>
>> I think it's to use it sparingly. That the history from git log is 
>> gobbled is IMO a git bug.
>>
>> perhaps we need a policy that for a positive review of a ticket branch 
> things like merge commits must be 
> squashed out
>
> Strong -1. This creates extra needless barriers for people to contribute 
to Sage. How often do you really go through the git log to find stuff?

Best,
Travis


-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-devel] why chrome kiosk mode in sage appliance??

2016-11-15 Thread Erik Bray
On Mon, Nov 14, 2016 at 6:43 PM, William Stein  wrote:
> On Mon, Nov 14, 2016 at 8:40 AM, Erik Bray  wrote:
>> On Mon, Nov 14, 2016 at 4:49 PM, William Stein  wrote:
>>> On Mon, Nov 14, 2016 at 6:21 AM, Stan  wrote:
 Dear all,

 A student of mine has been using SMC because the sage appliance in
 virtualbox did not appear very useful with the jupyter notebook. Now that 
 he
 encountered a critical bug in SMC (reported offline), he is back with the
>>>
>>> I'm not aware of this bug.  I don't know of any critical bugs in SMC.
>>> There are exactly 22 known SMC *bugs*, which you can see listed here,
>>> all of which we plan to fix ASAP:
>>>
>>>
>>> https://github.com/sagemathinc/smc/issues?utf8=%E2%9C%93=is%3Aissue%20is%3Aopen%20label%3AI-bug%20sort%3Acreated-asc%20-label%3Ablocked
>>>
>>> On can also use SMC via docker on Windows, Linux and OS X, as explained 
>>> here:
>>>
>>>   https://github.com/sagemathinc/smc/blob/master/src/dev/docker/README.md
>>>
>>> I wish I could recommend the official sagemath docker images, but it
>>> looks like they haven't been updated in 6 months to 1 year ago? (What
>>> the heck?)
>>>
>>>https://hub.docker.com/u/sagemath/
>>
>>
>> I'm not sure where you're looking--
>
>
> Click on the link above.  I clicked on sagemath/sage since it is ON
> TOP (hence what you find with a typical google search), and it has
> vastly more downloads than all other docker Sage images put together.
> It's clearly the one people are getting for some reason.
>
> I then clicked on the sagemath-jupyter one, since -- based on the name
> -- I imagine that's the other reasonable choice if a person wants a
> web interface... and it is 6 months old.
>
> Clicking on all of them now, only sagemath/sagemath has been updated
> recently.  All others are out of date.
>
>> the image called sagemath/sage is
>> definitely deprecated and should be removed.
>
> OK.   Who has the power to do that?  Also, I wonder what is driving so
> much traffic there?

Please see https://github.com/sagemath/docker/issues/4

I don't know what's driving so much traffic there, but I need to find
a way to *clearly* deprecate it without breaking things for whoever it
is that's relying on it.  Anyways, the docker containers really should
be preferred over the VM.  Forcing people on Windows to use a VM is
terrible.  I tried to push on this a few months ago but it either
wasn't ready or nobody listened.

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-devel] RFC: correct way to deal with particular methods

2016-11-15 Thread Erik Bray
On Mon, Nov 14, 2016 at 10:48 PM, VulK  wrote:
> Dear All,
> sorry for the late reply and thank you very much for the input.
>
>
>
> As far as having methods not always defined the consensus here is leaning
> towards making sublcasses but I am quite reluctant to do that because of
> future things I want to implement. Down the road there are going to be many
> more methods that only make sense in certain cases and not in others.
> Unfortunately the cases are many so that I would have to implement lots of
> different classes. The sublclass approach is the OOP-clean way but it can be
> nightmarish to maintain if there are too many corner cases. This will be one
> such situation when everything is implemented.
>
> Johan's suggestion is very intriguing but, unless I am completely mistaken,
> it does not work in python. If I understand correctly if O is an instance of
> Foo and O does not have the attribute x then python looks for Foo().x

Right, though you could in principle invent some kind of special
method type that works this way, as a descriptor (for example,
classmethod() is basically just a special descriptor).  This would
probably be too confusing to be worth the effort though.

> At the moment it seems "better" (sigh) to define the methods anyway and
> raise an error in case they are meaningless. Any objection?

I think that's also good--better than most "magical" or unusual
choices.  You can still do manipulations on __dir__ at the
instance-level for what methods you want it to return.  Otherwise I
think there's some onus on a user to not go calling methods that exist
but don't make any sense (and thus raise NotImplementedError for some
particular instance).


> * Johan S. H. Rosenkilde  [2016-11-07 09:45:57]:
>
>
>> VulK writes:
>>>
>>> The first question is about which is the correct way to implement methods
>>> that are not always defined.
>>
>>
>> I agree with Nils that subclassing is the most OOP-clean way of
>> achieving this. That being said, one might argue that it is a pretty
>> heavy-handed solution which potentially leads to class-explosion and
>> mega-multiple-inheritance.
>>
>> Another possibility is to do the converse of what you are doing: add the
>> method on the class but *delete* at construction time if it is not
>> appropriate. This can be done using delattr.
>>
>> VulK writes:
>>>
>>> The second problem is a little more involved, I will try to give you a
>>> souped
>>> up version here.
>>> ...
>>
>>
>> Did you take a look at performing the preparsing using a decorator which
>> properly uses @sage_wraps? It is possible to do the documentation
>> modification at decoration-time, and then it should properly show up in
>> Sphinx as well.
>>
>> Best,
>> Johan
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "sage-devel" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to sage-devel+unsubscr...@googlegroups.com.
>> To post to this group, send email to sage-devel@googlegroups.com.
>> Visit this group at https://groups.google.com/group/sage-devel.
>> For more options, visit https://groups.google.com/d/optout.
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "sage-devel" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to sage-devel+unsubscr...@googlegroups.com.
> To post to this group, send email to sage-devel@googlegroups.com.
> Visit this group at https://groups.google.com/group/sage-devel.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-devel] why chrome kiosk mode in sage appliance??

2016-11-15 Thread William Stein
I think this was actually a problem with autosave we had for about one
week.  Of course we didn't know that at the time.   I'm not sure why to
say, except the root problem is probably solved, and if not there is a
straightforward way to just use plain jupyter in SMC anyways.

On Tuesday, November 15, 2016, Stan  wrote:

> OK, I just asked Thomas to send me the email thread about his problem with
> SMC. His communication was with William Stein and Harald Schilly, and
> related to lost bits of a jupyter notebook that were not even recoverable
> using the revert button or the backup utility, plus bits started
> disappearing or re-arranging again. On 4 November, Harald replied to him
> with the following words: "Hi, this sounds like a real bug we have to fix.
> Getting a history and collaboration working with jupyter notebooks is not
> easy.", followed by a message by William Stein on the same day indicating
> that a fix would require a major rewrite of Jupyter, and suggesting a
> method to use standard Jupyter within SMC. Unfortunately, Thomas overlooked
> that suggestion and didn't try it out. Still, the problem of disappearing
> or re-arranged code cells within a worksheet reminds me of problems I used
> to have with sagews, but I haven't experienced them with jupyter so far. If
> this is a particular problem with jupyter notebooks within SMC, and if it
> re-occurs, perhaps this way of using jupyter should be discouraged in
> favour of using pure jupyter or jupyter kernels within Sage worksheets. If
> instructions are available how to do this, I'd be happy to try it out.
>
> Cheers
> Stan
>
> On Monday, November 14, 2016 at 4:49:50 PM UTC+1, William wrote:
>>
>> On Mon, Nov 14, 2016 at 6:21 AM, Stan  wrote:
>> > Dear all,
>> >
>> > A student of mine has been using SMC because the sage appliance in
>> > virtualbox did not appear very useful with the jupyter notebook. Now
>> that he
>> > encountered a critical bug in SMC (reported offline), he is back with
>> the
>>
>> I'm not aware of this bug.  I don't know of any critical bugs in SMC.
>> There are exactly 22 known SMC *bugs*, which you can see listed here,
>> all of which we plan to fix ASAP:
>>
>>https://github.com/sagemathinc/smc/issues?utf8=%E2%9C%93=
>> is%3Aissue%20is%3Aopen%20label%3AI-bug%20sort%3Acreat
>> ed-asc%20-label%3Ablocked
>>
>> On can also use SMC via docker on Windows, Linux and OS X, as explained
>> here:
>>
>>   https://github.com/sagemathinc/smc/blob/master/src/dev/docker/README.md
>>
>> I wish I could recommend the official sagemath docker images, but it
>> looks like they haven't been updated in 6 months to 1 year ago? (What
>> the heck?)
>>
>>https://hub.docker.com/u/sagemath/
>>
>>
>> William
>>
>> > sage appliance in VB but it is truly a nightmare. The installation
>> > instructions are still specific for sagews, not jupyter, but we at
>> least
>> > managed to change the working directory to something he can access.
>> What we
>> > haven't managed, is to get out of the kiosk mode in chrome. There is no
>> > obvious possibility of opening several tabs, no address bar to get back
>> to
>> > the directory page and no back button. This means that every time he
>> wants
>> > to go back, e.g. after downloading the worksheet, he has to restart the
>> > virtual machine! I don't understand why chrome was chosen instead of
>> > firefox, and I have no idea why it is set up in kiosk mode. Is there
>> any
>> > sensible way to productively work with the sage appliance using the now
>> > standard jupyter notebook?? I'm sorry if my frustration shows in these
>> > lines, I probably should have asked earlier, but I am wondering a bit
>> if
>> > those that created the sage appliance actually use it themselves. I
>> don't,
>> > which is why it never occurred to me how difficult to use it might be.
>> > Thanks for your help!
>> >
>> > Cheers
>> > Stan
>> >
>> > --
>> > You received this message because you are subscribed to the Google
>> Groups
>> > "sage-devel" group.
>> > To unsubscribe from this group and stop receiving emails from it, send
>> an
>> > email to sage-devel+...@googlegroups.com.
>> > To post to this group, send email to sage-...@googlegroups.com.
>> > Visit this group at https://groups.google.com/group/sage-devel.
>> > For more options, visit https://groups.google.com/d/optout.
>>
>>
>>
>> --
>> William (http://wstein.org)
>>
> --
> You received this message because you are subscribed to the Google Groups
> "sage-devel" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to sage-devel+unsubscr...@googlegroups.com
> 
> .
> To post to this group, send email to sage-devel@googlegroups.com
> .
> Visit this group at https://groups.google.com/group/sage-devel.
> For more options, visit https://groups.google.com/d/optout.

[sage-devel] Re: why chrome kiosk mode in sage appliance??

2016-11-15 Thread Dima Pasechnik


On Tuesday, November 15, 2016 at 11:32:11 AM UTC, Stan wrote:
>
> You mean to start the VM (sage is started within the VM automatically), 
> ssh into it, shut down sage and restart with the options I want? Not sure 
> how to ssh into the VM, 
>
Yes; even better, modify .xinitrc not to start Sage at all... Then, see
Section 8 in
https://wiki.sagemath.org/SageAppliance/Sage-5-x-or-6-x
on how to ssh an don what port.



but I'll play again with the .xinitrc.
>
>
 

>
> On Tuesday, November 15, 2016 at 11:11:39 AM UTC+1, Dima Pasechnik wrote:
>>
>>
>>
>> On Tuesday, November 15, 2016 at 9:52:02 AM UTC, Stan wrote:
>>>
>>> Thanks, Volker. I just installed the VB image on my linux laptop and I 
>>> can access the jupyter notebook through my local firefox on 
>>> http://localhost:8000. So it seems to be a windows issue that Thomas 
>>> can't. Do you have an idea what dodgy windows programs could be the reason? 
>>> Antivirus? If you know of any way how to get around this, it would be 
>>> great. Thanks!
>>> The problem with File -> Close and Halt is that this option is not 
>>> available e.g. after downloading a jupyter file, as there is only the 
>>> download window left, without any menu commands. How would I have to edit 
>>> .xinitrc to get a full browser? We already removed the --kiosk option but 
>>> it didn't make a difference.
>>>
>>
>> I'd say that you can just ssh into VM and run Sage at shell prompt with 
>> whatever options you like.
>>  
>>
>>>
>>> Cheers
>>> Stan
>>>
>>> On Monday, November 14, 2016 at 9:50:59 PM UTC+1, Volker Braun wrote:

 The recommended (for power users) way to run the virtual machine is 
 using their host browser, just go to http://localhost:8000. This 
 requires a non-broken windows networking stack, though (and various dodgy 
 windows programs can interfere).

 In the kiosk mode you can still go back,e.g. open a notebook and then 
 File -> Close and Halt.

 If you really do want a full browser inside the VM (with a virtualbox 
 menu on top) then you can edit ~/.xinitrc inside the vm.




 On Monday, November 14, 2016 at 3:21:32 PM UTC+1, Stan wrote:
>
> Dear all,
>
> A student of mine has been using SMC because the sage appliance in 
> virtualbox did not appear very useful with the jupyter notebook. Now that 
> he encountered a critical bug in SMC (reported offline), he is back with 
> the sage appliance in VB but it is truly a nightmare. The installation 
> instructions are still specific for sagews, not jupyter, but we at least 
> managed to change the working directory to something he can access. What 
> we 
> haven't managed, is to get out of the kiosk mode in chrome. There is no 
> obvious possibility of opening several tabs, no address bar to get back 
> to 
> the directory page and no back button. This means that every time he 
> wants 
> to go back, e.g. after downloading the worksheet, he has to restart the 
> virtual machine! I don't understand why chrome was chosen instead of 
> firefox, and I have no idea why it is set up in kiosk mode. Is there any 
> sensible way to productively work with the sage appliance using the now 
> standard jupyter notebook?? I'm sorry if my frustration shows in these 
> lines, I probably should have asked earlier, but I am wondering a bit if 
> those that created the sage appliance actually use it themselves. I 
> don't, 
> which is why it never occurred to me how difficult to use it might be. 
> Thanks for your help!
>
> Cheers
> Stan
>


-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


[sage-devel] Re: why chrome kiosk mode in sage appliance??

2016-11-15 Thread Stan
You mean to start the VM (sage is started within the VM automatically), ssh 
into it, shut down sage and restart with the options I want? Not sure how 
to ssh into the VM, but I'll play again with the .xinitrc.


On Tuesday, November 15, 2016 at 11:11:39 AM UTC+1, Dima Pasechnik wrote:
>
>
>
> On Tuesday, November 15, 2016 at 9:52:02 AM UTC, Stan wrote:
>>
>> Thanks, Volker. I just installed the VB image on my linux laptop and I 
>> can access the jupyter notebook through my local firefox on 
>> http://localhost:8000. So it seems to be a windows issue that Thomas 
>> can't. Do you have an idea what dodgy windows programs could be the reason? 
>> Antivirus? If you know of any way how to get around this, it would be 
>> great. Thanks!
>> The problem with File -> Close and Halt is that this option is not 
>> available e.g. after downloading a jupyter file, as there is only the 
>> download window left, without any menu commands. How would I have to edit 
>> .xinitrc to get a full browser? We already removed the --kiosk option but 
>> it didn't make a difference.
>>
>
> I'd say that you can just ssh into VM and run Sage at shell prompt with 
> whatever options you like.
>  
>
>>
>> Cheers
>> Stan
>>
>> On Monday, November 14, 2016 at 9:50:59 PM UTC+1, Volker Braun wrote:
>>>
>>> The recommended (for power users) way to run the virtual machine is 
>>> using their host browser, just go to http://localhost:8000. This 
>>> requires a non-broken windows networking stack, though (and various dodgy 
>>> windows programs can interfere).
>>>
>>> In the kiosk mode you can still go back,e.g. open a notebook and then 
>>> File -> Close and Halt.
>>>
>>> If you really do want a full browser inside the VM (with a virtualbox 
>>> menu on top) then you can edit ~/.xinitrc inside the vm.
>>>
>>>
>>>
>>>
>>> On Monday, November 14, 2016 at 3:21:32 PM UTC+1, Stan wrote:

 Dear all,

 A student of mine has been using SMC because the sage appliance in 
 virtualbox did not appear very useful with the jupyter notebook. Now that 
 he encountered a critical bug in SMC (reported offline), he is back with 
 the sage appliance in VB but it is truly a nightmare. The installation 
 instructions are still specific for sagews, not jupyter, but we at least 
 managed to change the working directory to something he can access. What 
 we 
 haven't managed, is to get out of the kiosk mode in chrome. There is no 
 obvious possibility of opening several tabs, no address bar to get back to 
 the directory page and no back button. This means that every time he wants 
 to go back, e.g. after downloading the worksheet, he has to restart the 
 virtual machine! I don't understand why chrome was chosen instead of 
 firefox, and I have no idea why it is set up in kiosk mode. Is there any 
 sensible way to productively work with the sage appliance using the now 
 standard jupyter notebook?? I'm sorry if my frustration shows in these 
 lines, I probably should have asked earlier, but I am wondering a bit if 
 those that created the sage appliance actually use it themselves. I don't, 
 which is why it never occurred to me how difficult to use it might be. 
 Thanks for your help!

 Cheers
 Stan

>>>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


[sage-devel] Re: "Tri bool"

2016-11-15 Thread Simon King
Hi Vincent,

On 2016-11-15, Vincent Delecroix <20100.delecr...@gmail.com> wrote:
> Indeed, __or__ is for the operator |. "or" can not be overridden.
>
> sage: class a(object):
> : def __or__(self, other):
> : return "hello"
> sage: a() or True
><__main__.a object at 0x7f2549683b50>
> sage: a() | True
> 'hello'

Ouch, too bad. Now I understand why there used to be a PEP: The intended
troolean logic can not be implemented in Python without changing the Python
interpreter.

But I don't see why "too much discussion" should be enough reason to kill
a PEP. After all, it isn't bike shedding but a non-trivial extension
with potentially useful applications.

Cheers,
Simon


-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-devel] Re: "Tri bool"

2016-11-15 Thread Vincent Delecroix
Hi Simon,

On 15 November 2016 at 11:44, Simon King  wrote:
> Hi Vincent,
>
> [...]
>
>> Python is using __nonzero__ to deal with these or/and/not operators.
>> This method __nonzero__ implicitly defines the conversion to booleans.
>> And Python sets
>>
>> x or y := x if bool(x) is True and y otherwise
>
> Is it not calling x.__or__(y), which could be overridden?

Indeed, __or__ is for the operator |. "or" can not be overridden.

sage: class a(object):
: def __or__(self, other):
: return "hello"
sage: a() or True
<__main__.a object at 0x7f2549683b50>
sage: a() | True
'hello'

Vincent

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


[sage-devel] Re: "Tri bool"

2016-11-15 Thread Simon King
Hi Vincent,

sorry for my previous post, as you discussed the example already.

On 2016-11-15, Vincent Delecroix <20100.delecr...@gmail.com> wrote:
> There is still a semantic problem to solve the following
>
> sage: Unknown or False
> False

No. Unknown or False is Unknown.

The shortcuts would be
False and x = False
True and x = x
True or x = True
False or x = x

Unfortunately I don't see a shortcut when the first item is Unknown, for
"and" resp. "or".

But there is a further shortcut for xor:
Unknown xor x = Unknown
The shortcut
False xor x = x
follows from the and/or shortcuts, hence, is not new.

I believe "True xor x = not x" is not a shortcut, since the result is
obtained from an *operation* applied to the second argument.

Hence, implementing a shortcut for __and__ determines all shortcuts needed
for bools, but you need to implement a shortcut in yet another method
(namely __xor__) to determine further shortcuts needed for trools.

> Python is using __nonzero__ to deal with these or/and/not operators.
> This method __nonzero__ implicitly defines the conversion to booleans.
> And Python sets
>
> x or y := x if bool(x) is True and y otherwise

Is it not calling x.__or__(y), which could be overridden?

> It might be changed to
>
> x or y :=
> x if trool(x) is True
> y if trool(x) is False
> x if trool(x) is Unknown and trool(y) is not True
> y if trool(x) is Unknown and trool(y) is True
>
> I guess it is what you called "shortcut". In this form it is a max
> operation with True -> 1, Unknown -> 1/2, False -> 0.

I guess a shortcut means: If the first argument is suitable, then
the value of the expression either is a constant (True/False/Unknown)
or is equal to the second argument. If you need to evaluate trool(y)
or not(y) to evaluate the expression, then it is not a shortcut, IMHO.

Cheers,
Simon


-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


[sage-devel] Re: "Tri bool"

2016-11-15 Thread Simon King
Hi Vincent,

On 2016-11-15, Vincent Delecroix <20100.delecr...@gmail.com> wrote:
>>> Perhaps was the proposal too greedy, so i wonder whether there would be a
>>> possibility to have a trool adding an Unknown to bool that does not
>>> perturb the speed when only True and False are used, and so that the
>>> "short-circuiting semantics" remains preserved.
>>
>> No way! In an expression such as
>>
>>   "True or whatever_function(x)"
>>
>> the "whatever_function(x)" is *not* evaluated...
>>
>> sage: def f(): print "hello"
>> sage: True or f()
>> True
>
> Though it would be doable with signatures of functions.
>
> def bool whatever_function()
>
> would avoid evaluation but
>
> def trool whatever_function()
>
> would do it. However, it is a drastic change that needs some kind of
> signature for functions.

Where is the problem? Obviously "True or Unknown" is True. Hence, in
"True or whatever_function(x)", it is not needed to evaluate the
function. Evaluation is only required in "False or whatever_function(x)"
(as it is now) and "Unknown or whatever_function(x)".

Cheers,
Simon

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-devel] why chrome kiosk mode in sage appliance??

2016-11-15 Thread Stan
OK, I just asked Thomas to send me the email thread about his problem with 
SMC. His communication was with William Stein and Harald Schilly, and 
related to lost bits of a jupyter notebook that were not even recoverable 
using the revert button or the backup utility, plus bits started 
disappearing or re-arranging again. On 4 November, Harald replied to him 
with the following words: "Hi, this sounds like a real bug we have to fix. 
Getting a history and collaboration working with jupyter notebooks is not 
easy.", followed by a message by William Stein on the same day indicating 
that a fix would require a major rewrite of Jupyter, and suggesting a 
method to use standard Jupyter within SMC. Unfortunately, Thomas overlooked 
that suggestion and didn't try it out. Still, the problem of disappearing 
or re-arranged code cells within a worksheet reminds me of problems I used 
to have with sagews, but I haven't experienced them with jupyter so far. If 
this is a particular problem with jupyter notebooks within SMC, and if it 
re-occurs, perhaps this way of using jupyter should be discouraged in 
favour of using pure jupyter or jupyter kernels within Sage worksheets. If 
instructions are available how to do this, I'd be happy to try it out.

Cheers
Stan

On Monday, November 14, 2016 at 4:49:50 PM UTC+1, William wrote:
>
> On Mon, Nov 14, 2016 at 6:21 AM, Stan  
> wrote: 
> > Dear all, 
> > 
> > A student of mine has been using SMC because the sage appliance in 
> > virtualbox did not appear very useful with the jupyter notebook. Now 
> that he 
> > encountered a critical bug in SMC (reported offline), he is back with 
> the 
>
> I'm not aware of this bug.  I don't know of any critical bugs in SMC. 
> There are exactly 22 known SMC *bugs*, which you can see listed here, 
> all of which we plan to fix ASAP: 
>
>
> https://github.com/sagemathinc/smc/issues?utf8=%E2%9C%93=is%3Aissue%20is%3Aopen%20label%3AI-bug%20sort%3Acreated-asc%20-label%3Ablocked
>  
>
> On can also use SMC via docker on Windows, Linux and OS X, as explained 
> here: 
>
>   https://github.com/sagemathinc/smc/blob/master/src/dev/docker/README.md 
>
> I wish I could recommend the official sagemath docker images, but it 
> looks like they haven't been updated in 6 months to 1 year ago? (What 
> the heck?) 
>
>https://hub.docker.com/u/sagemath/ 
>
>
> William 
>
> > sage appliance in VB but it is truly a nightmare. The installation 
> > instructions are still specific for sagews, not jupyter, but we at least 
> > managed to change the working directory to something he can access. What 
> we 
> > haven't managed, is to get out of the kiosk mode in chrome. There is no 
> > obvious possibility of opening several tabs, no address bar to get back 
> to 
> > the directory page and no back button. This means that every time he 
> wants 
> > to go back, e.g. after downloading the worksheet, he has to restart the 
> > virtual machine! I don't understand why chrome was chosen instead of 
> > firefox, and I have no idea why it is set up in kiosk mode. Is there any 
> > sensible way to productively work with the sage appliance using the now 
> > standard jupyter notebook?? I'm sorry if my frustration shows in these 
> > lines, I probably should have asked earlier, but I am wondering a bit if 
> > those that created the sage appliance actually use it themselves. I 
> don't, 
> > which is why it never occurred to me how difficult to use it might be. 
> > Thanks for your help! 
> > 
> > Cheers 
> > Stan 
> > 
> > -- 
> > You received this message because you are subscribed to the Google 
> Groups 
> > "sage-devel" group. 
> > To unsubscribe from this group and stop receiving emails from it, send 
> an 
> > email to sage-devel+...@googlegroups.com . 
> > To post to this group, send email to sage-...@googlegroups.com 
> . 
> > Visit this group at https://groups.google.com/group/sage-devel. 
> > For more options, visit https://groups.google.com/d/optout. 
>
>
>
> -- 
> William (http://wstein.org) 
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


[sage-devel] Re: why chrome kiosk mode in sage appliance??

2016-11-15 Thread Dima Pasechnik


On Tuesday, November 15, 2016 at 9:52:02 AM UTC, Stan wrote:
>
> Thanks, Volker. I just installed the VB image on my linux laptop and I can 
> access the jupyter notebook through my local firefox on 
> http://localhost:8000. So it seems to be a windows issue that Thomas 
> can't. Do you have an idea what dodgy windows programs could be the reason? 
> Antivirus? If you know of any way how to get around this, it would be 
> great. Thanks!
> The problem with File -> Close and Halt is that this option is not 
> available e.g. after downloading a jupyter file, as there is only the 
> download window left, without any menu commands. How would I have to edit 
> .xinitrc to get a full browser? We already removed the --kiosk option but 
> it didn't make a difference.
>

I'd say that you can just ssh into VM and run Sage at shell prompt with 
whatever options you like.
 

>
> Cheers
> Stan
>
> On Monday, November 14, 2016 at 9:50:59 PM UTC+1, Volker Braun wrote:
>>
>> The recommended (for power users) way to run the virtual machine is using 
>> their host browser, just go to http://localhost:8000. This requires a 
>> non-broken windows networking stack, though (and various dodgy windows 
>> programs can interfere).
>>
>> In the kiosk mode you can still go back,e.g. open a notebook and then 
>> File -> Close and Halt.
>>
>> If you really do want a full browser inside the VM (with a virtualbox 
>> menu on top) then you can edit ~/.xinitrc inside the vm.
>>
>>
>>
>>
>> On Monday, November 14, 2016 at 3:21:32 PM UTC+1, Stan wrote:
>>>
>>> Dear all,
>>>
>>> A student of mine has been using SMC because the sage appliance in 
>>> virtualbox did not appear very useful with the jupyter notebook. Now that 
>>> he encountered a critical bug in SMC (reported offline), he is back with 
>>> the sage appliance in VB but it is truly a nightmare. The installation 
>>> instructions are still specific for sagews, not jupyter, but we at least 
>>> managed to change the working directory to something he can access. What we 
>>> haven't managed, is to get out of the kiosk mode in chrome. There is no 
>>> obvious possibility of opening several tabs, no address bar to get back to 
>>> the directory page and no back button. This means that every time he wants 
>>> to go back, e.g. after downloading the worksheet, he has to restart the 
>>> virtual machine! I don't understand why chrome was chosen instead of 
>>> firefox, and I have no idea why it is set up in kiosk mode. Is there any 
>>> sensible way to productively work with the sage appliance using the now 
>>> standard jupyter notebook?? I'm sorry if my frustration shows in these 
>>> lines, I probably should have asked earlier, but I am wondering a bit if 
>>> those that created the sage appliance actually use it themselves. I don't, 
>>> which is why it never occurred to me how difficult to use it might be. 
>>> Thanks for your help!
>>>
>>> Cheers
>>> Stan
>>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


[sage-devel] Re: why chrome kiosk mode in sage appliance??

2016-11-15 Thread Stan
Thanks, Volker. I just installed the VB image on my linux laptop and I can 
access the jupyter notebook through my local firefox on 
http://localhost:8000. So it seems to be a windows issue that Thomas can't. 
Do you have an idea what dodgy windows programs could be the reason? 
Antivirus? If you know of any way how to get around this, it would be 
great. Thanks!
The problem with File -> Close and Halt is that this option is not 
available e.g. after downloading a jupyter file, as there is only the 
download window left, without any menu commands. How would I have to edit 
.xinitrc to get a full browser? We already removed the --kiosk option but 
it didn't make a difference.

Cheers
Stan

On Monday, November 14, 2016 at 9:50:59 PM UTC+1, Volker Braun wrote:
>
> The recommended (for power users) way to run the virtual machine is using 
> their host browser, just go to http://localhost:8000. This requires a 
> non-broken windows networking stack, though (and various dodgy windows 
> programs can interfere).
>
> In the kiosk mode you can still go back,e.g. open a notebook and then File 
> -> Close and Halt.
>
> If you really do want a full browser inside the VM (with a virtualbox menu 
> on top) then you can edit ~/.xinitrc inside the vm.
>
>
>
>
> On Monday, November 14, 2016 at 3:21:32 PM UTC+1, Stan wrote:
>>
>> Dear all,
>>
>> A student of mine has been using SMC because the sage appliance in 
>> virtualbox did not appear very useful with the jupyter notebook. Now that 
>> he encountered a critical bug in SMC (reported offline), he is back with 
>> the sage appliance in VB but it is truly a nightmare. The installation 
>> instructions are still specific for sagews, not jupyter, but we at least 
>> managed to change the working directory to something he can access. What we 
>> haven't managed, is to get out of the kiosk mode in chrome. There is no 
>> obvious possibility of opening several tabs, no address bar to get back to 
>> the directory page and no back button. This means that every time he wants 
>> to go back, e.g. after downloading the worksheet, he has to restart the 
>> virtual machine! I don't understand why chrome was chosen instead of 
>> firefox, and I have no idea why it is set up in kiosk mode. Is there any 
>> sensible way to productively work with the sage appliance using the now 
>> standard jupyter notebook?? I'm sorry if my frustration shows in these 
>> lines, I probably should have asked earlier, but I am wondering a bit if 
>> those that created the sage appliance actually use it themselves. I don't, 
>> which is why it never occurred to me how difficult to use it might be. 
>> Thanks for your help!
>>
>> Cheers
>> Stan
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-devel] why chrome kiosk mode in sage appliance??

2016-11-15 Thread Stan
This is amazing, I had no idea there was a way to run SMC locally already. 
Interestingly, https://hub.docker.com/u/sagemath/ points to sagemath.org as 
homepage, but I couldn't find a link to hub.docker.com at sagemath.org. I 
think it would be great to point to this resource at least on the downloads 
page at sagemath.org.

Stan

On Monday, November 14, 2016 at 6:44:01 PM UTC+1, William wrote:
>
> On Mon, Nov 14, 2016 at 8:40 AM, Erik Bray  > wrote: 
> > On Mon, Nov 14, 2016 at 4:49 PM, William Stein  > wrote: 
> >> On Mon, Nov 14, 2016 at 6:21 AM, Stan  
> wrote: 
> >>> Dear all, 
> >>> 
> >>> A student of mine has been using SMC because the sage appliance in 
> >>> virtualbox did not appear very useful with the jupyter notebook. Now 
> that he 
> >>> encountered a critical bug in SMC (reported offline), he is back with 
> the 
> >> 
> >> I'm not aware of this bug.  I don't know of any critical bugs in SMC. 
> >> There are exactly 22 known SMC *bugs*, which you can see listed here, 
> >> all of which we plan to fix ASAP: 
> >> 
> >>
> https://github.com/sagemathinc/smc/issues?utf8=%E2%9C%93=is%3Aissue%20is%3Aopen%20label%3AI-bug%20sort%3Acreated-asc%20-label%3Ablocked
>  
> >> 
> >> On can also use SMC via docker on Windows, Linux and OS X, as explained 
> here: 
> >> 
> >>   
> https://github.com/sagemathinc/smc/blob/master/src/dev/docker/README.md 
> >> 
> >> I wish I could recommend the official sagemath docker images, but it 
> >> looks like they haven't been updated in 6 months to 1 year ago? (What 
> >> the heck?) 
> >> 
> >>https://hub.docker.com/u/sagemath/ 
> > 
> > 
> > I'm not sure where you're looking-- 
>
>
> Click on the link above.  I clicked on sagemath/sage since it is ON 
> TOP (hence what you find with a typical google search), and it has 
> vastly more downloads than all other docker Sage images put together. 
> It's clearly the one people are getting for some reason. 
>
> I then clicked on the sagemath-jupyter one, since -- based on the name 
> -- I imagine that's the other reasonable choice if a person wants a 
> web interface... and it is 6 months old. 
>
> Clicking on all of them now, only sagemath/sagemath has been updated 
> recently.  All others are out of date. 
>
> > the image called sagemath/sage is 
> > definitely deprecated and should be removed. 
>
> OK.   Who has the power to do that?  Also, I wonder what is driving so 
> much traffic there? 
>
> > sagemath/sagemath is the 
> > latest and has sage 7.4. 
>
> > 
> > Erik 
> > 
> > -- 
> > You received this message because you are subscribed to the Google 
> Groups "sage-devel" group. 
> > To unsubscribe from this group and stop receiving emails from it, send 
> an email to sage-devel+...@googlegroups.com . 
> > To post to this group, send email to sage-...@googlegroups.com 
> . 
> > Visit this group at https://groups.google.com/group/sage-devel. 
> > For more options, visit https://groups.google.com/d/optout. 
>
>
>
> -- 
> William (http://wstein.org) 
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


[sage-devel] Re: Building 7.4.beta5 after building 7.5 betas

2016-11-15 Thread Dima Pasechnik


On Tuesday, November 15, 2016 at 7:07:06 AM UTC, Ralf Stephan wrote:
>
> On Tuesday, November 15, 2016 at 2:34:00 AM UTC+1, Paul Masson wrote:
>>
>>  Or is the current recommendation to always merge develop after every new 
>> beta?
>>
>
> I think it's to use it sparingly. That the history from git log is gobbled 
> is IMO a git bug.
>
> perhaps we need a policy that for a positive review of a ticket branch 
things like merge commits must be 
squashed out


 

> The branch I've been working on has been under review for some time, so I 
>> don't want to set things back by moving code around unnecessarily.
>>
>
> There is the possibility of pushing a new branch (which gets complicated 
> if several
> authorships must be preserved). 
>
Well, one can always push a public branch, no?
 

> I don't think it would strain trac resources too much.
>  
>
>> Besides, why shouldn't I always be able to go back and rebuild a previous 
>> branch without wiping everything clean?
>>
>
> Because Sage is one of the most complicated software systems, and reality
> rears its head quite a bit (with her beauty in the eye of the beholder).
>  
>
>> Trying to understand what goes wrong in the process.
>>
>
> it's a build system that does not scale well...
 

> We all do.
>  
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


[sage-devel] Re: Building 7.4.beta5 after building 7.5 betas

2016-11-15 Thread Dima Pasechnik


On Tuesday, November 15, 2016 at 1:34:00 AM UTC, Paul Masson wrote:
>
>
>
> On Monday, November 14, 2016 at 3:51:49 PM UTC-8, Dima Pasechnik wrote:
>>
>> Did you have a pressing need to build an old branch?
>> I'd normally first rebase over the latest beta, and then build.
>>
> What do you mean by "rebase" precisely? Just merging the current develop 
> branch or something else?
>

either this, or the other way - i.e. merging the old branch into (a copy 
of) the current development.
One can also use "git rebase" to clean the history up, if needed, by 
squashing commits.


 

>
> I'm under the impression that merging develop, while convenient, is 
> confusing for the history of a branch, so I've been avoiding that and 
> running ccache instead to cut down on build time. Or is the current 
> recommendation to always merge develop after every new beta?
>
> The branch I've been working on has been under review for some time, so I 
> don't want to set things back by moving code around unnecessarily. 
>

a reviewer would normally (try to) merge your branch into the current beta, 
and review the result.
 
 

> Besides, why shouldn't I always be able to go back and rebuild a previous 
> branch without wiping everything clean? Trying to understand what goes 
> wrong in the process.
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-devel] why chrome kiosk mode in sage appliance??

2016-11-15 Thread Stan
Dear William,
Thanks for the quick reply. The problem Thomas experience in SMC was that 
parts of his worksheet just disappeared and were not to be found in the 
snapshots. He could recover them from the log files and painfully put them 
in again, only to experience that bits started disappearing again. I didn't 
see a bug report that would describe this behaviour under the link you 
gave, but Thomas reported the problem within SMC and got a reply that this 
is indeed a bug. I'll ask him to fill in the details here. Sorry about 
being so unspecific!

Cheers
Stan

On Monday, November 14, 2016 at 4:49:50 PM UTC+1, William wrote:
>
> On Mon, Nov 14, 2016 at 6:21 AM, Stan  
> wrote: 
> > Dear all, 
> > 
> > A student of mine has been using SMC because the sage appliance in 
> > virtualbox did not appear very useful with the jupyter notebook. Now 
> that he 
> > encountered a critical bug in SMC (reported offline), he is back with 
> the 
>
> I'm not aware of this bug.  I don't know of any critical bugs in SMC. 
> There are exactly 22 known SMC *bugs*, which you can see listed here, 
> all of which we plan to fix ASAP: 
>
>
> https://github.com/sagemathinc/smc/issues?utf8=%E2%9C%93=is%3Aissue%20is%3Aopen%20label%3AI-bug%20sort%3Acreated-asc%20-label%3Ablocked
>  
>
> On can also use SMC via docker on Windows, Linux and OS X, as explained 
> here: 
>
>   https://github.com/sagemathinc/smc/blob/master/src/dev/docker/README.md 
>
> I wish I could recommend the official sagemath docker images, but it 
> looks like they haven't been updated in 6 months to 1 year ago? (What 
> the heck?) 
>
>https://hub.docker.com/u/sagemath/ 
>
>
> William 
>
> > sage appliance in VB but it is truly a nightmare. The installation 
> > instructions are still specific for sagews, not jupyter, but we at least 
> > managed to change the working directory to something he can access. What 
> we 
> > haven't managed, is to get out of the kiosk mode in chrome. There is no 
> > obvious possibility of opening several tabs, no address bar to get back 
> to 
> > the directory page and no back button. This means that every time he 
> wants 
> > to go back, e.g. after downloading the worksheet, he has to restart the 
> > virtual machine! I don't understand why chrome was chosen instead of 
> > firefox, and I have no idea why it is set up in kiosk mode. Is there any 
> > sensible way to productively work with the sage appliance using the now 
> > standard jupyter notebook?? I'm sorry if my frustration shows in these 
> > lines, I probably should have asked earlier, but I am wondering a bit if 
> > those that created the sage appliance actually use it themselves. I 
> don't, 
> > which is why it never occurred to me how difficult to use it might be. 
> > Thanks for your help! 
> > 
> > Cheers 
> > Stan 
> > 
> > -- 
> > You received this message because you are subscribed to the Google 
> Groups 
> > "sage-devel" group. 
> > To unsubscribe from this group and stop receiving emails from it, send 
> an 
> > email to sage-devel+...@googlegroups.com . 
> > To post to this group, send email to sage-...@googlegroups.com 
> . 
> > Visit this group at https://groups.google.com/group/sage-devel. 
> > For more options, visit https://groups.google.com/d/optout. 
>
>
>
> -- 
> William (http://wstein.org) 
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-devel] Building 7.4.beta5 after building 7.5 betas

2016-11-15 Thread Jeroen Demeyer

On 2016-11-14 23:56, Paul Masson wrote:

I'm running into an problem that after building 7.5.beta1 or 7.5.beta2,
building a branch based on 7.4.beta5 fails


Well, it's a *beta* for a reason, failures can happen. In this case, the 
problem is #21672 which is fixed in 7.4.rc2.


--
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-devel] "Tri bool"

2016-11-15 Thread Vincent Delecroix
There is still a semantic problem to solve the following

sage: Unknown or False
False
sage: False or Unknown
Unknown

Python is using __nonzero__ to deal with these or/and/not operators.
This method __nonzero__ implicitly defines the conversion to booleans.
And Python sets

x or y := x if bool(x) is True and y otherwise

It might be changed to

x or y :=
x if trool(x) is True
y if trool(x) is False
x if trool(x) is Unknown and trool(y) is not True
y if trool(x) is Unknown and trool(y) is True

I guess it is what you called "shortcut". In this form it is a max
operation with True -> 1, Unknown -> 1/2, False -> 0.

Vincent

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


[sage-devel] Hermite normal form of matrix over polynomial ring

2016-11-15 Thread Kwankyu Lee
Hi,

The current Hermite normal form algorithm in Sage for matrices over k[x] 
seems embarrassingly slow. It is a generic algorithm for matrices over 
PIDs. What would be possible ways to improve the situation? Any reference 
to literature or implementations or like would be welcome. Thanks.

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-devel] "Tri bool"

2016-11-15 Thread Thierry
On Tue, Nov 15, 2016 at 09:43:18AM +0100, Vincent Delecroix wrote:
> And what do you do with
> 
> my_function1() or my_function2() or my_function3()

Shortcut when you meet a True. For "and", shortcut when you meet a Unknown
or a False.


> shortcut or not shortcut? The current state of Python is that some of
> the above functions might not be evaluated (ie shortcut) *before*
> knowing the return type.
> 
> 
> On 15 November 2016 at 09:41, Thierry  wrote:
> > On Tue, Nov 15, 2016 at 09:27:14AM +0100, Vincent Delecroix wrote:
> >> On 15 November 2016 at 09:19, Thierry  
> >> wrote:
> >> > On Tue, Nov 15, 2016 at 08:53:43AM +0100, Vincent Delecroix wrote:
> >> >> Not currently (though we have "Unknown"). The main problem is the
> >> >> interaction with Python booleans and the operators "or", "and", "not"
> >> >> (which are *not* logical operators). The Sage "Unknown" is badly
> >> >> broken for these reasons
> >> >>
> >> >> sage: not Unknown   # waiting for Unknown
> >> >> True
> >> >> sage: Unknown or False   # waiting for Unknown
> >> >> False
> >> >>
> >> >> So be careful if you start using it!
> >> >>
> >> >> If we would use the correct logical operators ~ (for negation), ^ (for
> >> >> xor) and & (for and) then we might be able to come up with something.
> >> >> But Sage sort of ignore them.
> >> >>
> >> >> This problem has been discussed a lot on this mailing list and there
> >> >> even exists a (refused) PEP request in this direction.
> >> >
> >> > For reference, it is https://www.python.org/dev/peps/pep-0335/ (the main
> >> > reason for rejecting the proposal was "too much discussions"...).
> >> >
> >> > Perhaps was the proposal too greedy, so i wonder whether there would be a
> >> > possibility to have a trool adding an Unknown to bool that does not
> >> > perturb the speed when only True and False are used, and so that the
> >> > "short-circuiting semantics" remains preserved.
> >>
> >> No way! In an expression such as
> >>
> >>   "True or whatever_function(x)"
> >>
> >> the "whatever_function(x)" is *not* evaluated...
> >>
> >> sage: def f(): print "hello"
> >> sage: True or f()
> >> True
> >
> > I do not see your point. True or Unknown should be True, right ? So we can
> > shortcut here as well for trools, no ?
> >
> > Ciao,
> > Thierry
> >
> >
> >>
> >> > This could indeed be useful in testing equality of overlaping
> >> > real-intervals, undecidable problems in groups, equality of symbolic
> >> > expressions, ...
> >>
> >> But I agree that it could be useful.
> >>
> >> Vincent
> >>
> >> --
> >> You received this message because you are subscribed to the Google Groups 
> >> "sage-devel" group.
> >> To unsubscribe from this group and stop receiving emails from it, send an 
> >> email to sage-devel+unsubscr...@googlegroups.com.
> >> To post to this group, send email to sage-devel@googlegroups.com.
> >> Visit this group at https://groups.google.com/group/sage-devel.
> >> For more options, visit https://groups.google.com/d/optout.
> >
> > --
> > You received this message because you are subscribed to the Google Groups 
> > "sage-devel" group.
> > To unsubscribe from this group and stop receiving emails from it, send an 
> > email to sage-devel+unsubscr...@googlegroups.com.
> > To post to this group, send email to sage-devel@googlegroups.com.
> > Visit this group at https://groups.google.com/group/sage-devel.
> > For more options, visit https://groups.google.com/d/optout.
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "sage-devel" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to sage-devel+unsubscr...@googlegroups.com.
> To post to this group, send email to sage-devel@googlegroups.com.
> Visit this group at https://groups.google.com/group/sage-devel.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-devel] "Tri bool"

2016-11-15 Thread Vincent Delecroix
You are right this was a non-example...

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-devel] "Tri bool"

2016-11-15 Thread Vincent Delecroix
And what do you do with

my_function1() or my_function2() or my_function3()

shortcut or not shortcut? The current state of Python is that some of
the above functions might not be evaluated (ie shortcut) *before*
knowing the return type.


On 15 November 2016 at 09:41, Thierry  wrote:
> On Tue, Nov 15, 2016 at 09:27:14AM +0100, Vincent Delecroix wrote:
>> On 15 November 2016 at 09:19, Thierry  
>> wrote:
>> > On Tue, Nov 15, 2016 at 08:53:43AM +0100, Vincent Delecroix wrote:
>> >> Not currently (though we have "Unknown"). The main problem is the
>> >> interaction with Python booleans and the operators "or", "and", "not"
>> >> (which are *not* logical operators). The Sage "Unknown" is badly
>> >> broken for these reasons
>> >>
>> >> sage: not Unknown   # waiting for Unknown
>> >> True
>> >> sage: Unknown or False   # waiting for Unknown
>> >> False
>> >>
>> >> So be careful if you start using it!
>> >>
>> >> If we would use the correct logical operators ~ (for negation), ^ (for
>> >> xor) and & (for and) then we might be able to come up with something.
>> >> But Sage sort of ignore them.
>> >>
>> >> This problem has been discussed a lot on this mailing list and there
>> >> even exists a (refused) PEP request in this direction.
>> >
>> > For reference, it is https://www.python.org/dev/peps/pep-0335/ (the main
>> > reason for rejecting the proposal was "too much discussions"...).
>> >
>> > Perhaps was the proposal too greedy, so i wonder whether there would be a
>> > possibility to have a trool adding an Unknown to bool that does not
>> > perturb the speed when only True and False are used, and so that the
>> > "short-circuiting semantics" remains preserved.
>>
>> No way! In an expression such as
>>
>>   "True or whatever_function(x)"
>>
>> the "whatever_function(x)" is *not* evaluated...
>>
>> sage: def f(): print "hello"
>> sage: True or f()
>> True
>
> I do not see your point. True or Unknown should be True, right ? So we can
> shortcut here as well for trools, no ?
>
> Ciao,
> Thierry
>
>
>>
>> > This could indeed be useful in testing equality of overlaping
>> > real-intervals, undecidable problems in groups, equality of symbolic
>> > expressions, ...
>>
>> But I agree that it could be useful.
>>
>> Vincent
>>
>> --
>> You received this message because you are subscribed to the Google Groups 
>> "sage-devel" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to sage-devel+unsubscr...@googlegroups.com.
>> To post to this group, send email to sage-devel@googlegroups.com.
>> Visit this group at https://groups.google.com/group/sage-devel.
>> For more options, visit https://groups.google.com/d/optout.
>
> --
> You received this message because you are subscribed to the Google Groups 
> "sage-devel" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to sage-devel+unsubscr...@googlegroups.com.
> To post to this group, send email to sage-devel@googlegroups.com.
> Visit this group at https://groups.google.com/group/sage-devel.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-devel] "Tri bool"

2016-11-15 Thread Thierry
On Tue, Nov 15, 2016 at 09:27:14AM +0100, Vincent Delecroix wrote:
> On 15 November 2016 at 09:19, Thierry  wrote:
> > On Tue, Nov 15, 2016 at 08:53:43AM +0100, Vincent Delecroix wrote:
> >> Not currently (though we have "Unknown"). The main problem is the
> >> interaction with Python booleans and the operators "or", "and", "not"
> >> (which are *not* logical operators). The Sage "Unknown" is badly
> >> broken for these reasons
> >>
> >> sage: not Unknown   # waiting for Unknown
> >> True
> >> sage: Unknown or False   # waiting for Unknown
> >> False
> >>
> >> So be careful if you start using it!
> >>
> >> If we would use the correct logical operators ~ (for negation), ^ (for
> >> xor) and & (for and) then we might be able to come up with something.
> >> But Sage sort of ignore them.
> >>
> >> This problem has been discussed a lot on this mailing list and there
> >> even exists a (refused) PEP request in this direction.
> >
> > For reference, it is https://www.python.org/dev/peps/pep-0335/ (the main
> > reason for rejecting the proposal was "too much discussions"...).
> >
> > Perhaps was the proposal too greedy, so i wonder whether there would be a
> > possibility to have a trool adding an Unknown to bool that does not
> > perturb the speed when only True and False are used, and so that the
> > "short-circuiting semantics" remains preserved.
> 
> No way! In an expression such as
> 
>   "True or whatever_function(x)"
> 
> the "whatever_function(x)" is *not* evaluated...
> 
> sage: def f(): print "hello"
> sage: True or f()
> True

I do not see your point. True or Unknown should be True, right ? So we can
shortcut here as well for trools, no ?

Ciao,
Thierry


> 
> > This could indeed be useful in testing equality of overlaping
> > real-intervals, undecidable problems in groups, equality of symbolic
> > expressions, ...
> 
> But I agree that it could be useful.
> 
> Vincent
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "sage-devel" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to sage-devel+unsubscr...@googlegroups.com.
> To post to this group, send email to sage-devel@googlegroups.com.
> Visit this group at https://groups.google.com/group/sage-devel.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-devel] "Tri bool"

2016-11-15 Thread Vincent Delecroix
On 15 November 2016 at 09:27, Vincent Delecroix
<20100.delecr...@gmail.com> wrote:
> On 15 November 2016 at 09:19, Thierry  wrote:
>> On Tue, Nov 15, 2016 at 08:53:43AM +0100, Vincent Delecroix wrote:
>>> Not currently (though we have "Unknown"). The main problem is the
>>> interaction with Python booleans and the operators "or", "and", "not"
>>> (which are *not* logical operators). The Sage "Unknown" is badly
>>> broken for these reasons
>>>
>>> sage: not Unknown   # waiting for Unknown
>>> True
>>> sage: Unknown or False   # waiting for Unknown
>>> False
>>>
>>> So be careful if you start using it!
>>>
>>> If we would use the correct logical operators ~ (for negation), ^ (for
>>> xor) and & (for and) then we might be able to come up with something.
>>> But Sage sort of ignore them.
>>>
>>> This problem has been discussed a lot on this mailing list and there
>>> even exists a (refused) PEP request in this direction.
>>
>> For reference, it is https://www.python.org/dev/peps/pep-0335/ (the main
>> reason for rejecting the proposal was "too much discussions"...).
>>
>> Perhaps was the proposal too greedy, so i wonder whether there would be a
>> possibility to have a trool adding an Unknown to bool that does not
>> perturb the speed when only True and False are used, and so that the
>> "short-circuiting semantics" remains preserved.
>
> No way! In an expression such as
>
>   "True or whatever_function(x)"
>
> the "whatever_function(x)" is *not* evaluated...
>
> sage: def f(): print "hello"
> sage: True or f()
> True

Though it would be doable with signatures of functions.

def bool whatever_function()

would avoid evaluation but

def trool whatever_function()

would do it. However, it is a drastic change that needs some kind of
signature for functions.

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-devel] "Tri bool"

2016-11-15 Thread Vincent Delecroix
On 15 November 2016 at 09:19, Thierry  wrote:
> On Tue, Nov 15, 2016 at 08:53:43AM +0100, Vincent Delecroix wrote:
>> Not currently (though we have "Unknown"). The main problem is the
>> interaction with Python booleans and the operators "or", "and", "not"
>> (which are *not* logical operators). The Sage "Unknown" is badly
>> broken for these reasons
>>
>> sage: not Unknown   # waiting for Unknown
>> True
>> sage: Unknown or False   # waiting for Unknown
>> False
>>
>> So be careful if you start using it!
>>
>> If we would use the correct logical operators ~ (for negation), ^ (for
>> xor) and & (for and) then we might be able to come up with something.
>> But Sage sort of ignore them.
>>
>> This problem has been discussed a lot on this mailing list and there
>> even exists a (refused) PEP request in this direction.
>
> For reference, it is https://www.python.org/dev/peps/pep-0335/ (the main
> reason for rejecting the proposal was "too much discussions"...).
>
> Perhaps was the proposal too greedy, so i wonder whether there would be a
> possibility to have a trool adding an Unknown to bool that does not
> perturb the speed when only True and False are used, and so that the
> "short-circuiting semantics" remains preserved.

No way! In an expression such as

  "True or whatever_function(x)"

the "whatever_function(x)" is *not* evaluated...

sage: def f(): print "hello"
sage: True or f()
True

> This could indeed be useful in testing equality of overlaping
> real-intervals, undecidable problems in groups, equality of symbolic
> expressions, ...

But I agree that it could be useful.

Vincent

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-devel] "Tri bool"

2016-11-15 Thread Vincent Delecroix
On 15 November 2016 at 09:12, Bruno Grenet  wrote:
> Le 15/11/2016 à 08:53, Vincent Delecroix a écrit :
>>
>> Not currently (though we have "Unknown"). The main problem is the
>> interaction with Python booleans and the operators "or", "and", "not"
>> (which are *not* logical operators). The Sage "Unknown" is badly
>> broken for these reasons
>>
>> sage: not Unknown   # waiting for Unknown
>> True
>> sage: Unknown or False   # waiting for Unknown
>> False
>>
>> So be careful if you start using it!
>>
>> If we would use the correct logical operators ~ (for negation), ^ (for
>> xor) and & (for and) then we might be able to come up with something.
>> But Sage sort of ignore them.
>
>
> What do you mean by this? From what I understand, ~, &, ^ are bitwise
> operators, while "and", "or", "not" are bit operators. In which sense are
> they not logical opeators?

For example they are not commutative

sage: 0 and False
0
sage: False and 0
False

sage: 1 or 3
1
sage: 3 or 1
3

Vincent

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-devel] "Tri bool"

2016-11-15 Thread Thierry
On Tue, Nov 15, 2016 at 08:53:43AM +0100, Vincent Delecroix wrote:
> Not currently (though we have "Unknown"). The main problem is the
> interaction with Python booleans and the operators "or", "and", "not"
> (which are *not* logical operators). The Sage "Unknown" is badly
> broken for these reasons
> 
> sage: not Unknown   # waiting for Unknown
> True
> sage: Unknown or False   # waiting for Unknown
> False
> 
> So be careful if you start using it!
> 
> If we would use the correct logical operators ~ (for negation), ^ (for
> xor) and & (for and) then we might be able to come up with something.
> But Sage sort of ignore them.
> 
> This problem has been discussed a lot on this mailing list and there
> even exists a (refused) PEP request in this direction.

For reference, it is https://www.python.org/dev/peps/pep-0335/ (the main
reason for rejecting the proposal was "too much discussions"...).

Perhaps was the proposal too greedy, so i wonder whether there would be a
possibility to have a trool adding an Unknown to bool that does not
perturb the speed when only True and False are used, and so that the
"short-circuiting semantics" remains preserved.

This could indeed be useful in testing equality of overlaping
real-intervals, undecidable problems in groups, equality of symbolic
expressions, ...

Ciao,
Thierry


> Best,
> Vincent
> 
> 
> 
> On 15 November 2016 at 08:22, Thierry Dumont  
> wrote:
> > When developing a software which aims to prove something, it seems
> > necessary to be able to return something in
> >  {True, False, Indeterminate}.
> >
> > Of course, there are many possibilities to do this, but is there a
> > "canonical" one in Sage ?
> >
> > In C++, for example, there exists the Boost Tribool library
> > (http://www.boost.org/doc/libs/1_62_0/doc/html/tribool.html#tribool.introduction)
> > .
> >
> > t.d.
> >
> > --
> > You received this message because you are subscribed to the Google Groups 
> > "sage-devel" group.
> > To unsubscribe from this group and stop receiving emails from it, send an 
> > email to sage-devel+unsubscr...@googlegroups.com.
> > To post to this group, send email to sage-devel@googlegroups.com.
> > Visit this group at https://groups.google.com/group/sage-devel.
> > For more options, visit https://groups.google.com/d/optout.
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "sage-devel" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to sage-devel+unsubscr...@googlegroups.com.
> To post to this group, send email to sage-devel@googlegroups.com.
> Visit this group at https://groups.google.com/group/sage-devel.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-devel] RFC: correct way to deal with particular methods

2016-11-15 Thread Johan S . H . Rosenkilde
> Johan's suggestion is very intriguing but, unless I am completely mistaken, 
> it does not work in python. If I understand correctly if O is an instance of 
> Foo and O does not have the attribute x then python looks for Foo().x

You're right, I seem to have confused myself with deleting attributes of
subclasses.

Another possibility is to create micro-classes for each method which
only certain matrices have, and then dynamically monkey-patch each
constructed matrix to inherit from the micro-classes it should.
Unfortunately this requires assigning to o.__class__, which
doesn't seem possible when o is an instance of a Cython class.

Otherwise, the code below could work, I believe. The `extend_instance` is taken 
from
http://stackoverflow.com/questions/8544983/dynamically-mixin-a-base-class-to-an-instance-in-python.

def extend_instance(obj, cls):
"""Apply mixins to a class instance after creation"""
base_cls = obj.__class__
base_cls_name = obj.__class__.__name__
obj.__class__ = type(base_cls_name, (base_cls, cls),{})

class IntegerMatrixTwoColumn(SageObject):
def magic_method(self):
return 42

def MyMatrix(*args):
M = matrix(*args)
if M.ncols() == 2 and M.base_ring() == ZZ:
extend_instance(M, IntegerMatrixTwoColumn)


sage: M = MyMatrix(ZZ, 2, 2, [1,2,3,4])
sage: M.magic_method()
42

Best,
Johan

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-devel] "Tri bool"

2016-11-15 Thread Bruno Grenet

Le 15/11/2016 à 08:53, Vincent Delecroix a écrit :

Not currently (though we have "Unknown"). The main problem is the
interaction with Python booleans and the operators "or", "and", "not"
(which are *not* logical operators). The Sage "Unknown" is badly
broken for these reasons

sage: not Unknown   # waiting for Unknown
True
sage: Unknown or False   # waiting for Unknown
False

So be careful if you start using it!

If we would use the correct logical operators ~ (for negation), ^ (for
xor) and & (for and) then we might be able to come up with something.
But Sage sort of ignore them.


What do you mean by this? From what I understand, ~, &, ^ are bitwise 
operators, while "and", "or", "not" are bit operators. In which sense 
are they not logical opeators?


Bruno


This problem has been discussed a lot on this mailing list and there
even exists a (refused) PEP request in this direction.

Best,
Vincent



On 15 November 2016 at 08:22, Thierry Dumont  wrote:

When developing a software which aims to prove something, it seems
necessary to be able to return something in
  {True, False, Indeterminate}.

Of course, there are many possibilities to do this, but is there a
"canonical" one in Sage ?

In C++, for example, there exists the Boost Tribool library
(http://www.boost.org/doc/libs/1_62_0/doc/html/tribool.html#tribool.introduction)
.

t.d.

--
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


--
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.