Re: [sage-devel] Re: Inverting Integers gives different behaviour than in Python

2015-12-21 Thread Jeroen Demeyer

On 2015-12-21 17:53, Volker Braun wrote:

In any case, if you are serious about binary operations then the next
question is going to be: why is ^ not bitwise xor like for Python ints.


That's actually a different question since it involves the preparser. In 
Sage, the ^ operator is calling __pow__ and not __xor__.


--
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: bug report using assume

2015-12-21 Thread Vincent Delecroix

With respect to

http://sourceforge.net/p/maxima/bugs/3058/

seems to be fixed upstream (3 days ago)...

On 16/12/15 15:19, Nils Bruin wrote:

On Wednesday, December 16, 2015 at 9:41:03 AM UTC-8, Robert Dodier wrote:


  If you can make a bug report
about it, it would be helpful. It might have been reported already, I
didn't
look for it.



This is now:

https://sourceforge.net/p/maxima/bugs/3058/



--
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: modulo operators (integers, rationals, real numbers)

2015-12-21 Thread Travis Scrimshaw


>
>   1) the unique x' between [0,y) of the form x + ny  (used when both x 
> and y are integers) 
>
>
since this is usually the standard section of the quotient R -> R / yR (at 
least for the rings I think about doing modulus operations on, which, 
admittedly, is a very small set). Also, I feel we should try a little bit 
to make this consistent across coercions the ZZ -> QQ -> RR.

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.


[sage-devel] modulo operators (integers, rationals, real numbers)

2015-12-21 Thread Vincent Delecroix

Hello,

While responding to this ask question

http://ask.sagemath.org/question/31740/why-112321-and-111320

I discovered some inconsistencies with the modulo operators in Sage. We 
indeed have three coexisting definitions for x % y


 1) the unique x' between [0,y) of the form x + ny  (used when both x 
and y are integers)


 2) the unique x' between (-y/2, y/2] of the form x+ny (used when x is 
a float)


 3) the result of an operation in Zmod(y) and a lift to {0, ..., y-1} 
(used when x is a rational and y a float)


I would suggest to always use 1) but I am not sure if my opinion is 
shared by many mathematicians and Sage programmers...


Best,
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: Looking Forward to Contribute

2015-12-21 Thread Sébastien Labbé
1. Look at what other developpers has done recently:
http://trac.sagemath.org/timeline

2. Consult open tickets sorted by components. Active bugs (1568 tickets), 
Need work (187 tickets), Need review (79 tickets), Open Beginner Tickets 
(25), Mathematically Wrong Answers (77 tickets), etc. :
http://trac.sagemath.org/wiki/TicketReports

3. Establish some tickets you would like to work on.

4. Work. See developper guide here:
http://doc.sagemath.org/html/en/developer/


On Wednesday, December 2, 2015 at 10:24:34 PM UTC+1, saurabh garg wrote:
>
> Hey All !!!
>
> I, Saurabh Garg, am a undergraduate student at Indian Institute of 
> Technology, Bombay, India, pursuing a bachelors degree in Computer Science 
> and Engineering and willing to contribute to this community. I have prior 
> knowledge of python and c++ but no prior knowledge of Open Source 
> Development . I want to contribute to this community but need a guidance to 
> get started. Can any one please help me in getting started contributing 
> to this community..
>
> Looking to contribute !
> Thanks
> Saurabh Garg 
>

-- 
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: Inverting Integers gives different behaviour than in Python

2015-12-21 Thread Sébastien Labbé
I often use ~ to get the multiplicative inverse of an element:

sage: m = matrix.random(QQ,3,3)
sage: m
[-1 -2  1]
[ 0  2  2]
[ 1 -1  1]
sage: ~m
[ -2/5 -1/10   3/5]
[ -1/5   1/5  -1/5]
[  1/5  3/10   1/5]

sage: G = SymmetricGroup(4)
sage: g = G.an_element()
sage: g
(1,2,3,4)
sage: ~g
(1,4,3,2)

so to me it has now became natural that ~3 returns 1/3.

-- 
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: Inverting Integers gives different behaviour than in Python

2015-12-21 Thread David Roe
On Mon, Dec 21, 2015 at 8:53 AM, Volker Braun  wrote:

