Re: [sage-devel] deprecation question

2018-01-19 Thread Travis Scrimshaw


On Friday, January 19, 2018 at 3:31:25 AM UTC-6, Erik Bray wrote:
>
> On Fri, Jan 19, 2018 at 9:20 AM, Ralf Stephan  > wrote: 
> > Hi, 
> > Is deprecation necessary for class member functions starting with 
> > underscore, i.e. a weak "internal use" indicator? 
>
> I don't know what the precedent is for Sage, but I would say no. 
> There are rare cases that an undescored member is actually documented 
> for public use, but that's fairly uncommon.   If you *know* it's meant 
> as an internal method then I wouldn't deprecate it. 
>

The usual policy is no because it is not in the "public" namespace or 
documentation.

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] Jupyter header cells ?

2018-01-19 Thread Samuel Lelièvre
For generating books mixing LaTeX and computation cells,
see also PreTeXt:

http://mathbook.pugetsound.edu/
​

-- 
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] Jupyter header cells ?

2018-01-19 Thread Emmanuel Charpentier
Dear Daniel,

Le vendredi 19 janvier 2018 21:05:59 UTC+1, danielv...@yahoo.es a écrit :
>
> Since I was the originator of this request I would like to explain myself.
>>
>
> I'm new to SageMath, but I have been using WxMaxima for quite a while now.
>

Which is indeed a good notebook (if a bit insular, when compared to the 
Jupyter ecosystem). 

>
> I would like to have some way to define Sections and Subsections in a 
> SageMath notebook, but the definitions should not be static, i.e. if I 
> define 1, 2, 3, 4 sections in my document and then I delete Section 2, I 
> want section 3 to be renumbered 2 and section 4 to be renumbered 3 so that 
> the section numbers are always consecutive. If I then add a section in the 
> middle between 2 and 3 I want it to be numbered 3 and section 3 to be 
> renumbered 4.
>
> The same for subsections inside a section. They should always be numbered 
> consecutively no matter how many times I delete or add subsections. 
>

It turns out (see previous posts in this thread) that the feature you were 
searching for has been removed from modern versions of Jupyter ; users are 
now supposed to make-do with Markdown's headers.

The Jupyter developers propose some extensions 
 
that may or may not fulfill your needs. I have no idea how easy (or hard) 
it would be to add (some of) them to the current Sage Jupyter notebook.
 

>
> Long term, I would like to be able to create a PDF file from this notebook 
> with those section and subsections as bookmarks of the file so I can access 
> then using the bookmark PDF panel.
>

[ Full disclosure : I was first exposed to emacs and LaTeX 31 years ago ; 
my professionnal life has made me endure various "word processors" and 
suchlike horrors for more than a quarter century . I can hardly claim 
unbiasedness... ]

I am often confronted to this conudrum. I find the Sage notebook extremely 
handy to jot down an idea, toy and experiment with it and take quick notes, 
but I feel more at home with LaTeX when it comes to writing down things for 
good.

LaTeX has been created to prepare structured documents. It supports not 
only hierarchical sectioning, but also cross-referencing, footnotes, tables 
of contents,  indexing, references (most important !), und so weider ad 
infinitum... SageTeX  
is a LaTeX package that allows to insert almost any form of Sage calls in a 
LaTeX document, from the simple inline insertion of a Sage expression to a 
full program, along with LaTeX documentation.

The development of such a document is tremendously helped by the use of 
emacs along with sage_shell_mode 
, which allows you to run Sage 
in an emacs frame, allowing you to check your (typeset) results and your 
(2D) figures ; it even has a notebook emulation 
 
feature that might help your transition.

The price to pay is learning these tools, of course. Emacs' learning curve 
is a bit Matterhorn 
-like
 
(only a bit steeper, according to some...), Latex's vastness can be 
compared to the Ural 
,
 
and sage is ... well... Sage (and expanding !). But these difficulties are 
mutually healing : emacs' infinite programmability opens the possibility of 
sage_shel_mode, but also of AUCTeX  
and RefTeX  (which make 
the maintainance of a complicated document a breeze, compared to what word 
processors offer) and allow you not to learn 90% of LaTeX (the existing 
macroes will do the job for you).

However, almost all you need for that *can* be done in Markdowwn. It just 
happents that these tools exist in a zillion different (and mutually 
incompatible, of course) extensions, with no central federating program.

Furthermore, these tools are probably better adapted to the production of 
"dynamic" documents such as HTML pages or e-books, whereas LaTeX is 
strongly paper-oriented : papers, books, slides are supposed to have a 
*fixed* layout.

If you aim to go to the Web or e-publications (such as e-pub), you might be 
better off developing your document in the Notebook, exporting to pandoc or 
something like that, and re-exporting to HTML, e-pub or whatever (my 
experiences of converting a math-heavy LaTeX document to epub was not, to 
say the least, overwhelmingly successfull : the solution lies probably 
somewhere in the futire of LaTeXML ). That 
way, you could ask Pandoc to number your section hierarchy and insert a 
table of contents. I currently see no way

Re: [sage-devel] Jupyter header cells ?

2018-01-19 Thread danielvolinski via sage-devel

>
> Since I was the originator of this request I would like to explain myself.
>

I'm new to SageMath, but I have been using WxMaxima for quite a while now.

I would like to have some way to define Sections and Subsections in a 
SageMath notebook, but the definitions should not be static, i.e. if I 
define 1, 2, 3, 4 sections in my document and then I delete Section 2, I 
want section 3 to be renumbered 2 and section 4 to be renumbered 3 so that 
the section numbers are always consecutive. If I then add a section in the 
middle between 2 and 3 I want it to be numbered 3 and section 3 to be 
renumbered 4.

The same for subsections inside a section. They should always be numbered 
consecutively no matter how many times I delete or add subsections. 

Long term, I would like to be able to create a PDF file from this notebook 
with those section and subsections as bookmarks of the file so I can access 
then using the bookmark PDF panel.

Thanks,

Daniel

-- 
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] Should ZZ^2 be a submodule of CC^2?

2018-01-19 Thread Vincent Delecroix
To my mind, (ZZ^2).span([[1/2,0]]) should not even work...

On 19 January 2018 at 09:59, Simon Brandhorst  wrote:
>
>
> On Friday, January 19, 2018 at 9:16:16 AM UTC+1, vdelecroix wrote:
>>
>> I think that it should be False in both situations. "is_submodule"
>> should only be used in the context where we have an ambient free
>> module, like ZZ^d and two ZZ-submodules U and V.
>
> I disagree - the question makes perfect sense if U and V do not lie in the
> same ambient module but in the same ambient vectorspace.
> (ZZ^2).span([[1,0]]).is_submodule((ZZ^2).span([[1/2,0]]))
> Should definitely return True.
>
> --
> 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: Example graphs and show()

2018-01-19 Thread Dima Pasechnik


On Friday, January 19, 2018 at 10:28:55 AM UTC, Jori Mäntysalo wrote:
>
> On Fri, 19 Jan 2018, Dima Pasechnik wrote: 
>
> > I think it does matter for the user: in EXAMPLES one should put examples 
> > useful for the user, and G.show() is more flexible, e.g. one can do  
> > G.show(method="js") to show G in the browser. 
>
> True, but is it meaningfull to say for most graphs that this-and-this-too 
> can be shown with .show()? I see no added value to the user. 
>

I am saying that one should not make EXAMPLES less useful to the user for 
the sake of quicker doctesting.
It's OK to do this is TESTS though, so perhaps one can move some EXAMPLES 
to TESTS and make them quicker there.
  

>
> -- 
> Jori Mäntysalo

-- 
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: Example graphs and show()

2018-01-19 Thread Jori Mäntysalo

On Fri, 19 Jan 2018, Dima Pasechnik wrote:

I think it does matter for the user: in EXAMPLES one should put examples 
useful for the user, and G.show() is more flexible, e.g. one can do  
G.show(method="js") to show G in the browser.


True, but is it meaningfull to say for most graphs that this-and-this-too 
can be shown with .show()? I see no added value to the user.


--
Jori Mäntysalo

Re: [sage-devel] Re: Example graphs and show()

2018-01-19 Thread Dima Pasechnik


On Thursday, January 18, 2018 at 11:24:56 PM UTC, Travis Scrimshaw wrote:
>
>
> > I don't think plot, unlike show, actually goes through and does the 
>> > rendering of the image and discards the result. However, I could be 
>> > wrong about this. 
>>
>> You were right. After 
>>
>> perl -e 's/(G|g)\.show\(\)/_=\1.plot()/g;' -p -i.bak 
>> src/sage/graphs/generators/platonic_solids.py 
>>
>> the test time dropped from 3,5 to 0,5 seconds. 
>>
>
> Thank you for testing it and having some hard evidence! 
>
>>
>> Should it be on TESTS or in EXAMPLES? 
>>
>>  It doesn't matter to me.
>