> On Monday, December 21, 2015 at 5:43:29 PM UTC+1, John Cremona wrote:
>>
>> Of course it does but no mathematician would ever write that in notation
>> as ~x.
>>
>
> Its still a minor optimization (avoids coercion in 1/x), so I'm not so
> sure that nobody ever used it.
>

I use the ~ notation, both in library code I write and when working with
Sage.


> In any case, if you are serious about binary operations then the next
> question is going to be: why is ^ not bitwise xor like for Python ints.
>

Indeed.
David


> --
> 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] Re: Jupyter notebook by default?

2015-12-21 Thread John H Palmieri


On Sunday, December 20, 2015 at 8:16:44 PM UTC-8, Nils Bruin wrote:
>
> On Sunday, December 20, 2015 at 2:12:57 PM UTC-10, William wrote:
>>
>> It will be much easier for our users to actually *use* a converter if 
>> we delay changing the defaults until after such a converter is 
>> written. 
>>
>
> ++1 (OK, I guess that's an error in most language). 
>
> It's going to be a relatively unpleasant surprise for people if they start 
> up the "sage notebook" and find a different notebook. We could possibly 
> alleviate the problem of lack of information by somehow guessing if this is 
> the first time this user starts up sage ipython notebook (and perhaps only 
> if we detect there is evince of a sagenb) and startup with a document that 
> explains how to do migration.
>
> If the default changes, then most users will assume they are supposed to 
> change with it (and we should only do this once we think users should 
> change, e.g., when interacts work) 
>
> At the very least there should be a method to:
>  - start the classic notebook
>  - save a collection of worksheets (sagenb)
>  - convert them to ipynb, at least in a way that works for "simple" 
> worksheets. Attached files etc. are obviously going to be an issue.
>
> If we don't have a tool that makes it straightforward to do this migration 
> then we're not ready to change defaults, in my opinion.
>
>

I think we need a migration tool and a deprecation warning: "The old Sage 
notebook is deprecated in favor of Jupyter notebooks. For information about 
converting old-style notebooks to Jupyter notebooks, see ... To use Jupyter 
notebooks now, run 'sage -notebook=jupyter'." Then the next version of Sage 
can change the default behavior.

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


Re: [sage-devel] Re: Inverting Integers gives different behaviour than in Python

2015-12-21 Thread Volker Braun
On Monday, December 21, 2015 at 5:43:29 PM UTC+1, John Cremona wrote:
>
> Of course it does but no mathematician would ever write that in notation 
> as ~x. 
>

Its still a minor optimization (avoids coercion in 1/x), so I'm not so sure 
that nobody ever used it.

In any case, if you are serious about binary operations then the next 
question is going to be: why is ^ not bitwise xor like for Python ints.

-- 
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: Inverting Integers gives different behaviour than in Python

2015-12-21 Thread John Cremona
On 21 December 2015 at 16:40, Volker Braun  wrote:
> Just to point out the obvious: In Mathematics, "inverting an integer" means
> 1/x

Of course it does but no mathematician would ever write that in notation as ~x.

>
> Though if you want to work with Python ints nothing is stopping you...
>
> sage: ~2r
> -3
> sage: ~int(2)
> -3
> sage: ~2
> 1/2
> sage: ~ZZ(2)
> 1/2
>
> On Monday, December 21, 2015 at 5:22:20 PM UTC+1, Mark Bell wrote:
>>
>> In Python for an integer x, its invert ~x is defined to be its
>> two-complement and is given by -1-x.
>>
>> On the other hand, in Sage Integers (from sage.rings.integer.Integer) have
>> their __invert__ defined to be 1 / self.
>>
>> Unfortunately this difference is cause several of my Python scripts to
>> crash / behave differently. Most notably that under this definition ~0
>> raises a "ZeroDivisionError: Rational division by zero" error.
>>
>> Looking through the git history it appears that this has been the way
>> integers that have been inverted since at least October 2006. Why do sage
>> Integers not use the "standard" Python invert?
>
> --
> 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.


[sage-devel] Re: Inverting Integers gives different behaviour than in Python

2015-12-21 Thread Volker Braun
Just to point out the obvious: In Mathematics, "inverting an integer" means 
1/x

Though if you want to work with Python ints nothing is stopping you...

sage: ~2r
-3
sage: ~int(2)
-3
sage: ~2
1/2
sage: ~ZZ(2)
1/2

On Monday, December 21, 2015 at 5:22:20 PM UTC+1, Mark Bell wrote:
>
> In Python for an integer x, its invert ~x is defined to be its 
> two-complement  and is 
> given by -1-x. 
>
> On the other hand, in Sage Integers (from sage.rings.integer.Integer) have 
> their __invert__ defined to be 1 / self 
> 
> .
>
> Unfortunately this difference is cause several of my Python scripts to 
> crash / behave differently. Most notably that under this definition ~0 
> raises a "ZeroDivisionError: Rational division by zero" error.
>
> Looking through the git history it appears that this has been the way 
> integers that have been inverted since at least October 2006 
> .
>  Why 
> do sage Integers not use the "standard" Python invert?
>

-- 
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] Inverting Integers gives different behaviour than in Python