I think it does matter for the user: in EXAMPLES one should put examples 
useful for the user, and
G.show() is more flexible, e.g. one can do  G.show(method="js") to show G 
in the browser.

Dima

>
> 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] deprecation question

2018-01-19 Thread Erik Bray
On Fri, Jan 19, 2018 at 9:20 AM, Ralf Stephan  wrote:
> Hi,
> Is deprecation necessary for class member functions starting with
> underscore, i.e. a weak "internal use" indicator?

I don't know what the precedent is for Sage, but I would say no.
There are rare cases that an undescored member is actually documented
for public use, but that's fairly uncommon.   If you *know* it's meant
as an internal method then I wouldn't deprecate it.

-- 
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] Should ZZ^2 be a submodule of CC^2?

2018-01-19 Thread Simon Brandhorst


On Friday, January 19, 2018 at 9:16:16 AM UTC+1, vdelecroix wrote:

> I think that it should be False in both situations. "is_submodule" 
> should only be used in the context where we have an ambient free 
> module, like ZZ^d and two ZZ-submodules U and V. 
>
I disagree - the question makes perfect sense if U and V do not lie in the 
same ambient module but in the same ambient vectorspace.  
(ZZ^2).span([[1,0]]).is_submodule((ZZ^2).span([[1/2,0]]))
Should definitely return True.

-- 
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] Should ZZ^2 be a submodule of CC^2?

2018-01-19 Thread Simon Brandhorst
Maybe the question then splits into two parts:

1) Is ZZ^2 a subset of CC^2 ? (Use this for __richcmp__)

2) Is ZZ^2 a submodule of CC^2 in the category of modules over ZZ? That is 
do we view CC^2 as a ZZ-module? 

(It is a ZZ-module in a natural way by the inclusion ZZ ---> CC) So 
basically should is_submodule test A.base_ring() is B.base_ring() or just 
A.base_ring().is_subring(B.base_ring())?

>From my point of view both possibilities are mathematically consistent. It 
is merely a question how rigid we want to be - it is a convention. Though 
at the moment we are inconsistent. (QQ vs CC)

-- 
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] deprecation question

2018-01-19 Thread Ralf Stephan
Hi,
Is deprecation necessary for class member functions starting with 
underscore, i.e. a weak "internal use" indicator?

-- 
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] Should ZZ^2 be a submodule of CC^2?

2018-01-19 Thread Vincent Delecroix
Dear Simon,

I think that it should be False in both situations. "is_submodule"
should only be used in the context where we have an ambient free
module, like ZZ^d and two ZZ-submodules U and V. In particular, this
situation implies that U and V are defined over the same base ring.
And even more U.ambient_module() is V.ambient_module().

Here is pseudo code for what I mean


def is_submodule(self, other):
if self.ambient_module() is not other.ambient_module():
raise ValueError
here test containment as subsets of the ambient module

If you want to consider comparisons of modules over different base
ring via coercion, you seriously have to worry: GF(3) has a coercion
map from ZZ.

Vincent

On 19 January 2018 at 08:54, Simon Brandhorst  wrote:
> Dear all,
>
> I am working on ticket
>
> #23978  Rich comparison for Modules
>
> As part of it I also rewrote the is_submodule function.
>
>
> Currently, we have
>
>
> sage: (ZZ^2).is_submodule(CC^2)
> False
> sage: (ZZ^2).is_submodule(QQ^2)
> True
>
> Should that behavior change to
>
>
> sage: (ZZ^2).is_submodule(CC^2)
> True
> sage: (ZZ^2).is_submodule(QQ^2)
> True
> ?
>
> I would say yes:
>
> Since
> sage: (CC^2).has_coerce_map_from(ZZ^2)
> True
> we already view `ZZ^2` in a canonical(=coercible) way as a submodule of
> CC^2.
>
>
> Reasons against:
> - Abstractly a complex vector space does not have a natural integral
> structure.
> But then we are working with modules with a distinguished basis. Not sure
> about the conventions there ?
>
> --
> 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.