2015-12-21 Thread John Cremona
Excellent question.  Since ~ is not mathematical notation for
anything, outside logic perhaps, does anyone use it at all within
Sage?   And since all

a=5
~a

does is call a.__invert__ which returns one / self, it seems quite a
waste of space.  Someone might like to add a print statement into that
function and run all tests to see if anyone notices...

John

On 21 December 2015 at 16:05, Mark Bell  wrote:
> In Python for an integer x, its invert ~x is defined to be its
> two-complement and is given by -1-x.
>
> On the other hand, in Sage Integers (from sage.rings.integer.Integer) have
> their __invert__ defined to be 1 / self.
>
> Unfortunately this difference is cause several of my Python scripts to crash
> / behave differently. Most notably that under this definition ~0 raises a
> "ZeroDivisionError: Rational division by zero" error.
>
> Looking through the git history it appears that this has been the way
> integers that have been inverted since at least October 2006. Why do sage
> Integers not use the "standard" Python invert?
>
> --
> 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.


[sage-devel] Inverting Integers gives different behaviour than in Python

2015-12-21 Thread Mark Bell
In Python for an integer x, its invert ~x is defined to be its 
two-complement  and is given 
by -1-x. 

On the other hand, in Sage Integers (from sage.rings.integer.Integer) have 
their __invert__ defined to be 1 / self 

.

Unfortunately this difference is cause several of my Python scripts to 
crash / behave differently. Most notably that under this definition ~0 
raises a "ZeroDivisionError: Rational division by zero" error.

Looking through the git history it appears that this has been the way 
integers that have been inverted since at least October 2006 
.
 Why 
do sage Integers not use the "standard" Python invert?

-- 
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: Jupyter notebook by default?

2015-12-21 Thread Jeroen Demeyer

On 2015-12-21 09:40, Volker Braun wrote:

Interacts DO work. Its just Jupyter interacts and not SageNB interacts.
I think that the SageNB @interact API is much better designed and more 
consistent than the Jupyter @interact API. Unfortunately, I am not able 
to convince upstream Jupyter (really: ipywidgets) that this is the case. 
See https://github.com/ipython/ipywidgets/issues/238


It's true that ipywidgets might be able to do more fancy stuff (like 
support for game controllers), but the basic stuff works better in SageNB.



Jeroen.

--
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: Jupyter notebook by default?

2015-12-21 Thread Volker Braun
On Monday, December 21, 2015 at 5:16:44 AM UTC+1, Nils Bruin wrote:
>
> different notebook. We could possibly alleviate the problem of lack of 
> information by somehow guessing if this is the first time this user starts 
> up sage ipython notebook
>

Thats inconsistent UX, now you open different notebooks on different 
computers / accounts. Unless you mean: print help to the terminal. The 
ticket does that already.

If the default changes, then most users will assume they are supposed to 
> change with it (and we should only do this once we think users should 
> change, e.g., when interacts work) 
>

Interacts DO work. Its just Jupyter interacts and not SageNB interacts. 
There are many more published Jupyter interacts, and lots more 
documentation about them.
 
Not changing the default also sends a message to our users, namely that its 
a good idea to use SageNB for new projects and that it is the UI that we 
are actively maintaining.

At the very least there should be a method to:
>  - start the classic notebook
>

This whole thread is ONLY about changing the default, nobody was talking 
about removing SageNB

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