Re: [sage-combinat-devel] Re: King Tableaux

2020-03-11 Thread Nicolas M. Thiery


Right I forgot about it.

Take a semi standard tableau that is in the resulting list and should
not be there (or the converse). Apply is_king_tableau. If the result
is not as expected, then it's time to debug is_king_tableau. If the
result is as expected, then something went wrong with how you used it.

In both cases, if you need further help, report precise sequences of
commands you typed in so that it can be reproduced and analyzed.

Cheers,
Nicolas


On Wed, Mar 11, 2020 at 03:44:35PM -0700, Soheli Das wrote:
> But now I'm using the tidied function given by Bruce:
> 
> def is_king_tableau(t):
> """A function which tests if a semistandard tableau is a King 
> tableau."""
> 
> if t[0][0] != 1:
> return False   
> for i, row in enumerate(t):
> if row[0] <= 2*i:
> return False
> return True
> 
> 
> On Wednesday, March 11, 2020 at 5:59:43 PM UTC-4, Nicolas M. Thiery wrote:
> >
> >
> >
> > > I have checked out the iterators thematic tutorial and I must say, it's 
> > > really helpful. Thank you for recommending that. 
> >
> > Glad to hear :-) 
> >
> > > Seems like the is_king_tableau throws away the tableaux that have 2 
> > > in the 2nd-row 1st column. After that, it displays all other 
> > > tableaux. I tried implementing a condition that goes over the list 
> > > and throws away the undesired tableaux but haven't been successful 
> > > yet. 
> >
> > If something is fishy, it's in the is_king_tableau. Make sure that 
> > function does what you want. 
> >
> > sage: def is_king_tableau(t,no_of_rows): 
> > : for i in range(no_of_rows): 
> > : if t[0][0] != 1: 
> > : return False 
> > : elif t[i][0] <= 2*i: 
> > : return False 
> > : else: 
> > : i=i+1 
> > : return True 
> >
> > The i=i+1 is suspicious. If you really want to consider rows of even 
> > index, it's more explicit to use range(0, no_of_rows, 2). 
> >
> > Also the t[0][0] might as well be outside of the loop since it does 
> > not depend on i. 
> >
> > Cheers, 
> > Nicolas 
> > -- 
> > Nicolas M. Thiéry "Isil" > 
> > http://Nicolas.Thiery.name/ 
> >
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "sage-combinat-devel" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to sage-combinat-devel+unsubscr...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/sage-combinat-devel/a09b94cb-4b98-4e23-982e-6cdee5fa8557%40googlegroups.com.

Nicolas
--
Nicolas M. Thiéry "Isil" 
http://Nicolas.Thiery.name/

-- 
You received this message because you are subscribed to the Google Groups 
"sage-combinat-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-combinat-devel+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-combinat-devel/20200311230203.GW3535%40mistral.


Re: [sage-combinat-devel] Re: King Tableaux

2020-03-11 Thread Nicolas M. Thiery



> I have checked out the iterators thematic tutorial and I must say, it's 
> really helpful. Thank you for recommending that.

Glad to hear :-)

> Seems like the is_king_tableau throws away the tableaux that have 2
> in the 2nd-row 1st column. After that, it displays all other
> tableaux. I tried implementing a condition that goes over the list
> and throws away the undesired tableaux but haven't been successful
> yet.

If something is fishy, it's in the is_king_tableau. Make sure that
function does what you want.

sage: def is_king_tableau(t,no_of_rows):
: for i in range(no_of_rows):
: if t[0][0] != 1:
: return False
: elif t[i][0] <= 2*i:
: return False
: else:
: i=i+1
: return True

The i=i+1 is suspicious. If you really want to consider rows of even
index, it's more explicit to use range(0, no_of_rows, 2).

Also the t[0][0] might as well be outside of the loop since it does
not depend on i.

Cheers,
Nicolas
--
Nicolas M. Thiéry "Isil" 
http://Nicolas.Thiery.name/

-- 
You received this message because you are subscribed to the Google Groups 
"sage-combinat-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-combinat-devel+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-combinat-devel/20200311215941.GO3535%40mistral.


Re: [sage-combinat-devel] Re: King Tableaux

2020-03-09 Thread Nicolas M. Thiery


On Mon, Mar 09, 2020 at 05:20:02PM -0700, Soheli Das wrote:
> I was trying to list the King tableaux of a particular shape. Here's the 
> function:
> 
> def list_of_king_tableaux(t_shape, t_max_entry):
> """A function which finds the list of King tableaux of given shape."""
> return list([t for t in SemistandardTableaux(t_shape, 
> max_entry=t_max_entry) if is_king_tableau(t)])
> 
> And this is the output I got:
> 
> sage: list_of_king_tableaux([2,2],4)
> [[[1, 1], [3, 3]],
>  [[1, 1], [3, 4]],
>  [[1, 1], [4, 4]],
>  [[1, 2], [3, 3]],
>  [[1, 2], [3, 4]],
>  [[1, 2], [4, 4]],
>  [[1, 3], [3, 4]],
>  [[1, 3], [4, 4]]]
> 
> The list shows the tableaux that are not king tableaux. How do I choose the 
> ones that obey the king tableaux condition?

The way you use is_king_tableau in list_of_king_tableaux looks
correct. So test that is_king_tableau indeed return false on the
undesired tableau.

Btw: list([...]) is redundant; [...] is equivalent. In addition,
iterators are most of the time better than lists. If you haven't done
so yet, I really recommend the iterators thematic tutorial.

Cheers,
Nicolas
--
Nicolas M. Thiéry "Isil" 
http://Nicolas.Thiery.name/

-- 
You received this message because you are subscribed to the Google Groups 
"sage-combinat-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-combinat-devel+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-combinat-devel/20200310055921.GN3535%40mistral.


Re: [sage-combinat-devel] Re: Image of a permutation

2020-03-08 Thread Nicolas M. Thiery


> Oops. Certainly 2 is fixed, so, doesn't belong to the support.
> Deserves a ticket, IMHO.

Ouch. Indeed!
Nicolas
--
Nicolas M. Thiéry "Isil" 
http://Nicolas.Thiery.name/

-- 
You received this message because you are subscribed to the Google Groups 
"sage-combinat-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-combinat-devel+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-combinat-devel/20200308172221.GG3535%40mistral.


Re: [sage-combinat-devel] Re: King Tableaux

2020-03-07 Thread Nicolas M. Thiery
> Thank you for helping me. I created the function ...
>
> What do you think? Were you suggesting something like this?

Yes indeed something like this (I did not check the exact conditions
you used, but that's your expertise :-)). Now you should just have to
come back to the template I sent you for the iterator and insert a
call to your function there.

Cheers,
Nicolas
--
Nicolas M. Thiéry "Isil" 
http://Nicolas.Thiery.name/

-- 
You received this message because you are subscribed to the Google Groups 
"sage-combinat-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-combinat-devel+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-combinat-devel/20200308064634.GC3535%40mistral.


Re: [sage-combinat-devel] Re: King Tableaux

2020-03-06 Thread Nicolas M. Thiery
Dear Soheli,

Thanks for the extra info. As a first step I suggest that you write a
little function that takes a semi standard tableau and test whether
it's a king tableau.

def is_king_tableau(t):
...

Cheers,
Nicolas

On Fri, Mar 06, 2020 at 08:29:33AM -0800, Soheli Das wrote:
> I'm working on King Tableaux along with my Professor. We came up with this 
> algorithm to generate king tableaux from semistandard tableaux. If you 
> could suggest a better algorithm, that would be great. Either way, I need 
> help with writing the code. I'm new to Sage and Python as well.
> I hope that clears your confusion(apologies for that). Your help would be 
> greatly appreciated.
> 
> Thanks,
> Soheli
> 
> On Friday, March 6, 2020 at 3:06:35 AM UTC-5, Bruce wrote:
> >
> > Dear Soheli,
> >
> > Your post does not have a question so I am not sure if you are asking for 
> > help on getting started with writing code or whether you are asking for a 
> > better algorithm.
> >
> > I am really following up on Nicolas' post and discussing the algorithm.
> >
> > The history is that crystal operators on King tableaux are not obvious 
> > (and maybe not known), De Concini came up with a different definition which 
> > does accomodate crystal operators.
> > A bijection between these two tableaux was given by Sheats.
> >
> > I believe (but don't have details) that the motivation for Ron King was 
> > that his definition corresponds to symmetric (or antisymmetric) 
> > Gelfand-Tsetlin patterns.
> > This suggests that you could approach this by constructing an iterator for 
> > (anti?)-symmetric Gelfand-Tsetlin patterns.
> >
> > Best,
> > Bruce
> >
> > On Tuesday, 3 March 2020 23:13:51 UTC, Soheli Das wrote:
> >>
> >> I'm trying to generate a function that produces King tableaux. My idea is 
> >> to first generate Semi-standard tableaux and then select the ones that 
> >> obey 
> >> the conditions of a King tableaux. I'm thinking of the entries i and -i 
> >> for 
> >> i=1,,n as entries 1,,2n. So, basically I want the rows to be 
> >> weakly 
> >> increasing and the columns to be strictly increasing like 
> >> 1<3<5<.<2n-1. 
> >> The following is what I have so far, it simply generates semistandard 
> >> tableaux.
> >>
> >> def generate_kingTableaux(size,max_entry_val,to_generate):
> >> :  v=[ ]
> >> :  for k in range(to_generate):
> >> :
> >>  v.append(SemistandardTableaux(size,max_entry=max_entry_val).list())
> >> :  return v
> >>
> >> I want to implement a condition which is somewhat like: if v[i][1] < 2i-1 
> >> then not a king tableaux; else i=i+1.
> >> I'm not sure how to implement this in sage. I would really appreciate if 
> >> someone could guide/help me!
> >>
> >
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "sage-combinat-devel" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to sage-combinat-devel+unsubscr...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/sage-combinat-devel/bbdc787b-a742-45e0-a6b6-359fcca0ad5f%40googlegroups.com.

Nicolas
--
Nicolas M. Thiéry "Isil" 
http://Nicolas.Thiery.name/

-- 
You received this message because you are subscribed to the Google Groups 
"sage-combinat-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-combinat-devel+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-combinat-devel/20200306181655.GU3535%40mistral.


[sage-combinat-devel] Jupyter session at the International Congress on Mathematical Software, July 2020, Braunchweig, Germany

2020-01-28 Thread Nicolas M. Thiery
Hello,

There will be a Jupyter session at the International Congress for
Mathematical Software (Braunchweig, Germany, July 13-16). If you would
like to give a short talk there to present cool use cases and
demonstrations in research and education, or maybe feedback from
experience or opinions, please submit!

Session web page:

https://opendreamkit.org/meetings/2020-07-13-ICMS-Jupyter

Detailed session aim and scope and general submission information below.

Cheers,
Nicolas


SESSION AIM AND SCOPE

The last years have seen the emergence of the open source web-based
interactive computing environment [Jupyter](https://jupyter.org)
(formerly IPython). Its flagship is the traditional notebook
application that allows you to create and share documents that contain
live code, equations, visualizations and narrative text; millions of
such notebooks have been published online. The main novelty of Jupyter
is that it can be used with dozens of programming languages, including
Julia, Python, R, Caml, C++, or Coq. 

Thanks to this level of generality and to the use of open standards
and modern web technologies, a wide ecosystem of related tools has
appeared, e.g. for interactive book and slides authoring, hosting,
collaborating, sharing, or publishing. Several mathematical systems
(e.g. GAP, SageMath, Singular, OSCAR) have already adopted it as user
interface of choice.

The purpose of this session is to review and discuss the merits (and
demerits!) of this ecosystem and its alternatives for mathematical
research and education, notably with open science and reproducibility
in mind.

CALL FOR SUBMISSIONS

The International Congress on Mathematical Software 2020 (ICMS 2020)
will be held in Braunschweig, Germany on July 13-16, 2020:
  http://www.iaa.tu-bs.de/AppliedAlgebra/ICMS2020/ICMS2020.html

The conference seeks submissions in the area of Mathematical Software,
understood in a wide sense.  Mathematics has a wide variety of
branches, from Algebra to Analysis, from Geometry to Number Theory,
and many more.  One theme across all these branches is the notion of
effectivity: mathematical theories often predict the existence of
objects with certain properties and it might be important to find such
objects. Conversely, to formulate conjectures and new mathematical
theories, we may need to explore the space of such objects, and use
them to prove new theorems.  Mathematical software is the common tool
in such quests.  Mathematics also has increasing overlap with many
mathematical disciplines such as Computer Science and emerging areas
auch as Computational Sciences and Engineering.  A key factor in this
convergence of mathematical disciplines is the idea of computation, as
manifested in the form of mathematical software in such disciplines.
All of these things have their place at ICMS.

Important Dates:
Submission deadline (short abstracts): February 23, 2020.
Notification: by March 1, 2020.
Submission deadline (extended abstracts): March 16, 2020.
Notification: by April 27, 2020
Final version of accepted papers due: May 09, 2020.

Submission process:

There are two levels of submissions (short and extended abstracts).
Going to Level 2 requires to go through Level 1 before.

Level 1: In order to give a presentation at ICMS 2020 submit a short
abstract (plain text, i.e., without using any mathematical symbols,
etc; 200 words max.) by February 23, 2020 via email to a session
chair.  The meeting will consist of two types of sessions: General and
Special.  See whether there is a special session that fits your work,
from the list of the sessions.  If there is no special session that
fits your work, then choose the session called "General".  If
accepted, then you will give a talk at ICMS.  Furthermore you may (if
desired) proceed to Level 2.  For the list of sessions see
  http://www.iaa.tu-bs.de/AppliedAlgebra/ICMS2020/ICMS2020_Sessions.html
  
We encourage that you submit it as soon as possible.
If you submit early, then you will get the decision early.
The organizers will make a decision within a week of submission.
If accepted, then it will appear on the conference web page immediately.

Level 2: You submit an extended abstract by March 16, 2016.  If
accepted, then it will enter the conference proceedings, which will
appear in the Springer series Lecture Notes in Computer Science
(LNCS). It should be at least 4 pages and at most 8 pages.  It should
follow the Springer guidelines for authors
  
https://www.springer.com/gp/computer-science/lncs/conference-proceedings-guidelines
In particular, it should use the latex template and the LNCS latex
style. The extended abstracts must be submitted via EasyChair to
  https://easychair.org/conferences/?conf=icms2020
as a single file, containing all the files.  This must include one
LaTeX source file, one bib file with the references, and one PDF
created from the source.  If you should have TikZ graphics, include it
into the LaTeX source.  Additional 

[sage-combinat-devel] Adding a new feture to Sage (discharging method for planar graphs): how to?

2019-06-07 Thread Nicolas M. Thiery
Dear Alexandre,

We have a developers workshop near Paris in 10 days with interfacing
C++ code with Python and Sage as one if the themes. That would be a
pretty good occasion to discuss this together, and get support to
actually do it. Would you be able to join?

https://wiki.sagemath.org/days101

Best regards,
Nicolas

> TLDR: I want to integrate into sage a package for doing proofs by 
> discharging, on planar graphs, where to start/how to do it? (the package is 
> already programmed)
> I am a PhD student, currently on the end of my PhD. At some point I made a 
> program in C++ to check the proof of the 4 colour theorem (every planar 
> graph can be coloured with four colours, such that any two connected 
> neighbours received different colours).
> 
> This was reimplementing the branch-and-bound method used in discharging 
> automated proofs. It includes the forbidden subgraph detection and the 
> application of the rules of discharging.
> 
> I would really like to include this program into Sage: it would be an asset 
> for my PhD, and it would enable researchers to easily test some discharging 
> scheme, and even prove a result (they would have to give some input, but 
> the engine I want to provide would do the rest, do the checking).
> 
> The program I made is in C++. However, I have tested to code a Python 
> interface, which works fine. It would also let the user give a Python 
> function (to give more customisability to the user), which would be run by 
> the C++ code, and that also seems to work.
> 
> Therefore, I wondered:
>* where to start? (I had a look on some resources a few months ago, but 
> could not figure out much)
>* possibly who to discuss this with?
>* how submitting a package works?
>* would my package fit the needs of Sage?
> 
> Thanks for help,
> Alexandre


Nicolas
--
Nicolas M. Thiéry "Isil" 
http://Nicolas.Thiery.name/

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


[sage-combinat-devel] Lie algebra representations and Crystals

2018-05-31 Thread Nicolas M. Thiery
Dear crystals and Lie algebra fans,

I am doing computations in a Lie algebra representation V; actually a
pretty simple one, though huge (in case this is relevant, V is a
subspace of the ring of polynomials in r sets of n variables, under
the action of gl_r. The nice feature is that weight spaces are
directly given by the multigrading, and the e and f operators are
given by polarization).

Question I: assume that I have a highest weight vector v for a simple
submodule of V. Consider the crystal of tableaux of the same weight.
Take a set S of tableaux T; for each of them, pick a string of e
crystal operators going from the highest weight tableau to T.

Can I by any chance assume that, if the corresponding strings of e
operators in gl_r are applied on v, I get linearly independent
elements in V?


Question II: assume that I have a weight space V_\lambda; I can easily
compute the subspace HV_\lambda of highest weight vectors in V_\lambda
by taking the joint kernel of the e operators. But for my computation
I would need to instead have a *projection* from V_\lambda to
HV_\lambda. Is there a way to construct such a projection, e.g. in
term of the operators of the Lie algebra?


In general, refs about this type of computations in Lie algebras are
very welcome ...

Thanks in advance!

Cheers,
Nicolas
--
Nicolas M. Thiéry "Isil" 
http://Nicolas.Thiery.name/

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


Re: [sage-combinat-devel] Re: Crystals not displaying

2017-05-31 Thread Nicolas M. Thiery

Update:

- Up to trivial comments, the default latex output has not changed
  since Sage 6.7beta3 (at least). view fails similarly with that
  version.

- A slightly smaller example:

sage: t = Partition([1])
sage: G = DiGraph([[t,t]], loops=True)
sage: latex(G)
\begin{tikzpicture}
\definecolor{cv0}{rgb}{0.0,0.0,0.0}
\definecolor{cfv0}{rgb}{1.0,1.0,1.0}
\definecolor{clv0}{rgb}{0.0,0.0,0.0}
\definecolor{cv0v0}{rgb}{0.0,0.0,0.0}
%
\Vertex[style={minimum 
size=1.0cm,draw=cv0,fill=cfv0,text=clv0,shape=circle},LabelOut=false,L=\hbox{${\def\lr#1{\multicolumn{1}{|@{\hspace{.6ex}}c@{\hspace{.6ex}}|}{\raisebox{-.3ex}{$#1$}}}
\raisebox{-.6ex}{$\begin{array}[b]{*{1}c}\cline{1-1}
\lr{\phantom{x}}\\\cline{1-1}
\end{array}$}
}$},x=2.5cm,y=2.5cm]{v0}
%
\Loop[dist=3.0cm,dir=NO,style={color=cv0v0,},](v0)
%
\end{tikzpicture}
sage: view(G)
**boom**

So I suspect that either that error went undetected for a long time,
or it comes from a change in tikz which makes the above code more
fragile.

Anyone a suggestion on how to tweak the above output to make it robust?

Cheers,
Nicolas

On Wed, May 31, 2017 at 09:16:05AM -0400, Nicolas M. Thiery wrote:
> Remember that graphs can be latex rendered in two ways: either by
> having Sage produce tikz manually (1), or through dot2tex (2). For
> general graphs, the former is the default. For graphs produced from
> crystals, the default is to use (2) if dot2tex is installed, and (1)
> otherwise. At the end the issue is not in dot2tex: its presence just
> hides the bug.
> 
> Here is my current minimal example, which breaks independently of
> dot2tex:
> 
> sage: t = StandardTableaux(4).random_element()
> sage: G = DiGraph([[t,t]], loops=True)
> sage: latex(G)
> **produces something**
> sage: view(G)
> **boom**
> 
> On Tue, May 30, 2017 at 11:43:13PM -0700, Dima Pasechnik wrote:
> >I can confirm that
> >B = crystals.Tableaux(['A',2], shape=[2,1]); view(B, tightpage=True)
> >does not work with the latest Sage beta.
> >It looks as if some tikz-related stuff in the TeX file header
> >is messed up.
> >On Wednesday, May 31, 2017 at 7:38:29 AM UTC+1, Dima Pasechnik wrote:
> > 
> >Perhaps SMC people can explain where the discrepancy in the TeX output
> >comes from.
> >I cc to the relevant group.
> >On Monday, May 29, 2017 at 9:48:45 PM UTC+1, Julie Beier wrote:
> > 
> >I have been trying to use the tableaux crystal pictures in Sage and,
> >while it works on the cloud, it does not work on my computer.  I have
> >updated Sage (then reverted to the version of Sage used on the cloud),
> >updated on my LaTeX packages, and installed dot2tex.  The code I'm
> >using is from the help pages: B = crystals.Tableaux(['A',2],
> >shape=[2,1]); view(B, tightpage=True).  The Tex files generated by the
> >cloud and by my computer are different.  The one generated by the cloud
> >compiles, but the one from my computer does not.  I've attached these.
> > Any ideas?  Thanks for your help!
> > 
> >--
> >You received this message because you are subscribed to the Google
> >Groups "sage-combinat-devel" group.
> >To unsubscribe from this group and stop receiving emails from it, send
> >an email to [1]sage-combinat-devel+unsubscr...@googlegroups.com.
> >To post to this group, send email to
> >[2]sage-combinat-devel@googlegroups.com.
> >Visit this group at
> >[3]https://groups.google.com/group/sage-combinat-devel.
> >For more options, visit [4]https://groups.google.com/d/optout.
> > 
> > References
> > 
> >1. mailto:sage-combinat-devel+unsubscr...@googlegroups.com
> >2. mailto:sage-combinat-devel@googlegroups.com
> >3. https://groups.google.com/group/sage-combinat-devel
> >4. https://groups.google.com/d/optout
> 
>   Nicolas
> --
> Nicolas M. Thiéry "Isil" <nthi...@users.sf.net>
> http://Nicolas.Thiery.name/
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "sage-combinat-devel" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to sage-combinat-devel+unsubscr...@googlegroups.com.
> To post to this group, send email to sage-combinat-devel@googlegroups.com.
> Visit this group at https://groups.google.com/group/sage-combinat-devel.
> For more options, visit https://groups.google.com/d/optout.
Nicolas
--
Nicolas M. Thiéry "Isil" <nthi...@users.sf.net>
http://Ni

Re: [sage-combinat-devel] Re: Crystals not displaying

2017-05-31 Thread Nicolas M. Thiery
Hi,

I am investigating this. Current status:

Remember that graphs can be latex rendered in two ways: either by
having Sage produce tikz manually (1), or through dot2tex (2). For
general graphs, the former is the default. For graphs produced from
crystals, the default is to use (2) if dot2tex is installed, and (1)
otherwise. At the end the issue is not in dot2tex: its presence just
hides the bug.

Here is my current minimal example, which breaks independently of
dot2tex:

sage: t = StandardTableaux(4).random_element()
sage: G = DiGraph([[t,t]], loops=True)
sage: latex(G)
**produces something**
sage: view(G)
**boom**

On Tue, May 30, 2017 at 11:43:13PM -0700, Dima Pasechnik wrote:
>I can confirm that
>B = crystals.Tableaux(['A',2], shape=[2,1]); view(B, tightpage=True)
>does not work with the latest Sage beta.
>It looks as if some tikz-related stuff in the TeX file header
>is messed up.
>On Wednesday, May 31, 2017 at 7:38:29 AM UTC+1, Dima Pasechnik wrote:
> 
>Perhaps SMC people can explain where the discrepancy in the TeX output
>comes from.
>I cc to the relevant group.
>On Monday, May 29, 2017 at 9:48:45 PM UTC+1, Julie Beier wrote:
> 
>I have been trying to use the tableaux crystal pictures in Sage and,
>while it works on the cloud, it does not work on my computer.  I have
>updated Sage (then reverted to the version of Sage used on the cloud),
>updated on my LaTeX packages, and installed dot2tex.  The code I'm
>using is from the help pages: B = crystals.Tableaux(['A',2],
>shape=[2,1]); view(B, tightpage=True).  The Tex files generated by the
>cloud and by my computer are different.  The one generated by the cloud
>compiles, but the one from my computer does not.  I've attached these.
> Any ideas?  Thanks for your help!
> 
>--
>You received this message because you are subscribed to the Google
>Groups "sage-combinat-devel" group.
>To unsubscribe from this group and stop receiving emails from it, send
>an email to [1]sage-combinat-devel+unsubscr...@googlegroups.com.
>To post to this group, send email to
>[2]sage-combinat-devel@googlegroups.com.
>Visit this group at
>[3]https://groups.google.com/group/sage-combinat-devel.
>For more options, visit [4]https://groups.google.com/d/optout.
> 
> References
> 
>1. mailto:sage-combinat-devel+unsubscr...@googlegroups.com
>2. mailto:sage-combinat-devel@googlegroups.com
>3. https://groups.google.com/group/sage-combinat-devel
>4. https://groups.google.com/d/optout

Nicolas
--
Nicolas M. Thiéry "Isil" 
http://Nicolas.Thiery.name/

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


Re: [sage-combinat-devel] How to cite properly if we use Schur and skew Schur functions?

2017-04-15 Thread Nicolas M. Thiery
Dear Egor,

On Sat, Apr 15, 2017 at 01:45:55PM -0700, Egor Maximenko wrote:
>Dear Anne,
>Thank you for the answer!
>I still have a doubt about "name explicitly the developers who worked
>on the specific features used in the publication".
>We use algebraic operations in the Schur basis and the conversion from
>skew Schur functions to combinations of Schur functions.

Thanks for your persistence in investigating of how to best cite the
software! In this case, the bulk of the computations are actually
carried out by lrcalc:


http://doc.sagemath.org/html/en/reference/libs/sage/libs/lrcalc/lrcalc.html

So, if you cite Sage, Sage-Combinat, and lrcalc by Anders Buch, I
guess that's fair enough. I don't remember seeing a standard bibtex
entry for lrcalc, but you can make one up.

Best regards,
Nicolas
--
Nicolas M. Thiéry "Isil" 
http://Nicolas.Thiery.name/

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


Re: [sage-combinat-devel] Improvements to FreeAlgebra

2017-03-29 Thread Nicolas M. Thiery
Hi Simon,

Thanks for getting in touch,

On Wed, Mar 29, 2017 at 02:34:28PM +, Simon King wrote:
> Just to make people aware: 9 years ago, it was decided to
> override Parent.__contains__ for CombinatorialFreeModule,
> thus working around Sage's coercion framework. I guess we
> should try to remove the custom CombinatorialFreeModule.__contains__,
> which is why I created #22707 (the branch hasn't been tested yet).

I commented on the ticket.

> Also, I think it is time to let FreeAlgebra(...) return
> some implementation of a free algebra with decently fast
> arithmetics. ...
> if free algebras were implemented as the path algebra of a digraph 
> with one vertex. I created #22708, but it has no branch yet.
> 
> Do you have objections against using path algebras, provided
> that they have the same features as the current default implementation
> of free algebras (I didn't check, yet)?

Wee, a 20x speedup is certainly nice :-)

The features should of course include all the little things of free
modules: accessors to retrieve like leading_term, (triangular) module
morphisms, etc.

> The default implementation of free algebra elements is some generic
> Python code ...

This is slightly misleading: the linear arithmetic on combinatorial
free modules elements has been cythonized for a while, and Travis has
just finished Cythonizing combinatorial free module elements: #22632.

It would be interesting to know specifically on which aspects the path
algebra is improving on the current free algebra. The data structure
of indices (i.e. words in the generators)? The data structure for
representing linear combinations? The implementation of the product?

Maybe some of those improvements could be lifted up to FreeModule in
the first place, or provide an alternative generic implementation of
it that would work better for your use case [1].

Cheers,
Nicolas

PS: It's been a while that we have been longing for having several
implementations of FreeModule to choose from depending on the use
case; we had 3-4 such implementations in MuPAD-Combinat back in 2004 :-)


--
Nicolas M. Thiéry "Isil" 
http://Nicolas.Thiery.name/

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


Re: [sage-combinat-devel] Re: combinat.sagemath.org

2017-03-27 Thread Nicolas M. Thiery
On Mon, Mar 27, 2017 at 01:11:24PM +0200, Harald Schilly wrote:
> Ok, modulo some global dns changes and updates, things like this work:
> 
> combinat.sagemath.org/Installation -> wiki.sagemath.org/combinat/Installation

Great; working smoothly here. Finally our page is back. Thanks a lot!

Cheers,
Nicolas
--
Nicolas M. Thiéry "Isil" 
http://Nicolas.Thiery.name/

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


Re: [sage-combinat-devel] Re: combinat.sagemath.org

2017-03-24 Thread Nicolas M. Thiery
Dear Matthew,

(thanks Anne, Harald, and William for the additional feedback)

On Tue, Mar 21, 2017 at 04:26:15PM -0700, Matthew Rennekamp wrote:
>It's been awhile since this discussion. Are there any more Combinat
>people that want these files open, or possibly the subdomain pointing
>to the SageWiki page?
>I've changed my mind to support whoever administers the GitHub account
>to move files on there, as long as there are more clear reasons for eg.
>forked repos like MathJax, which seem to be there just because they
>can. So, if there won't be a combinat.sagemath.org website, what does
>everyone on this mailing list think of putting it all on GitHub?

For the combinat website, let's stick to the original plan. Keeping
the documents on the wiki is good: there will be some further edits,
but not enough to warrant a migration to some new github pages. All we
need is to have http://combinat.sagemath.org redirect to
https://wiki.sagemath.org/combinat/ for "backward compatibility" with
references in e.g. published papers.

Can someone take care of this redirection?

I'll move the "misc" and "patches" repos to github and link them from
the wiki.

Cheers,
Nicolas
--
Nicolas M. Thiéry "Isil" 
http://Nicolas.Thiery.name/

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


Re: [sage-combinat-devel] I want product of the outgoing vertices as product of variables but it gives nonint type erros

2017-02-01 Thread Nicolas M. Thiery
Dear Biswajit,

On Wed, Feb 01, 2017 at 06:04:40AM -0800, Biswajit Ransingh wrote:
>dia = DiGraph({'x0':{'x1':(1, -1),'y1':(1, -1),'x2':(1,
>-1)},'y2':{'x0':(1, -1),'x1':(1, -1)}})
>diaout = dia.neighbors_out('x0');diaout
>prod(p for p in diaout)
>︡18c0ec18-9974-4cda-b0ba-0ff01686a9fa︡{"stderr":"Error in lines
>1-1\nTraceback (most recent call last):\n  File
>\"/projects/sage/sage-7.5/local/lib/python2.7/site-packages/smc_sagews/
>sage_server.py\", line 976, in execute\nexec compile(block+'\\n',
>'', 'single') in namespace, locals\n  File \"\", line 1, in \n
> File \"sage/misc/misc_c.pyx\", line 126, in sage.misc.misc_c.prod
>(/projects/sage/sage-7.5/src/build/cythonized/sage/misc/misc_c.c:2021)\
>nreturn iterator_prod(x, z)\n  File \"sage/misc/misc_c.pyx\", line
>229, in sage.misc.misc_c.iterator_prod
>(/projects/sage/sage-7.5/src/build/cythonized/sage/misc/misc_c.c:2719)\
>nx = sub_prods[tip] * x\nTypeError: can't multiply sequence by
>non-int of type 'str'\n"}︡{"done":true}︡

This is rather cryptic, and it is rather inconvenient to have half of
the question in the subject line and half in the text. Please prepare
an easier to read message next time.

Alternatively, you may want to use ask.sagemath.org.

diaout is a list of strings:

sage: diaout = dia.neighbors_out('x0');diaout
['x2', 'y1', 'x1']

If you want to see them as variables, you have to convert them
explicitly:

sage: prod(SR(v) for v in diaout)
x1*x2*y1

Best regards,
Nicolas
--
Nicolas M. Thiéry "Isil" 
http://Nicolas.Thiery.name/

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


Re: [sage-combinat-devel] Re: combinat.sagemath.org

2017-01-14 Thread Nicolas M. Thiery
Hi Matthew,

Thanks for your interest and request for more background to decide
what's the right thing to do.

Sage-Combinat started back in 2008, as a reincarnation of a similar
project MuPAD-Combinat (we switched the underlying platform from MuPAD
to Sage). At some point Sage-Combinat was a tightly knit group of
about 30 people working together on the core combinatorics feature;
this required tight coordination and a common location for sharing
in-development code (which was the Sage-Combinat queue). With time,
the breath of features have widened a lot, with interactions with many
other areas of Sage. Also the switch to git and the emergence of "Sage
packages" made it much easier for smaller groups of people to get
together on a subproject basis when collaborating on specific
topics. So Sage-Combinat has become a rather loose community.

All being good things.

Nevertheless, Sage-Combinat and http://combinat.sagemath.org/ are
cited in many places, including 100+ publications. So we want this URL
to keep working, for historical reasons and future work.

Hence my advocacy for keeping the wiki pages
http://wiki.sagemath.org/Combinat/* where they are, and making sure
the URL http://combinat.sagemath.org/ redirects there.

For the two repositories "misc" and "patches": as I mentioned in my
previous mail, we want to keep them around, somewhere. It's a good
occasion to migrate them to git for consistency. I don't mind where
they are hosted, git.sagemath.com, github, or elsewhere.  I was just
suggesting github because there already are many Sage-related repos
there.

As for the *machine* combinat.sagemath.org: this used to be a physical
machine, funded in 2012 or something by one of our NSF grant.

- It's ok if combinat.sagemath.org does not point to a physical
  machine or actually a machine at all.

- For the hardware: IIRC, it's been recycled to power some of the Sage
  infrastructure and SMC. All is good as long as it is put to good use
  for the Sage community until it's time to be retired.

Cheers,
  Nicolas


PS: Another factor why Sage-Combinat is somewhat quieter as such (and
in particular the wiki pages got outdated!) is that the energy I was
spending animating this community got diverted by my leading the ODK
European project. I can't wait until I get back to combinatorics
development ...


On Fri, Jan 13, 2017 at 11:04:18PM -0800, Matthew Rennekamp wrote:
>I'm not sure about pulling anything into GitHub. Adding to reasons
>here https://groups.google.com/forum/#!topic/sage-devel/j3BtPrq62kg, we
>might just go ahead and make it a repo on git.sagemath.com, or add it
>all to trac. Would a website now be useful as it had been? It seems
>like Combinat is just a name for a niche group of developers. What sort
>of history precedes and succeeds this all? Since I only got into
>[technically, returned to] Sage within the last month, I both have a
>lack of relationships with developers and a general lack of knowledge
>about the who's/what's/why's of the project. William gave me access to
>the files, so I'll be looking through them over the weekend.
>So, if GitHub wouldn't be an option, what then? Again, we could move it
>to the main git host or merge it all to one of SageWiki or trac, but we
>could simply "revive" combinat.sagemath.org. I worry that doing so will
>unnecessarily spread out available information, so it would be wise to
>be precise in what will be there. I can't comment on content when I ad
>absurdium the purpose of Combinat. (Something about trac being
>developer's information for coding, SageWiki for organizing full-scale
>projects, combinat.sagemath.org for academic research stuff, etc. Or
>something like it would be helpful in describing these relationships.)
>What about other projects? SageManifolds has their own thing going on,
>and I don't know much about it.
>Tl;dr: organisation from higher up needs to be established, in order to
>keep navigation intuitive. I say that we should just make a page,
>sagemath.org/combinat , for now.
>On Thursday, January 12, 2017 at 9:55:18 PM UTC-5, Matthew Rennekamp
>wrote:
> 
>I'm working on the [1]www.sagemath.org & SageWiki. What happened to
>[2]combinat.sagemath.org? Are there other places those files are
>stored?
> 
>--
>You received this message because you are subscribed to the Google
>Groups "sage-combinat-devel" group.
>To unsubscribe from this group and stop receiving emails from it, send
>an email to [3]sage-combinat-devel+unsubscr...@googlegroups.com.
>To post to this group, send email to
>[4]sage-combinat-devel@googlegroups.com.
>Visit this group at
>[5]https://groups.google.com/group/sage-combinat-devel.
>For more options, visit [6]https://groups.google.com/d/optout.
> 
> References
> 
>1. http://www.sagemath.org/
>2. http://combinat.sagemath.org/
>

Re: [sage-devel] Re: [sage-combinat-devel] Multiple versions of SageMath's documentation online

2016-08-23 Thread Nicolas M. Thiery
On Mon, Aug 22, 2016 at 09:10:55AM -0700, Samuel Lelievre wrote:
>I guess once the Google indexing of doc.sagemath.org is solved,
>we should probably remove this redirection.

No rush, but that would be nice indeed. It should be easy to add a
banner on the old combinat doc to warn that it's outdated.

>It would be worth to open a Sage trac ticket dedicated
>to moving the sage-combinat tutorials into Sage proper.

That's:

http://trac.sagemath.org/ticket/16810

with this chunk completed recently:

https://trac.sagemath.org/ticket/20618

Cheers,
Nicolas
--
Nicolas M. Thiéry "Isil" 
http://Nicolas.Thiery.name/

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


Re: [sage-combinat-devel] Multiple versions of SageMath's documentation online

2016-08-22 Thread Nicolas M. Thiery
Dear Samuel, Frédéric, Harald,

Sorry for the slow answer; I am just back from vacations.

Thanks Sam, Frédéric for the pings!

On Thu, Aug 11, 2016 at 10:46:08PM +0200, Samuel Lelièvre wrote:
>This post on sage-devel
>[1]https://groups.google.com/d/msg/sage-devel/NJSAQTjhIWE/NWbqC8xOAQAJ
>has a part (which I'm copying below for convenience) about
>SageMath's documentation at [2]combinat.sagemath.org/doc.
>Does anybody here have some insight about these questions?

>- Excerpt from the sage-devel post at
>[3]https://groups.google.com/d/msg/sage-devel/NJSAQTjhIWE/NWbqC8xOAQAJ
>2. SageMath's developer manual at [4]combinat.sagemath.org/doc/
>reference
>This sage-devel thread
> 
>  [5]https://groups.google.com/d/topic/sage-devel/cCGobP2AgwM/
>discussion
>is concerned with the fact that another version of SageMath's
>reference manual also lives at
>  [6]http://combinat.sagemath.org/doc/reference
>and that (given the trouble we are having in getting Google to properly
>index the documentation at [7]doc.sagemath.org), queries in Google
>search
>give search engine results at [8]combinat.sagemath.org/doc, rather than
>at [9]doc.sagemath.org.
>In addition, it seems that the version of the documentation at
>[10]combinat.sagemath.org/doc corresponds to SageMath 6.3
>, while SageMath is now at 7.3.
>Combinat people,
>- is there a use for hosting SageMath's documentation at
>  [11]combinat.sagemath.org/doc and should it be updated to 7.3?
>- does this version have extra stuff from the combinat queue?
>- who is in charge?

- This documentation is compiled with an old Sage with the patches
  from the legacy Sage-Combinat queue applied.

- It was occasionally useful, as there are some thematic tutorials
  that have not yet been integrated into Sage.

- The documentation cannot be updated to 7.3, as the patches don't
  apply anymore.

- It was hosted in the user directory of
  combi...@combinat.sagemath.org; Anne, Florent and myself have the
  ssh keys for that account.

I see that combinat.sagemath.org/doc is now redirected to the main
Sage documentation. Given the issues the old doc was causing with
google searches, I guess that's fair enough.

Cheers,
Nicolas
--
Nicolas M. Thiéry "Isil" 
http://Nicolas.Thiery.name/

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


Re: [sage-combinat-devel] CartanTypes

2016-07-06 Thread Nicolas M. Thiery
Dear Andrew,

On Tue, Jul 05, 2016 at 11:10:46AM -0700, Andrew wrote:
>Sorry if I should post this to sage-support ...

This sounds like the right place to discuss it!

>Does CartanType currently support A_\infty? I checked the docs and it
>seems not but I wanted to check because I need this. Well, actually, I
>only need some very rudimentary combinatorial data from the Cartan
>type, that I can easily manufacture myself, but thematically I really
>should index the objects that I am playing with by the appropriate
>Cartan types as I am hoping that what I am doing will work in types
>A^{(1)}_l, A^{(2)}_{2l}, C^{(1)}_l, D^{(2)}_l and A_\infty.

Currently, there is no support for `A_\infty`. This is mostly because
most of the interesting stuff that a cartan type provides in Sage
(e.g. the Cartan matrix, ...) is returned as a non lazy object.

Could you provide a couple examples of use that you have in mind?

In the simplest form, returning a formal object with very few methods
implemented (maybe just `is_crystalographic` and friends) would be
straightforward: add a file type_A_infinity.py with a CartanType class
and whatever you want inside it, and update CartanType.__call__ to use
it as appropriate.

>Whilst looking for this I came across the following, which I guess are
>syntax errors on my part rather than bugs:
>sage: CartanType(['A',4,1])  # works
>['A', 4, 1]
>sage: CartanType(['A',infinity])
>  File "", line unknown
>^
>SyntaxError: unexpected EOF while parsing
>sage: CartanType(['A',-1])
>  File "", line unknown
>^
>SyntaxError: unexpected EOF while parsing
>sage: CartanType(['A',0])
>['A', 0]

What's happening here is that the above does not fit within the
standard input formats that Cartan type accepts; and then it gets
confused and tries to parse the string in search of one of our
shortcuts like CartanType("A3*xA2~"). Yeah, this is a bug: it should
instead return a proper not implemented error.

Cheers,
Nicolas
--
Nicolas M. Thiéry "Isil" 
http://Nicolas.Thiery.name/

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


Re: [sage-combinat-devel] More LaurentPolynomialRing insanity

2015-11-03 Thread Nicolas M. Thiery
On Tue, Nov 03, 2015 at 04:37:25PM +0100, VulK wrote:
> I just noted the following:
> 
> sage: R = LaurentPolynomialRing(ZZ,'x,y')
> sage: T = R.remove_var('x')
> sage: T.inject_variables()
> Defining y
> sage: y in T
> True
> sage: y in R
> True
> 
> As one should expect, now for a second try
> 
> sage: R = LaurentPolynomialRing(ZZ,'x,y,z')
> sage: T = R.remove_var('x')
> sage: T.inject_variables()
> Defining y, z
> sage: y in T
> True
> sage: y in R
> False
> 
> And of course, you try R(y), hell break loose. 
> 
> At this point, at least in my experience, there are more issues with
> LaurentPolynomialRing than features. Is there any plan to replace the
> implementation with something less bug ridden in the near future? 
> 
> Should I decide to invest time in rewriting it, would anyone here be
> interested to help? Do you have any suggestion/reference on how this should
> be done properly?

Just a note: this would be better discussed on sage-devel.

Cheers,
Nicolas
--
Nicolas M. Thiéry "Isil" 
http://Nicolas.Thiery.name/

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


Re: [sage-combinat-devel] Topological conditions on Hopf algebras

2015-09-22 Thread Nicolas M. Thiery
On Tue, Sep 22, 2015 at 01:07:28PM -0700, Mike Zabrocki wrote:
>This question is kind of directed at Nicolas, but I'll accept the
>answer from anyone who knows the answer.
>On ticket #18675 there was a discussion about the definition of
>GradedHopfAlgebra.  It turns out that topologists use a Koszul sign
>convention in one of the bi-algebra axioms.
>$$(\mu \otimes \mu) \circ (id \otimes \tau \otimes id) \circ (\Delta
>\otimes \Delta) = \Delta \circ \mu$$
>In combinatorics the twist map is $\tau(x \otimes y) = y \otimes x$
>For a topologist a "graded Hopf algebra" implies that the twist map
>should satisfy $\tau(x \otimes y) = (-1)^{deg(x)deg(y)} y \otimes x$
>I imagine that a Hopf algebra satisfying the first twist satisfies the
>tests imposed in the category of GradedHopfAlgebra.  Does the second?
>If the second does not satisfy the conditions of being a
>GradedHopfAlgebra, where is the code in Sage that would cause that Hopf
>algebra to fail tests?

A this point there does not seem to be a test about this axiom or its
variants:

mistral-/opt/sage/src/sage/categories>grep "def _test" *bial*
mistral-/opt/sage/src/sage/categories>grep "def _test" *hopf*
hopf_algebras_with_basis.py:def _test_antipode(self, **options):

(it would be good to add one!). I doubt the code actually makes use of
it; but more code has been added recently, so please double check.

At first sight, I assume we could accommodate both axioms by having a
tau method doing one or the other, the default value being probably
the unsigned convention to cater for all our current graded Hopf
algebras. But I really have no clue outside of our good old
combinatorics world, so don't take my word on this.

Anyone with a broader view?

Cheers,
Nicolas
--
Nicolas M. Thiéry "Isil" 
http://Nicolas.Thiery.name/

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


Re: [sage-combinat-devel] Re: Skew partitions for symmetric functions

2015-09-15 Thread Nicolas M. Thiery
On Mon, Sep 14, 2015 at 07:00:11PM -0700, Anne Schilling wrote:
> I would also say (B). But why is skew_schur needed if the usual
> Schur function already takes a skew partition as an input?

It's a usual pattern: when a constructor/call function takes very
different kinds of input, it can be nice to split out the
implementation of the various constructions into independent
functions. This cleanly separates the concerns between the dispatch
upon input and each construction.

Cheers,
Nicolas
--
Nicolas M. Thiéry "Isil" 
http://Nicolas.Thiery.name/

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


Re: [sage-combinat-devel] CombinatorialFreeModule relies on implementation details of elements

2015-08-26 Thread Nicolas M. Thiery
Hi Simon!

On Wed, Aug 26, 2015 at 08:05:32AM +, Simon King wrote:
 Working on path algebras, which inherit from CombinatorialFreeModule, I
 found that CombinatorialFreeModule makes specific assumptions on 
 implementation details of the elements of a module.
 
 What I mean is, for example, CombinatorialFreeModule.sum. It relies on
 the assumption that all elements have a public attribute 
 _monomial_coefficients,
 which is supposed to be a dictionary. But an underscore attribute is commonly
 considered an implementation detail, if I understand correctly. That's
 too intrusive, I don't want that a parent imposes my elements to be 
 implemented
 as a monomial-coefficient dictionary.
 
 It seems to me that CombinatorialFreeModule tries to impose on the user
 to use an element class that is a sub-class of 
 CombinatorialFreeModule.Element,
 which is a Python class. That's too intrusive, I believe. I want to be
 able to use a Cython class for elements (that's the point of #17435).
 
 Would you at least consider to avoid the usage of the implementation
 detail x._monomial_coefficients and replace it by a public API such
 as x.monomial_coefficients()? I don't want my elements to be
 IMPLEMENTED based on dictionaries stored in private attributes, but of
 course I don't mind to provide a public method that CONSTRUCTS such a
 dictionary for an element.

So far CombinatorialFreeModule has been meant as a concrete
implementation of a ModulesWithBasis, with a specific data structure
for its elements. In this context, generic methods that don't depend
on the data structure should be in ModulesWithBasis and the others
should be in CombinatorialFreeModule. And your parent would just be in
ModulesWithBasis, without inheriting from CombinatorialFreeModule.

I see two reasons why this latter point could be annoying:

- Many generic methods have not yet been lifted from
  CombinatorialFreeModule to ModulesWithBasis.

  That would take a bit of work to fix, but that's something we want
  to do at some point anyway.

- There is code in CombinatorialFreeModule that does not depend on the
  data structure of the elements but can't be easily moved up to the
  category. Typically initialization code (category, base ring,
  customization of the string rep of elements, ...)

  Maybe this is calling for an additional class above
  CombinatorialFreeModule that would factor out this code? This would
  be similar in flavor to the Adapter Classes pattern in java (see
  http://stackoverflow.com/a/10170811). Note that this is already
  partially done by the IndexedGenerators class.

Cheers,
Nicolas
--
Nicolas M. Thiéry Isil nthi...@users.sf.net
http://Nicolas.Thiery.name/

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


Re: [sage-combinat-devel] Inherit from LaurentPolynomial_mpair

2015-07-21 Thread Nicolas M. Thiery
On Mon, Jul 20, 2015 at 02:57:43PM +0200, Salvatore Stella wrote:
 as you might remember from an e-mail I sent few days ago, I am trying to
 implement cluster algebras as subalgebras of a Laurent polynomial ring. Since
 its elements are going to be multivariate Laurent polynomials I figured that
 my element class should inherit from LaurentPolynomial_mpair. Naively I was
 hoping not to have to redefine all the operations since they will remain the
 same. Unfortunately I ran into something I was not expecting. Let me explain
 by one example.
 
 This is the stripped down version of the code I want to use:
 Apparently most of the functions (including _add_) defined in
 LaurentPolynomial_mpair force the return value to be LaurentPolynomial_mpair.
 Shouldn't they return the same type of the input if possible? In other words
 shouldn't there be an analog of the Element assignment at the beginning of
 the code defining the class LaurentPolynomial_mpair so that, by overriding
 that assignment, one could inherit all the functions automatically?

I am not surprised by this issue. Many classes (like the above, or
FreeModuleElement) have not been originally designed to be inherited
from. It's most likely fixable, but might take some work.

Now a question is whether you actually want to inherit from
LaurentPolynomial. The thing is that your object might not quite be a
Laurent Polynomial: indeed some of its operations (e.g. factorization)
depend on the parent and might not be valid anymore.

Instead, you may want to *contain* a LaurentPolynomial as internal
data structure, and then use the category Algebras(...).Subobjects()
to provide you with the operations that remain valid:

class Subobject(Parent):
def __init__(self, ambient, category):
self._ambient = ambient
Parent.__init__(self, category=category)

def ambient(self):
return self._ambient

def lift(self, x):
return x.value

def retract(self, x):
return self(x)

class Element(ElementWrapper):
pass


sage: R = QQ['x']
sage: x = R.gen()
sage: A = Subobject(R, category=Rings().Subobjects())

sage: A.one()
1
sage: a = A(R(x+1))
sage: a * a
x^2 + 2*x + 1
sage: a ^ 3
x^3 + 3*x^2 + 3*x + 1
sage: a.parent() is A
True
sage: a.parent() is R
False

How does this work? Just as you would imagine. For example how to
compute products in a subobject is implemented in
Magmas.Subobjects.ParentMethods.product as follows:

sage: A.product.__module__
'sage.categories.magmas'

sage: A.product??
  def product(self, x, y):
  ...
  return self.retract(self.lift(x) * self.lift(y))

For details, see:

sage: S = Sets()
sage: S.Subobjects?


Alas life is not yet perfect. Here is what's missing in Sage:

#1. Not all categories implement all of their operations for
subobjects.  For example, addition is not yet implemented by:
AdditiveMagmas.Subobjects:

sage: a + 1
...
TypeError: 'NotImplementedType' object is not callable

so at this point you need to do it by hand:

sage: A.retract(a.lift() + 1)
x + 2

#2. Implementing a subobject using elements of the ambient object as
inner representation is a typical need. The above class does just
this, and there really should be a fleshed out version of it in
Sage. Note that this class contains nothing specific about
subgroups, subalgebras, etc. So the same class could handle any
subXXX.

#3 There certainly are glitches here and there. I first started with
the category Algebras(QQ).Subobjects(). But then it complained
because this currently requires implementing a base_ring method
(in theory one could be provided by Modules(QQ).ParentMethods),
and the one from Parent takes precedence and returns ... None.
This should be improved by #18196

As a starter, you really just need #1, with a custom class for your
laurent polynomials similar to the above. #1 itself should not be too
bad to implement: just a couple methods similar to the above product
method here and there in the categories.

Good luck!

Cheers,
Nicolas
--
Nicolas M. Thiéry Isil nthi...@users.sf.net
http://Nicolas.Thiery.name/

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


[sage-combinat-devel] KL polynomials for translations in the affine Weyl groups

2015-07-03 Thread Nicolas M. Thiery
Dear Arno,

On Tue, Jun 30, 2015 at 12:42:24PM +0200, arno kret wrote:
I'm a mathematician, for a theorem that I am trying to prove I would
like to do some computer experiments, and I was wondering if Sage could
do this in my case. I am contacting you because I saw that you
developed some of the related code in Sage. Could you help me out?
Here is what I would like to. Consider W_a the affine Weyl group for
the root system A_n-tilda. Then,
(*)W_a = (finite weyl group) semi-direct product Q
where Q is the root lattice. I would need to compute, for two elements
a, b in Q given, the Kazhdan Lusztig polynomial
P_{a, b}(q)
attached to a, b in Q viewed as elements of W_a via the decomposition
(*).
Do you know how to do type this in Sage? An example would be fantastic!
In the Sage documentation I found the function
reduced_word_of_translation(t), that seems to be relevant. But from the
comments there I am not sure if this function currently works in the
generality I would need.
(Please note I am very inexperienced with sage)

I am forwarding this to sage-combinat-devel which is read by many
people interested in the combinatorics of affine Weyl groups.

At first sight, I would say that our affine weyl group gives what's
needed to recover the reduced word from the translation a and b, and
that the Coxeter3 software, which is accessible from Sage, can compute
the KL coefficients for any Coxeter group elements given by reduced
words.

Outside of Sage:

sage -i coxeter3# install the Coxeter 3 library
sage -br

Inside Sage:

sage: L = RootSystem([A,3,1]).weight_lattice()
sage: alpha = L.simple_roots()
sage: a = alpha[1]+3*alpha[2]
sage: b = alpha[1]+2*alpha[2]
sage: u = L.reduced_word_of_translation(a)
sage: v = L.reduced_word_of_translation(b)
sage: W = CoxeterGroup([A,3,1], implementation=coxeter3)
sage: u = W(L.reduced_word_of_translation(a))
sage: v = W(L.reduced_word_of_translation(b))

sage: W.kazhdan_lusztig_polynomial(u,v)
0
sage: W.kazhdan_lusztig_polynomial(u,u)
1
sage: a = alpha[1]
sage: u = W(L.reduced_word_of_translation(a))
sage: W.kazhdan_lusztig_polynomial(u,v)
1
sage: a = L.zero()
sage: u = W(L.reduced_word_of_translation(a))
sage: W.kazhdan_lusztig_polynomial(u,v)
q^2 + 2*q + 1

But please double check everything!

As for the comment in reduced_word_of_translation: in general the
plain translation t-t+x by an element of the root lattice x may not
map alcoves to alcoves. One need to take into account the translation
factors; e.g. the proper translation for the simple root alpha[i] is
to add f_i*alpha[i] where f_i is given by the method
`translation_factor` of the Cartan type (for simplicity, I assumed
level=1 above).

In simply laced types, and in particular type A you are fine. But
indeed we need to clarify this comment, and point the user to how to
construct, from an element of the root lattice, a proper translation
taking into account the translation factors. We are using this
functionality in a couple places (plotting, the upcoming Affine Weyl
group code, ...), so probably we should abstract it away in a method.

Mark, what do you think?

Kind regards,
Nicolas
--
Nicolas M. Thiéry Isil nthi...@users.sf.net
http://Nicolas.Thiery.name/

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


Re: [sage-combinat-devel] weird behavior under combining remove and for loop

2015-06-28 Thread Nicolas M. Thiery
On Sun, Jun 28, 2015 at 10:07:43AM +0200, Nicolas Borie wrote:
 Le 28/06/2015 06:55, Anne Schilling a écrit :
 Is this what I should expect from this code:
 
 sage: positions=[1,2,3,4,5,6]
 sage: for j in positions:
 : positions.remove(j)
 :
 sage: positions
 [2, 4, 6]
 Wha this one will increase my collection of tricky examples... There is
 a war in my university : C language against Python language, what is the
 best for computer sciences education ?
 
 This is pure Python code and Python comes from C...

I would indeed assume that the iterator invalidation rules for
Python's list and for the analogue C++ containers (e.g. vector) or C
arrays are similar:

http://stackoverflow.com/questions/6438086/iterator-invalidation-rules

Cheers,
Nicolas
--
Nicolas M. Thiéry Isil nthi...@users.sf.net
http://Nicolas.Thiery.name/

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


Re: [sage-combinat-devel] Re: Specification of combinatorial free module?

2015-06-22 Thread Nicolas M. Thiery

For the record: we had a chat with Simon this morning, and the current
plan is on http://trac.sagemath.org/ticket/18756 and followup.

Cheers,
Nicolas
--
Nicolas M. Thiéry Isil nthi...@users.sf.net
http://Nicolas.Thiery.name/

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


Re: [sage-combinat-devel] Re: Specification of combinatorial free module?

2015-06-22 Thread Nicolas M. Thiery
On Sun, Jun 21, 2015 at 10:18:27PM +, Simon King wrote:
 Exactly. This is what I thought it would do. And the point is: Undocumented
 assumptions are made on {b_i: i \in I} or I. It isn't enough that I
 is a container.
 
 For example, it is assumed that you can call I to create an element
 (hence, it seems that you want I to be a Parent).

I checked the documentation and code, and indeed it's ambiguous. The
index set is really meant to be a parent; for example there are tests
such like I in Sets().Finite() and the dimension method calls
`cardinality`. As a syntactic sugar, lists or tuples are converted to
a `FiniteEnumeratedSet`.

At this point, it would indeed be better to document that `I` shall be
in Sets() (i.e. basically be a parent), or be a finite iterable that
will be converted to a FiniteEnumeratedSet (and implement things
accordingly).

And then we could think whether there are compelling enough use cases
to to relax those constraints a bit.

Cheers,
Nicolas
--
Nicolas M. Thiéry Isil nthi...@users.sf.net
http://Nicolas.Thiery.name/

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


Re: [sage-combinat-devel] Specification of combinatorial free module?

2015-06-21 Thread Nicolas M. Thiery
On Sat, Jun 20, 2015 at 12:43:18PM +, Simon King wrote:
 In order to create a right module over a path algebra P, with a vector space
 basis given by the potentially infinite family of paths starting at some
 vertex, I thought I'd start with CombinatorialFreeModule.
 
 My expectation was that it would work *easily* and out of the box, if
 - one provides a family B of basis vectors, where B is just an
   iterable container (i.e. one can test if something is in B, and one
   can list its elements)
 - the stuff that is in B can be multiplied from the right by monomials
   of P (i.e., paths), such that either a new element of B or None results.
   I.e., linearity is taken care of by generic code in
   CombinatorialFreeModule.
 
 However, it turns out that this is not enough: If p in B, and M is
 CombinatorialFreeModule(QQ, B), then still M(p) fails, because at some
 point it is attempted to do B(p), after checking that indeed p in B.
 But of course a container isn't necessarily callable.
 
 On the one hand, I wonder why the conversion into an element of B is
 needed after testing p in B. On the other hand, I wonder what other hidden
 assumptions exist on B.
 
 Apparently it needs a __call__ method. Or does B actually need to be a
 Parent (such as LazyFamily is a Parent)? Is it specified somewhere what
 assumptions are made?
 
 And: Is my expectation correct that in order to get the right-P-module
 structure, all what we need is that the elements of P have a
 .monomial_coefficients() method returning a dict, so that the elements
 of B can be multiplied with the keys of the dict? If not, where is it
 specified what is needed?

I am confused. Probably because there is a misunderstanding about the
purpose of CFM.

(Combinatorial)FreeModule(K, I) is about constructing the free module
M over the base ring K, with a basis (b_i)_{i\in I} indexed by
I. Constructing the linear span of a bunch of vectors living in some
other space (and potentially using some of the additional structure of
this other space) is a different construction. For this you may want
to have a look at the submodule method. The documentation shows how
to use it to define a subalgebra. Note however that, at this point,
this is only implemented for finite dimensional submodules; also we
are missing categories for ideals / ...

On a side note: for (Combinatorial)FreeModule(K, I) we don't want an
automatic coercion from I, at least not by default, because there are
cases where this could be ambiguous (e.g. when there are elements in I
that are also in the base ring).

Cheers,
Nicolas
--
Nicolas M. Thiéry Isil nthi...@users.sf.net
http://Nicolas.Thiery.name/

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


Re: [sage-combinat-devel] Test digraph for cycles containing a vertex?

2015-06-20 Thread Nicolas M. Thiery
On Fri, Jun 19, 2015 at 09:31:21PM +, Simon King wrote:
 Hi!
 
 Let D be a digraph, potentially with multiple edges and loops. Let v be
 a vertex.
 
 How should one test whether v is contained in a cycle (including loops)?
 
 Is it correct that v is in a cycle or loop if and only if
  (len(D.strongly_connected_component_containing_vertex(v))1) or (v in  
 D.neighbors_out(v))
 ?
 Is there a better way to test it?

Some variants; same theoretical worst case complexity; not necessarily
better in practice:

- duplicate the vertex, and search for a path from the first copy to
  the second one.

- search for a path from one of the out neighbors of v to v

Cheers,
Nicolas
--
Nicolas M. Thiéry Isil nthi...@users.sf.net
http://Nicolas.Thiery.name/

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


Re: [sage-combinat-devel] Re: strange category

2015-06-12 Thread Nicolas M. Thiery
Hi Mark!

On Thu, Jun 11, 2015 at 06:44:04PM -0400, Mark Shimozono wrote:
 I require a method which, given a sage category of a module,
 returns the ring which acts upon it.

 There is a method :meth:`ModulesWithBasis.base_ring`
 which is supposed to give the base ring of a module (rather than
 that of a category of modules) but it is broken.

 The base ring is stored as an attribute. However unlike methods,
 attributes are not inherited by sage subcategories.
 Thus it is necessary to search the category tree to find
 a suitable leaf which possesses the base ring attribute.

Following the issues you had mentioned in Davis, since #1
Modules.SubcategoryMethods.base_ring provides a default implementation
of base_ring so that A(XXX).base_ring() returns XXX for any
subcategory A(XXX) of Modules(XXX).

XXX may indeed be either a ring or a category thereof, depending on
how the category was created.

 At any rate, in the given example, passage to the category has the
 effect of forgetting needed information.

Can you describe more precisely your use case? Do you have an example
where you only have the category under hand, and still need to know
explicitly the base ring?

Cheers,
Nicolas
--
Nicolas M. Thiéry Isil nthi...@users.sf.net
http://Nicolas.Thiery.name/

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


Re: [sage-combinat-devel] Re: strange category

2015-06-12 Thread Nicolas M. Thiery
On Fri, Jun 12, 2015 at 08:28:15AM -0400, Mark Shimozono wrote:
 To do this entirely correctly each functorial construction needs to know what 
 properties it
 respects; otherwise the new composite object may possess properties that 
 don't make sense,
 even when all its pieces have the property.

I am not sure to follow.

Here the goal of the logic is to detect what's the most specific
common category C of a collection of parents.

How each functorial construction deduces from C, the properties of the
composite object is an independent logic, isn't it?

Cheers,
Nicolas
--
Nicolas M. Thiéry Isil nthi...@users.sf.net
http://Nicolas.Thiery.name/

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


Re: [sage-combinat-devel] Re: strange category

2015-06-12 Thread Nicolas M. Thiery
On Fri, Jun 12, 2015 at 08:46:34AM -0400, Mark Shimozono wrote:
 One last question: how do morphisms of modules know they can be tensored?

Like parents or elements: because they (should) have a tensor
method?

(I may have misunderstood your question ...)

Cheers,
Nicolas
--
Nicolas M. Thiéry Isil nthi...@users.sf.net
http://Nicolas.Thiery.name/

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


Re: [sage-combinat-devel] Re: strange category

2015-06-12 Thread Nicolas M. Thiery
On Fri, Jun 12, 2015 at 07:27:51AM -0400, Mark Shimozono wrote:
 I'm implementing smash products of AlgebrasWithBasis,
 which are tensor products of algebras with not-necessarily-componentwise
 product.  When the tensor factors are themselves tensor products,
 I don't want to use the default tensor product construction, which flattens
 tensors (good for linear operations but disastrous for the above purpose).

Yup.

 My solution was to allow the tensor product construction to admit a
 category suggestion, which is then used to choose a new grouped tensor
 implementation or the usual flattened one.
 
 The smash product only makes sense when the algebras are over the
 same base ring.
 
 Sometimes I want to choose the flattened tensor even when the factors
 are all algebras and sometimes of course I want the grouped tensor product.

Ok, thanks for the description.

We encountered something similar when playing with cartesian products
with Vincent. When A and B are modules over different base rings RA
and RB (but same base ring category),

cartesian_product(A,B)

should not be in Modules(Rings()). Currently, the category for the
cartesian product is obtained by starting from the meet of the
category of A and the category of B; this should be refined to take
into account the base rings of A and B. So probably we want some
method

meet_category_of([A,B,...])

which implements this logic, starting from the parents and not only
from their categories.

I am not sure:

- Where to put such a method (and what its name should be). As a
  starter, let's take sage.categories.category.meet_category_of.

- How to implement it; I guess we can start by doing the usual meet,
  and then hardcoding the special rule for modules; maybe later we
  will have other use cases guiding us toward something more general.

Cheers,
Nicolas
--
Nicolas M. Thiéry Isil nthi...@users.sf.net
http://Nicolas.Thiery.name/

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


Re: [sage-combinat-devel] Re: strange category

2015-06-12 Thread Nicolas M. Thiery
On Fri, Jun 12, 2015 at 12:59:10PM -0400, Mark Shimozono wrote:
 How does sage know to supply them with a tensor method?

See ModulesWithBasis.ParentMethods.tensor and
ModulesWithBasis.ElementMethods.tensor. Those could be lifted to
Modules if we had more general implementations.

Cheers,
Nicolas
--
Nicolas M. Thiéry Isil nthi...@users.sf.net
http://Nicolas.Thiery.name/

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


Re: [sage-combinat-devel] Re: remove combinat/mupad from sagemath website

2015-06-09 Thread Nicolas M. Thiery
On Mon, Jun 08, 2015 at 03:56:55PM +0200, Nathann Cohen wrote:
 Yes, that's what I did this morning. It's a pull request, waiting to
 be accepted.

Great. I don't have write access on this repository, so just put a +1
there (and made a further pull request going one step further:
removing the link from the Sage citations to the MuPAD-Combinat
citations).

Cheers,
Nicolas
--
Nicolas M. Thiéry Isil nthi...@users.sf.net
http://Nicolas.Thiery.name/

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


Re: [sage-combinat-devel] Re: remove combinat/mupad from sagemath website

2015-06-09 Thread Nicolas M. Thiery
Hi Harald,

 ...

Thanks for your reorganization work on the web site; it's in
particular very convenient to now be able to propose changes with our
usual collaborative tools!

Cheers,
Nicolas
--
Nicolas M. Thiéry Isil nthi...@users.sf.net
http://Nicolas.Thiery.name/

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


Re: [sage-combinat-devel] Re: remove combinat/mupad from sagemath website

2015-06-08 Thread Nicolas M. Thiery
On Mon, Jun 08, 2015 at 09:51:36AM +0200, Nathann Cohen wrote:
 I did not propose to remove sage-combinat's publications list (which
 will be merged on a common page), I was only talking about
 mupad-combinat.

Indeed. But Anne raised a point which I had overseen: the URL

http://www.sagemath.org/library-publications-combinat.html

has been advertised in several places, including grant documents. We
don't necessarily need to keep the page itself there, but then we need
a redirection.

 On the other hand, while I understand that you may have to keep your
 bibliography up-to-date, I don't see why you should keep your
 project's data on Sage's website and not on sage-combinat's website.

Sage-Combinat is part of Sage. Sage-Combinat's website is a page on
the Sage wiki. The Sage-Combinat's NSF grant benefited Sage at large.
I don't see the point of suddenly having to duplicate the
infrastructure.

Nicolas
--
Nicolas M. Thiéry Isil nthi...@users.sf.net
http://Nicolas.Thiery.name/

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


Re: [sage-combinat-devel] Re: remove combinat/mupad from sagemath website

2015-06-08 Thread Nicolas M. Thiery
On Mon, Jun 08, 2015 at 09:48:17AM +0200, Nathann Cohen wrote:
 I don't doubt it. But perhaps you should stop considering Sage's
 website as a convenient way to store your pages. It strikes me at the
 moment that I am the one trying to rearrange sage-combinat's and
 mupad-combinat's bibliography, while your role is to tell me how you
 want it arranged. The time that you save for yourself is the time
 that others (e.g. me) spend managing what you don't want to think
 about.

Why do you need to rearrange/manage those pages at all? Just leave
them as they are. I don't see the cost of this.


Nicolas
--
Nicolas M. Thiéry Isil nthi...@users.sf.net
http://Nicolas.Thiery.name/

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


Re: [sage-combinat-devel] Re: remove combinat/mupad from sagemath website

2015-06-07 Thread Nicolas M. Thiery
Hi,

First: thank you Nathann for your work on the web site! Simplification
is good.

On Sun, Jun 07, 2015 at 02:28:12AM -0700, Nathann Cohen wrote:
 More precisely, I propose to:
 
 - Remove the Publications Mupad page.
 
   This software is not Sage, is not part of Sage either, and has not been
   maintained for the past 7 years according to its website. This page of
   publications is also unmaintained, e.g. there is a 'preprint' from 1999.
 
 - Merge Publications Sage and Publications Combinat into one page:
 
   (by 'merging' I mean having them all on one page, first the 'pure-sage'
   publications then the 'combinat' publications in another group)
 
   For a while, there would be a redirection from the current sage-combinat
   publication page to the right place in the merged 'all-publications' page

I don't have a strong opinion. Here is a collection of thoughts.

- It's important to keep track of publications using Sage in order to
  have some sort idea of the usefulness of all the work we put into
  it. I further believe it's important to refine this further, to have
  some idea of the usefulness of the work we put in each of the
  various areas of Sage. There is nothing specific about combinatorics
  here: being able to roughly tell how many publications used e.g. the
  number theory or the graph code, or GAP, or ... would be good.  See
  e.g. what's done in Magma:

https://magma.maths.usyd.edu.au/magma/citations/

- As a bunch of code, MuPAD-Combinat is indeed dead. I am in fact
  amazed to occasionally hear that some people are still using it,
  despite its development being stopped since 7 years now, by an
  explicit decision. However a software project is also very much
  about the accumulated know how, and the community; both of those are
  still alive, reincarnated and very much expanded in Sage.

- It was useful for us, and still is, to keep track of the
  publications citing MuPAD-Combinat and Sage-Combinat. At the time,
  Minh and Harald offered us to use the same infrastructure as for the
  Sage list for both, which was very convenient.

So now, what to do from there?

- The MuPAD-Combinat citation list is unlikely to evolve much more. I
  agree that there is no compelling reason to have a link sagemath.org
  - Library - Citations MuPAD; so if you want to remove that link,
  that's fine with me. On the other hand, there probably isn't much
  cost nor confusion involved in keeping the page:

http://www.sagemath.org/library-publications-mupad.html

  just to save the time on relocating it elsewhere. Also I would find
  natural to have a link from the Sage-Combinat list to that list,
  with a word of explanation.

- Rather than having two citation pages, one for Sage, and one for
  Sage-Combinat, it would indeed seem natural to me to have a single
  page containing all citations, with some tagging mechanism allowing
  the extraction of citations mentioning a particular area of Sage, as
  is done for e.g. Magma (quite often a citation could refer to
  several areas of Sage; tags are a good way to reflect this).

  What you propose is some sort of first step in this direction.

Cheers,
Nicolas
--
Nicolas M. Thiéry Isil nthi...@users.sf.net
http://Nicolas.Thiery.name/

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


Re: [sage-combinat-devel] Re: remove combinat/mupad from sagemath website

2015-06-07 Thread Nicolas M. Thiery
On Sun, Jun 07, 2015 at 11:44:10PM +0200, Nathann Cohen wrote:
  No. Please reread.
 
 Same result. Care to make yourself clearer?

   Nicolas:
   On the other hand, there probably isn't much
   cost nor confusion involved in keeping the page:
 
 http://www.sagemath.org/library-publications-mupad.html
 
   just to save the time on relocating it elsewhere.

I'd appreciate if you would keep that page where it is.

Cheers,
Nicolas
--
Nicolas M. Thiéry Isil nthi...@users.sf.net
http://Nicolas.Thiery.name/

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


Re: [sage-combinat-devel] Re: remove combinat/mupad from sagemath website

2015-06-07 Thread Nicolas M. Thiery
On Sun, Jun 07, 2015 at 11:35:35PM +0200, Nathann Cohen wrote:
  With the amendments I mention above, I am ok with it.
 
 I noted two:
 1) A link from the new (merged) page to the Mupad-combinat page

Yes.

 2) You will relocate the mupad page to mupad-combinat's home page, and
 send me an email when it is done so that we can remove it from Sage's
 server and update the links.

No. Please reread.


Nicolas
--
Nicolas M. Thiéry Isil nthi...@users.sf.net
http://Nicolas.Thiery.name/

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


Re: [sage-combinat-devel] How to set the category of finite Coxeter groups properly?

2015-06-04 Thread Nicolas M. Thiery
Hi Christian!

On Thu, Jun 04, 2015 at 03:52:57PM -0500, Christian Stump wrote:
 But if I add a method CoxeterGroups().Finite().super_categories
 returning that,

For an axiom category like CoxeterGroups.Finite, the method
super_categories is implemented to automatically deduce the super
categories from the axiom Finite and the base category
CoxeterGroups. Overriding super_categories to specify additional
super categories breaks this; so instead one need to implement
extra_super_categories.

 I run into trouble:
 
 1. Now, the repr of CoxeterGroups().Finite() is Category of finite
 well generated coxeter groups. How do I get rid of the well
 generated there?

Here, since the base category and axiom for FiniteCoxeterGroups is not
specified explicitly, the repr is built automatically from the repr of
the base category and the axioms that are not axioms of the base
category. This is just a heuristic and is not always perfect. If the
problem still appears once the super categories are fixed, you can
work around it by adding this line:

class FiniteCoxeterGroups:

_base_category_class_and_axiom = (CoxeterGroups, Finite)


 2. Many doctests in CoxeterGroups().Finite() now fail. I do not
 understand how doctests can break there at all since I did only add
 some new methods. Or did I also overwrite some -- and if so, how do I
 prevent the system doing so?

Presumably there is some super category missing and this will be
resolved with the above.

Cheers,
Nicolas
--
Nicolas M. Thiéry Isil nthi...@users.sf.net
http://Nicolas.Thiery.name/

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


Re: [sage-combinat-devel] Re: map_coefficients factor

2015-04-22 Thread Nicolas M. Thiery
On Tue, Apr 21, 2015 at 11:44:02AM -0700, 'Martin R' via sage-combinat-devel 
wrote:
I just pushed an initial try.  If you care, could you have a look
whether it's in principle OK?

Thanks for taking action!

I just commented on it on the ticket [1]. Please anyone interested by
`.map_coefficients(f, check=True)` have a look at the ticket and let's
continue the discussion there.

Nicolas

[1] http://trac.sagemath.org/ticket/18264

--
Nicolas M. Thiéry Isil nthi...@users.sf.net
http://Nicolas.Thiery.name/

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


Re: [sage-combinat-devel] Re: map_coefficients factor

2015-04-20 Thread Nicolas M. Thiery
On Sat, Apr 18, 2015 at 12:10:47PM -0700, 'Martin R' via sage-combinat-devel 
wrote:
Sorry, I should have made myself clearer: I do not understand the
design decision behind the way map_coefficients works.
Shouldn't it rather check whether the function actually produces
something in the coefficient ring?

That's the usual speed vs safety vs flexibility. We definitely want to
have a fast map_coefficients that does no check, for those cases where
we know that f is an endofunction as specified by the
documentation. In some cases the user can find it handy to abuse the
system a bit (like Mike is doing), just for output. In all other cases
it would be preferable to have systematic checks.

Supporting both speed vs safety boils down to adding an option
`check=True`, and if possible going trough the Sage code and setting
`check=False` wherever we know we are on the safe side. It's an easy
change. Volunteers welcome!

For supporting cleanly Mike's needs for flexibility, we really would
need to change the base ring. It would be nice to have some idiom
like:

sage: f.map_coefficients(factor, codomain=SR)

or

sage: f.change_base_ring(SR).map_coefficients(factor)

This one is a bit trickier.

Cheers,
Nicolas
--
Nicolas M. Thiéry Isil nthi...@users.sf.net
http://Nicolas.Thiery.name/

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


Re: [sage-combinat-devel] Re: the base_ring method of subcategories of modules

2015-03-26 Thread Nicolas M. Thiery
Hi Mark!

On Mon, Mar 23, 2015 at 12:17:34PM -0700, Mark Shimozono wrote:
I am trying to think of a decent way to have an arbitrary
subcategory of Modules() to inherit the base_ring method.
Would it be possible to have special kinds of methods/attributes
that are inherited by Category_over_base
from the base category? (Of course I have :method:`base_ring`
in mind).  Ditto for any category constructor through which one might
want to inherit methods.
Does a JoinCategory inherit from its supercategories
automatically (or could the above idea be implemented for
JoinCategories
as well)?

Sorry for the slow answer: it's pretty intense here at AIMS while
simultaneously finishing up projects from the Sage Days! I'll reserve
an hour or so soon to think seriously about the issue.

In the mean time ...

If a method is put in SubcategoryMethods, then every subcategory of
Blahs inherits from it::

class Blahs(Category):
def super_categories(self): return [Objects()]
class SubcategoryMethods:
def x(self):
print x, self

class Foos(Category):
def super_categories(self):
return [Blahs()]

sage: Foos().x()
x Category of foos

So this sounds like a good candidate for the desired base_ring
method. There is one caveat though, which is that base_ring needs to
find the appropriate information! SubcategoryMethods gives inheritance
of methods but not of attributes.

Worst case, one could implement base_ring by walking up the category
hierarchy until an actual base_ring method is found, and call it.

Cheers,
Nicolas
--
Nicolas M. Thiéry Isil nthi...@users.sf.net
http://Nicolas.Thiery.name/

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


Re: [sage-combinat-devel] Re: Order of Partitions()

2015-03-18 Thread Nicolas M. Thiery
Hi!

Thanks everyone for your input. We are banging hard on IntegerListLex
at Sage Days 64, and hopefully will get a correct and as fast as
previously implementation in the coming days. Don't hold your breath,
but the point is that it's likely that the non lex is faster is only
a temporary effect.

Btw: I'd like to thank Jeroen for his hard work on an alternative
polytope based implementation (#17920). Even with the hopefully
upcoming IntegerListLex, every bit of his work will be useful:

- Iteration over polytopes which is a generally useful feature
- Lots of documentation and tests that we will recycle
- An alternative implementation to run comparative tests
- The connection with polytopes, which will be useful for other
  operations (counting, and maybe others)

Cheers,
 Nicolas


On Wed, Mar 18, 2015 at 02:28:36PM +0100, Viviane Pons wrote:
2015-03-18 12:40 GMT+01:00 Mike Zabrocki [1]mike.zabro...@gmail.com:
 
That would make sense.  My preference is that (at least for values less
than 15) the default is that the output is sorted and this can be
controlled by the optional parameter.
I think about how many times that I test symmetric function identities
on partitions and realize that patterns that indicate a relation to
dominance order will be a lot less clear if the order is not something
natural.  I wouldn't want the interface to be too complicated, but the
more I think about it the more I realize that my personal use of
partitions is very dependent on this order.
 
I would tend to agree with you. The order wasn't documented but I'm
pretty sure many people writing some personal code using partitions
still rely on the order somehow. I feel a good choice would be to give
the nice order by default and some parameter to obtain the optimized
one.
 
On Wednesday, 18 March 2015 04:20:15 UTC-4, Samuel Lelievre wrote:
 
Nathann Cohen wrote:
 
  Hello,
   I think that Partitions should be output in either lex (or
  possibly reverse
   lex) since this order is compatible with dominance order.
  I only want to bring to your attention that deciding in which order
  the partitions should be returned is not free in terms of
  computational time.
  The current implementation returns them in lex order, but returns
  *many* wrong answers too (see #17548).
  In order to fix that, Jeroen is re-implementing this feature through
  a
  routine that enumerates the integer points of a polytope (see
  #17920),
  probably without any control over the order in which they are
  returned.
  Thus, in order for Partition/Composition to return them in a
  specific
  order we must list them *all* before returning the first of them.
  This
  can really mean hours (or no results at all) instead of seconds on
  big
  instances.
 
So would it make sense to have an optional parameter sorted=None,
which one could set to 'lex' or 'revlex' to get them in a desired
order.
The documentation could warn about the issues you just raised.
 
--
You received this message because you are subscribed to the Google
Groups sage-combinat-devel group.
To unsubscribe from this group and stop receiving emails from it, send
an email to [2]sage-combinat-devel+unsubscr...@googlegroups.com.
To post to this group, send email to
[3]sage-combinat-devel@googlegroups.com.
Visit this group at
[4]http://groups.google.com/group/sage-combinat-devel.
For more options, visit [5]https://groups.google.com/d/optout.
 
--
You received this message because you are subscribed to the Google
Groups sage-combinat-devel group.
To unsubscribe from this group and stop receiving emails from it, send
an email to [6]sage-combinat-devel+unsubscr...@googlegroups.com.
To post to this group, send email to
[7]sage-combinat-devel@googlegroups.com.
Visit this group at
[8]http://groups.google.com/group/sage-combinat-devel.
For more options, visit [9]https://groups.google.com/d/optout.
 
 Références
 
1. mailto:mike.zabro...@gmail.com
2. mailto:sage-combinat-devel+unsubscr...@googlegroups.com
3. mailto:sage-combinat-devel@googlegroups.com
4. http://groups.google.com/group/sage-combinat-devel
5. https://groups.google.com/d/optout
6. mailto:sage-combinat-devel+unsubscr...@googlegroups.com
7. mailto:sage-combinat-devel@googlegroups.com
8. http://groups.google.com/group/sage-combinat-devel
9. https://groups.google.com/d/optout
Nicolas
--
Nicolas M. Thiéry Isil nthi...@users.sf.net
http://Nicolas.Thiery.name/

-- 
You received this message because you are subscribed to the Google Groups 
sage-combinat-devel group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to 

Re: [sage-combinat-devel] Re: obtaning meet semi-lattices with n elements

2015-03-12 Thread Nicolas M. Thiery
On Thu, Mar 12, 2015 at 02:00:37AM -0700, Nathann Cohen wrote:
As Sage is open-source you can usually answer such questions by reading
the code, or the function's documentation.
In this specific case, however, I do not know if we actually have this
feature in Sage: do you *know* how to enumerate meet-semilattices in
Sage? If so please share the commands, and we will probably find in the
doc a description of the algorithm it implements.

As far as I know, it is not implemented. There is a tiny note about
this at the end of:

sage.combinat.tutorial?

In theory it should be possible to use the tool ``graphs`` to generate
graphs up to an isomorphism, using an orderly generation along the
vertices. However, when we tried this with Tom Denton a couple years
ago, we stumbled on an issue. I can try to recover the details; it was
something about making sure that the new vertices were added to the
top of the meet semi lattice, which required a minimum of control on
the canonical labeling.

Cheers,
Nicolas
--
Nicolas M. Thiéry Isil nthi...@users.sf.net
http://Nicolas.Thiery.name/

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


Re: [sage-combinat-devel] Import error using recusive trees

2015-02-10 Thread Nicolas M. Thiery
Dear Henrik,

On Tue, Feb 10, 2015 at 03:50:01AM -0800, Henrik Sperre Sundklakk wrote:
I am implementing unordered rooted trees in Sage (to use them in
B-series). When trying to iinherit from
sage.combinat.abstract_tree.AbstractClonableTree I get an ImportError.
I have successfully called OrderedTrees() from the notebook, so my Sage
installation is sound. The problem occurs when I use Eclipse.
I launch Eclipse from the Sage shell, and use the Python interpreter
provided by Sage (/usr/lib/sagemath/local/bin/python2.7). I keep my .py
files in a directory in my SAGE_PATH. I have successfully imported and
inherited from classes in Sage (ClonableElement). This code runs, both
in Eclipse and the nootebook.
However, the following line, even when it is the only line in a file,
elicit the following error (as does all attempts to import anything
depending on abstrac_tree):
import sage.combinat.abstract_tree
Traceback (most recent call last):
  File
/home/henrik/Documents/studier/masteroppgave/code/pybs/pybs/scratch2.p
y, line 5, in module
import sage.combinat.abstract_tree# import AbstractClonableTree
  File
/usr/lib/sagemath/local/lib/python2.7/site-packages/sage/combinat/abst
ract_tree.py, line 67, in module
from sage.rings.integer import Integer
  File sage/rings/rational.pxd, line 10, in init sage.rings.integer
(build/cythonized/sage/rings/integer.c:41630)
  File sage/rings/rational.pyx, line 56, in init sage.rings.rational
(build/cythonized/sage/rings/rational.c:30843)
  File
/usr/lib/sagemath/local/lib/python2.7/site-packages/sage/rings/rationa
l_field.py, line 55, in module
import infinity
  File
/usr/lib/sagemath/local/lib/python2.7/site-packages/sage/rings/infinit
y.py, line 213, in module
from sage.rings.integer_ring import ZZ
  File sage/rings/integer_ring.pyx, line 67, in init
sage.rings.integer_ring
(build/cythonized/sage/rings/integer_ring.c:11566)
  File
/usr/lib/sagemath/local/lib/python2.7/site-packages/sage/structure/fac
torization.py, line 188, in module
from sage.misc.all import prod
  File
/usr/lib/sagemath/local/lib/python2.7/site-packages/sage/misc/all.py,
line 89, in module
from functional import (additive_order,
  File
/usr/lib/sagemath/local/lib/python2.7/site-packages/sage/misc/function
al.py, line 36, in module
from sage.rings.complex_double import CDF
  File sage/rings/real_double.pxd, line 8, in init
sage.rings.complex_double
(build/cythonized/sage/rings/complex_double.c:20095)
  File sage/rings/real_double.pyx, line 56, in init
sage.rings.real_double
(build/cythonized/sage/rings/real_double.c:22825)
ImportError: cannot import name ZZ
Since recursive trees work from the notebook, I guess the problem is me
doing something wrong trying to import it, but I can't think of what it
is...

You may want to try something like

import sage.all
import sage.combinat.abstract_tree

The core Sage library currently is brittle if it's not loaded in the
right order, and in particular if it's partially loaded from a
specific entry point. Importing sage.all is a way to load the core
first, and then access specific stuff.

Thanks for working on unordered trees!

Cheers,
Nicolas
--
Nicolas M. Thiéry Isil nthi...@users.sf.net
http://Nicolas.Thiery.name/

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


Re: [sage-combinat-devel] combinat.math.washington.edu

2015-01-04 Thread Nicolas M. Thiery
Dear William,

On Sat, Jan 03, 2015 at 08:23:15PM -0800, William Stein wrote:
 The computer combinat.math.washington.edu is down... again.  Sort of.
 It responds to ping requests, but I can't ssh in.
 
 I suspect that not a lot of people are actively using it lately, since
 this is the second time it has gone down for over a week in the last 3
 months, and nobody (except my student Hao Chen), seems to have
 noticed.

I actually had noticed that the web server was down a couple weeks ago
and recently, but had not gotten the time to report.

 I'm considering doing the following.  I'll shutdown combinat
 completely, reformat the disk, and set it up as a node of the
 cloud.sagemath.com (SMC).   It'll still have the amazing 64 cores and
 huge (192GB) RAM.  However, instead of login in directly to it, people
 can email me to request that I move a particular SMC project to
 combinat.  It will then have access to expanded compute resources.
 The advantage of this, is that it is much easier for me to maintain.
 In particular, SMC has automated scripts to take care of using cgroups
 to explicitly limit usage of compute resources by a given project, I
 have extensive monitoring code in place so I know when things go down,
 and I everything runs in virtual machines, so when there are problems
 I can easily fix them in a few minutes remotely.  Also, it's much
 easier to grant fair usage to projects.As it is now with default
 linux on combinat, basically any user can just bring down the computer
 by using too much memory/disk/whatever, which is probably what
 happened in this case (I don't know).
 
 Thoughts?
 
 Obviously, this may be a bit slower and the max memory will be less
 (as things are in a VM) for specific research-level computations.
 However, a working computer is way better than a regularly-crashing
 computer, in my opinion.Also, given the weeks of downtime that
 nobody (except Hao) notices, maybe people aren't using combinat at all
 anyways, due to it being only a remote linux box.   Personally, I
 think SMC makes using remote Linux boxes much easier.

I believe people are actually using combinat relatively intensively,
but on a peak basis. Or for very long term calculations. So there can
indeed be long periods where they don't connect.

We had already discussed running the calculations on combinat within
virtual machines, for safeguards, ease of access and
checkpoints. Going through SMC seems a reasonable way to achieve
this. So +1 on my side, especially now that it's open source!

Besides, it will give me an occasion to use SMC seriously, which I
should for our VRE grant :-)

Cheers,
Nicolas
--
Nicolas M. Thiéry Isil nthi...@users.sf.net
http://Nicolas.Thiery.name/

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


[sage-combinat-devel] Re: sage-trac-account, I wish to devolop a library for multiple zeta values

2014-12-18 Thread Nicolas M. Thiery
Dear Akhilesh,

Thanks for getting in touch. I am forwarding your e-mail to
sage-combinat-devel, as others there might be interested in some or
all of the topics you mention.

For the trac account, see the instructions on http://trac.sagemath.org/

On Thu, Dec 18, 2014 at 11:51:45AM +0530, akhilesh p wrote:
  I am Akhilesh, Student in Harish-Chandra
Research Institute (HRI) Allahabad. We met in Sage Days 60 workshop at
IMSc chennai. That time I missed to take Sage trac account. I wish to
develop one multiple zeta library Sage that contains
1. Computing Multiple zeta function with very high accuracy (1000 or
1 digit precision or any)
2. Shuffle product and Stuflle product in fast and efficient way
3. Computing the values of logarithm with very high accuracy for a
complete set of numbers from {2,3,...N} in a very efficient way
4. Computing the values of Bernoulli numbers for a complete set of
numbers from {2,3,...N} in a very efficient way.
5. Computing Derivatives  Multiple zeta function with very high
accuracy (1000 or 1 digit precision or any)
6. Currently the PSLQ algorithm in sage can handle up 100 numbers. I
like write another program which can handle up to 1000 numbers
I kindly requesting you help me to get trac account in Sage
sincerely
Akhilesh P.
Research Scholar
HRI
Allahabad

Kind regards,
Nicolas
--
Nicolas M. Thiéry Isil nthi...@users.sf.net
http://Nicolas.Thiery.name/

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


Re: [sage-combinat-devel] A small hint in Symmetric Functions

2014-11-21 Thread Nicolas M. Thiery
Salut Nicolas!

On Thu, Nov 20, 2014 at 12:19:15PM +0100, Nicolas Borie wrote:
 As I was constructing some Free Modules over the symmetric
 functions, I fall on this (sage 6.4.beta2 for my version (yes,
 that's probably old)):
 
 sage: SymmetricFunctions(QQ) in CommutativeRings()
 False
 sage: SymmetricFunctions(QQ).a_realization() in CommutativeRings()
 True
 
 I would have loved that the two lines return True. If I say no
 mistakes, the symmetric functions should be an abstract parent with
 severals realizations. The category is *probably* initialized in
 sf.py with the line:
 
 Parent.__init__(self, category = GradedHopfAlgebras(R).WithRealizations())
 
 Is this enought to change this category for the following one (with
 QQ replaced by R in the source code naturally) ?
 
 sage: GradedHopfAlgebras(QQ).Commutative().WithRealizations()

+1

While you are at it, you might as well want to go for:

  HopfAlgebras(R).Graded().Connected().Commutative().WithRealizations()

 Perhaps this question is relatively empty but I didn't contribute to
 Sage for something like a year. I just reviewed 2 tickets the last 6
 month and I am still scared of using git (don't laugh please!). So I
 asked before since a such one line patch cost 10 minutes for git
 lovers but probably 2 hours with the cheat-sheet of Volker for me.
 Ok, I just heard someone saying that it will need one than one line
 since it could be nice to add the proper test in the
 documentation... Rhoo

This sounds like a perfect ticket for a come back. The extra time
you'll spend there is a long term investment anyway.

Cheers,
Nicolas
--
Nicolas M. Thiéry Isil nthi...@users.sf.net
http://Nicolas.Thiery.name/

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


Re: [sage-combinat-devel] Making code for some seminormal representations faster

2014-11-21 Thread Nicolas M. Thiery
Hi Andrew,

On Fri, Nov 21, 2014 at 05:55:51AM -0800, Andrew wrote:
I'm currently going around in circles with some CombinatorialFreeModule
woes. The previous code for these alternating seminormal forms works,
but in order to cope with the many variations of seminormal
representations that I decided to implement working I've have had to
jazz things up quite a lot. Now my basic class structure looks
something like this:
from sage.combinat.free_module import CombinatorialFreeModule
from sage.rings.polynomial.polynomial_ring_constructor import
PolynomialRing
class A(CombinatorialFreeModule):
def __init__(self, base_ring, basis_keys, prefix='a', **kwargs):
super(A,self).__init__(base_ring, basis_keys, prefix=prefix,
**kwargs)
class Element(CombinatorialFreeModule.Element):
pass
class B(A):
def __init__(self, base_ring, basis_keys, prefix='b', **kwargs):
super(B,self).__init__(base_ring, basis_keys, prefix=prefix,
**kwargs)
class C(B):
def __init__(self, shape, prefix='c', **kwargs):
base_ring=PolynomialRing(Integers(), 'q')
super(B,self).__init__(base_ring, shape.standard_tableaux(),
prefix=prefix, **kwargs)
This simplified code works fine. For example,
sage: C(Partition([3,2])).an_element()
2*c[[[1, 2, 5], [3, 4]]] + 3*c[[[1, 3, 4], [2, 5]]] + 2*c[[[1, 3, 5],
[2, 4]]]
Unfortunately my real code does not work, having issues like:
sage: rep=SeminormalRepresentation([2,1]); rep
SeminormalRepresentation([2,1])# seems to work
OK
sage: rep.an_element() # try to construct an element
repr(sage.algebras.iwahori_hecke_algebras.iwahori_hecke_algebra_repre
sentations.SeminormalRepresentation_with_category.element_class at
0x119a88c80) failed: AttributeError:
'SeminormalRepresentation_with_category' object has no attribute
'_prefix'
sage: rep(StandardTableau([[1,2],[3]]))
AttributeErrorTraceback (most recent call
last)
...
AttributeError: 'SeminormalRepresentation_with_category' object has no
attribute '_basis_keys'
Does anyone have an idea of what is going wrong. Part of the issue
might be all of the super calls, but I tried taking though ut and
explcitly calling the previous class (they are linearly ordered), but
this doesn't help.

Hmm, I haven't taken the time to think with a pen and paper, but I
don't guarantee that the what the super call do is as straightforward
as it ought to, given that the instance of A being initialized will
end up being in a subclass A_with_category, and similarly for the
others.  Does it work if instead you call explicitly A.__init__ in
B.__init__, and so on?

Cheers,
Nicolas
--
Nicolas M. Thiéry Isil nthi...@users.sf.net
http://Nicolas.Thiery.name/

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


Re: [sage-combinat-devel] Making code for some seminormal representations faster

2014-11-15 Thread Nicolas M. Thiery
Dear Andrew,

On Fri, Nov 14, 2014 at 09:02:13PM -0800, Andrew wrote:
I don't believe this: gap3 is less strongly typed than python and it is
possible to do this there! :) The natural way to distinguish between
different bases is using their prefix -- indeed this is effectively
what chevie does and Eric's manifold's code does.

I mean: without knowing something about the semantic of those methods,
how do we know that:

sage: x.antipode()

will return an element of the algebra, and therefore the result shall
be retracted back, whereas:

sage: x.counit()

will return an element of the ground field which needs no transformation?

You are right, we could run those methods on some element and look at
the parent of the result. So, at the price of a dynamic lookup (which
in my past experience is a source of trouble, but that's another
discussion), we could indeed retrieve about the same information as in
a statically typed language.

So let me rephrase my argument: what we really need to know is which
methods are, or not, preserved by the lift and retract changes of
basis. For a stupid example,

sage: x.coeff(lambda)

is not preserved; so no lifting shall be applied in the first place.

The Isomorphic infrastructure is about making the semantic explicit:

- what structure is preserved, or not, by the changes of basis
- which methods are therefore preserved, and how to handle them
  through coercion

As a cherry on the cake this makes it possible to say F is isomorphic
to G as an algebra, but not as a coalgebra.

Cheers,
Nicolas
--
Nicolas M. Thiéry Isil nthi...@users.sf.net
http://Nicolas.Thiery.name/

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


Re: [sage-combinat-devel] Making code for some seminormal representations faster

2014-11-12 Thread Nicolas M. Thiery
Hi Andrew!

On Tue, Nov 11, 2014 at 03:07:26PM -0800, Andrew wrote:
This is a good start but it is not enough: essentially the difference
between what I want and what this does is the same as the difference
between a vector space isomorphism and an A-module isomorphism. As you
pointed out, there are limitations if these objects are algebras. The
same limitations apply to modules because any interesting
CombinatorialFreeModule will come equipped with endomorphisms, actions
and other methods. I would like a mechanism for automatically
transferring these methods to the new module by implicitly invoking the
coercions above. These methods will be both module methods and module
element methods and, more generally, algebra and algebra element
methods.
I don't think this this should be hard to do within the existing
framework, and the mechanism should be roughly what you have above.
After all, this is easy enough to do by hand because if F has a nice
method then
 
sage: G(F(G.an_element()).nice_method())
 
transfers the method to G. The trick is to find an efficient, and
seamless, way of doing this. If F is the original
CombinatorialFreeModule (with distinguished basis), then the simplest
hack would be to make __getattr__ in the class for G call the methods
of F whenever they are not defined. So something like:
 
def __getattr__(self, attr):
 try:
 return self(getattr(F(self), atttr))
 except AttributeError:
 pass
 raise AttributeError('{} has no attribute {}\n'.format(self,attr))
 
The disadvantage of this approach is that it does not respect
tab-completion and documentation, so it's probably going to be better
to play some inheritance tricks.
In terms of interface, I'd like to set up something like this:
sage: G=F.new_basis([4,5,6],basis_to_new_basis=phi,
new_basis_to_basis=psi,...)
This should accept a subset of the CombinatorialFreeModule arguments
(for example, basis_keys, prefix, ...), as well as coercions to other
bases for the module. As I said I'll try and think more about this.
This would certainly be useful for me. Let me know if it is unlikely to
be useful for others.

Another disadvantage is that, given that methods in Python are not
typed, it's impossible to make a difference between methods that
return an element of G or of elsewhere, and add coercions as
appropriate.  Hence a brute-force approach as above is likely to give
out wrong results. I believe we really need to write the wrapper
methods by hand.

The good news is that there already is infrastructure for this :-) It
works well in situations like this where there is a single parent one
wants to pull operations from through isomorphisms. Here I am
constructing a free module which is endowed with a Hopf algebra
structure by declaring it as isomorphic to the group algebra of the
symmetric group::

sage: G = SymmetricGroup(3)
sage: F = G.algebra(QQ)
sage: G = CombinatorialFreeModule(QQ, range(6), 
category=HopfAlgebras(QQ).FiniteDimensional().WithBasis().IsomorphicObjects())
sage: G.retract = F.module_morphism(lambda g: G.monomial(G.rank  (g)), 
codomain=G)
sage: G.lift= C.module_morphism(lambda g: F.monomial(G.unrank(g)), 
codomain=F)
sage: G.ambient = lambda : F
sage: G.an_element()^2
17*B[0] + 8*B[1] + 12*B[2] + 6*B[3] + 6*B[4]

This works because, once in the Sage code, it has been explained that
if G is a quotient (more generally a subquotient) of F, then a product
in G can be calculating by lifting to F and retracting back.

The following does not work yet, but it would be easy to add
appropriate methods for coalgebras in Coalgebras.Subquotients:

sage: C.an_element().coproduct()
*boom*

In general every category should eventually specify how its operation
pass to subobjects, quotients, etc.

The thematic tutorial I mentioned previously has a section with an
example like this.

Cheers,
Nicolas
--
Nicolas M. Thiéry Isil nthi...@users.sf.net
http://Nicolas.Thiery.name/

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


Re: [sage-combinat-devel] Making code for some seminormal representations faster

2014-11-11 Thread Nicolas M. Thiery
Dear Andrew, dear Éric,

On Tue, Nov 11, 2014 at 12:33:35AM -0800, Andrew wrote:
My comment wasn't intended as a criticism of the code or of anyone:

No worry, there was no ambiguity :-)

Down the track, what I would like to see is a way of dynamically
adding bases to a CombinatorialFreeModule without these new bases
having to be part of the sage source code. For example, it is
possible to do this in chevie.

Is this close enough from what you would want?

sage: F = CombinatorialFreeModule(QQ, [1,2,3])
sage: G = CombinatorialFreeModule(QQ, [4,5,6])
sage: phi = F.module_morphism(lambda i: G.monomial(i+3), codomain=G)
sage: psi = G.module_morphism(lambda i: F.monomial(i-3), codomain=F)
sage: phi.register_as_coercion()
sage: psi.register_as_coercion()

sage: F(G.an_element())
2*B[1] + 2*B[2] + 3*B[3]
sage: G(F.an_element())
2*B[4] + 2*B[5] + 3*B[6]
sage: F.an_element() + G.an_element()
4*B[1] + 4*B[2] + 6*B[3]

There are more details in the Sage-Combinat tutorial «Implementing
Algebraic Structures»:


http://combinat.sagemath.org/doc/thematic_tutorials/tutorial-implementing-algebraic-structures.html#tutorial-implementing-algebraic-structures

There is one main limitation: if F and G are algebras, you need to
define explicitly the product on both sides (possibly trivially by
doing the back and forth with the other side). In MuPAD, the coercion
system did automatically the right thing ...

From my quick look at the manifold code, it seems that it allows
something in this direction.

I added Eric Gourgoulhon in CC to point him to this thread.

Cheers,
Nicolas
--
Nicolas M. Thiéry Isil nthi...@users.sf.net
http://Nicolas.Thiery.name/

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


Re: [sage-combinat-devel] Making code for some seminormal representations faster

2014-11-11 Thread Nicolas M. Thiery
On Mon, Nov 10, 2014 at 02:47:21PM -0800, Andrew wrote:
This is probably the most sensible thing to do, and certainly seems to
be the consensus. Just for fun there are also degenerate and
non-degenerate forms of these representations.

I love 0-Hecke :-)

I'm slightly bemused, however, because I'm fairly sure that, for the
quadratic relation (T_r-u)(T_r-v), these representations do not exist
in the literature.

In similar situations, we indeed had to work out a bit the details to
get the code right with completely generic parameters :-)

Consequently, I suspect that this level of
generality will never be used. There may also be a speed penalty
because rational function fields in one variable are probably more
efficient than function fields in two variables (for type B and higher
this comment isn't relevant.). On the other hand, allowing a general
quadratic relation is probably the easiest way to support the two most
common forms of the quadratic relations: (T_r-q)(T_r+1)=0 and
(T_r-q)(T_r+q^{-1})=0.

It's only a (potential) problem if the user actually specifies generic
parameters. But in most cases, people will specify their parameters in
their own preferred form, and the calculation will happen within the
field containing those parameters. In short, the code is generic, not
necessarily the calculation.

(Btw, the same remarks apply to the implementation of the
KL-bases in sage: what we have is more general than you will find
in the literature and it automatically works for different
quadratic relations and for arbitrary coefficient rings provided
that the KL-bases are well-defined.)

Yup.

I didn't know about the HeckeAlgebraRepresentation class that is
defined in this module. I have defined a class,
IwahoriHeckeAlgebraRepresentation, that is meant to be a generic class
for defining representations of an Iwahori-Hecke algebra as
CombinatorialFreeModules. The class in root_system is mainly for affine
Hecke algebras and it is quite different to what I am doing, but even
so I am slightly uneasy about introducing a new class that has a
similar name and functionality to an existing class. It seems to me
that a better name for the root_system class is
AffineHeckeAlgebraRepresentation, at least this would help distinguish
between the two. Perhaps this code would also sit more naturally in the
new directory sage.algebras.iwahori_hecke_algebras? Is there a better
name for my class? Does anyone have any thoughts on this? (Particularly
Anne and Nicolas as this is their code...)

People have started using NSym Macdonald polynomials. But I don't
think many -- if any -- are using directly the
HeckeAlgebraRepresentation class. So feel free to move it around
and/or refactor it. It would definitely be sensible to have two
classes in the sage.algebras.hecke_algebras:

class IwahoriHeckeAlgebraRepresentation:
class 
AffineIwahoriHeckeAlgebraRepresentation(IwahoriHeckeAlgebraRepresentation):

This of course assumes (and fosters!) some common ground between the
two classes. And also assumes that your class is for any Cartan
type. If it's only for finite type, then maybe this should be instead
something like:


class IwahoriHeckeAlgebraRepresentation:
class 
FiniteIwahoriHeckeAlgebraRepresentation(IwahoriHeckeAlgebraRepresentation):
class 
AffineIwahoriHeckeAlgebraRepresentation(IwahoriHeckeAlgebraRepresentation):

Cheers,
Nicolas
--
Nicolas M. Thiéry Isil nthi...@users.sf.net
http://Nicolas.Thiery.name/

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


Re: [sage-combinat-devel] Re: Left and right cells of Coxeter groups

2014-11-10 Thread Nicolas M. Thiery
On Mon, Nov 10, 2014 at 02:28:15AM -0800, Andrew wrote:
OK, I have figured out how to make left cells but now the question is
where to put this?

Thanks for investigating! I guess this would be a cell method of
Coxeter groups, possibly only provided by certain
implementations. Would you have an example of input and output to
settle on the specifics?

I just made a quick grep in the sources of Coxeter 3, and there is a
file wgraph.cpp, with functions like OrientedGraph::cells. Cells are
also mentioned quite some in INTRO.tex. So for our Coxeter groups
using Coxeter 3 as backend implementation, it's probably just a matter
of wrapping those functions to make them accessible as well from
Sage. And they are likely to be very efficient given Coxeter 3's
emphasis on computing KL polynomials.

Cheers,
Nicolas
--
Nicolas M. Thiéry Isil nthi...@users.sf.net
http://Nicolas.Thiery.name/

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


Re: [sage-combinat-devel] Making code for some seminormal representations faster

2014-11-10 Thread Nicolas M. Thiery
On Thu, Nov 06, 2014 at 04:51:40PM -0800, Anne Schilling wrote:
 Wouldn't it make most sense to use the quadratic relation
 
 $(T_r-q)(T_r-v)=0$
 
 since the other ones can be obtained by appropriate specialization?

I definitely vote for this as well. That's what Alain always
recommended to me, and the practicality of the approach was confirmed
by our experience when implementing Non Symmetric Mac Donald
polynomials. See for example:

sage/combinat/root_system/hecke_algebra_representation.py

  In thinking about this it seems to me that currently there is no
  framework in sage for dealing with module that has more than one
  natural basis. Is this right? Of course, it is possible to
  define several different CombinatoriaFreeModules and coercions
  between them.

 Examples of how to handle this might be in
 
 combinat/ncsf_qsym

Another approach is to have a single parent, with elements having
potentially several internal representations, and coercions being
handled internally as well. That's what Éric is using in
Sage-Manifolds:

http://sagemanifolds.obspm.fr/

 put all of this code in a new directory sage.algebras.iwahoriheckeagebras/

Sounds good to me.

Cheers,
Nicolas
--
Nicolas M. Thiéry Isil nthi...@users.sf.net
http://Nicolas.Thiery.name/

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


Re: [sage-combinat-devel] Making code for some seminormal representations faster

2014-11-06 Thread Nicolas M. Thiery
On Thu, Nov 06, 2014 at 01:04:30AM -0800, Andrew wrote:
Yes, you're right, this is almost certainly on the roadmap. In any
case, as Nicolas and Travis are both in favour I'll try and make time
to properly wrap and prettify the code, create a ticket and push it to
git and trac or comments and review. I'll first have to think a little
harder about the best interface.I will probably end up implementing the
seminormal representations simultaneously for the symmetric groups and,
more generally, he Hecke algebras of type A, B, ..., G(r,1,n) as in the
end thee are all the same.

Nice! This might be the occasion to add a ``cartan type'' for G(r,1,n).

Yes this is a good idea, but now there are some questions.
 1. Left modules or right modules, or both? (My current methods you can
interpret as either.)

I would say both if there is no complexity overhead:

G.representation(..., side=left/right)

 2. What is the best syntax for the action?
The first question is not a big deal. For the second the following is
probably the most natural answer::
sage: A=SymmetricGroupAlgebra(QQ,3)
sage: rep=SeminormalRepresentation([2,1])
sage: a=A.an_element(); a
2*[1, 2, 3] + 2*[1, 3, 2] + 3*[2, 1, 3]
sage: r=rep.an_element(); r
2*f(1,2/3) + 2*f(1,3/2)
sage: a*r  # left action
???
 
Using a*r for the left action, and r*a for the right action, seems to
be the natural syntax. Is there already a mechanism in place for doing
this? I assume that there is, but I don't know it. Can some one point
me in the right direction?

I would do like in math: define first a notation which makes the
representation explicit, and then, if there is an ambiguity from the
context define a shorthand.


So, if you think of rep as a module, this could be:

rep.action(a, r)

Alternatively, if you think of rep as a representation, this could be:

rep(a)(r)

Then we can optionally setup the following as syntactic sugar:

a*r or r*a

However multiplication is already overloaded quite some, so it's not
even clear we want this as a default.

In all my semigroup representation code, I have used rep.action(a,r)
systematically. One further advantage is that the notation is
side-agnostic; so we can write code on top of it that does not depend
on whether we have a left or right action.

Cheers,
Nicolas
--
Nicolas M. Thiéry Isil nthi...@users.sf.net
http://Nicolas.Thiery.name/

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


Re: [sage-combinat-devel] Making code for some seminormal representations faster

2014-11-05 Thread Nicolas M. Thiery
Dear Andrew,

On Mon, Nov 03, 2014 at 07:23:32PM -0800, Andrew wrote:
Sorry, this is a longish post...

Just a short answer for now: it's been in the TODO list for a while to
have representation matrices for the Hecke algebra (there might be a
ticket about this, and almost certainly a note in the road map). So
progress in this direction is surely welcome, especially if this can
be done uniformly for symmetric groups versus hecke algebras and type
A versus generic type.

By the way, this could be an occasion to make those methods of the
symmetric group / hecke algebra. Something like:

sage: SymmetricGroup(5).representation([3,2], seminormal)

As for speed: do you think the limitation comes from the cost of the
arithmetic in the base field, or from the linear algebra?

Cheers,
Nicolas
--
Nicolas M. Thiéry Isil nthi...@users.sf.net
http://Nicolas.Thiery.name/

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


Re: [sage-combinat-devel] Re: Sage grant

2014-10-30 Thread Nicolas M. Thiery
On Wed, Oct 29, 2014 at 07:09:53PM -0700, Andrew wrote:
I agree with Dima in that it would be great to have some of the basic
ring theory available in improved. There are some basic deficiencies
with (Laurent) polynomial rings, especially in more than one variable
and it would great if all of the problems with quite basic rings could
be ironed out. In addition, my life would be much easier if sage were
able to efficiently compute in the location of a ring at a ideal --
what I would really like is to be able to calculate in modular systems
with parameters, which is my way of saying that I would like to be
able to explicit calculations in modular systems for Iwahori-Hecke
algebras. Implementing all of these gadgets is, perhaps, not so
exciting from the point of view of a grant application, but not having
these basic ring constructions available limits what you can currently
do with sage.

+1. The big question here is whether we have someone with both the
expertise and time to implement those features, and whether the grant
could help provide us such a person ...

Cheers,
Nicolas
--
Nicolas M. Thiéry Isil nthi...@users.sf.net
http://Nicolas.Thiery.name/

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


[sage-combinat-devel] #16256: Refactorisation of the indexes of the combinatorics documentation

2014-09-03 Thread Nicolas M. Thiery
Hi,

This is just to advertise #16256 which reorganize the various index
pages of the sage.combinat documentation to be closer to the
sources. For example, the thematic index:

src/doc/en/reference/combinat/crystals.rst

is now in:

src/sage/combinat/crystals/__init__.py

and is accessible through:

sage: sage.combinat.crystals?

Among other advantages (see the ticket for details), this makes the
indexes more flexible. For example, when natural, one can reference a
given piece of doc from several spots, or reference docs from
elsewhere in the reference manual. The end result is browsable from:


http://sage.math.washington.edu/home/nthiery/sage/src/doc/output/html/en/reference/combinat/index.html

I would appreciate feedback on:

- Whether this sounds reasonable from a user point of view

- Whether this sounds reasonable from a dev point of view

- Possible improvements to the indexes themselves (e.g. more cross
  links, better classification, ...)

For those that maintain some of those indexes (e.g. Travis for rigged
configurations), I would appreciate if you could double check that
they look good and that nothing was lost in the process, and notify
this on the ticket.

Thanks in advance!

Cheers,
Nicolas
--
Nicolas M. Thiéry Isil nthi...@users.sf.net
http://Nicolas.Thiery.name/

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


Re: [sage-combinat-devel] #16256: Refactorisation of the indexes of the combinatorics documentation

2014-09-03 Thread Nicolas M. Thiery
On Wed, Sep 03, 2014 at 08:27:26AM -0700, Anne Schilling wrote:
 It does not seem to be there

Thanks for the report. It's back there. It was in the middle of a slow
running make doc-clean; make doc ...

Hmm, I should maybe just come back to a good old rsync for updating
the doc out-there. It's more network intensive but more reliable and
atomic.

Cheers,
Nicolas
--
Nicolas M. Thiéry Isil nthi...@users.sf.net
http://Nicolas.Thiery.name/

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


[sage-combinat-devel] Re: [sage-devel] Re: quiver algebra

2014-07-12 Thread Nicolas M. Thiery
On Fri, Jul 11, 2014 at 09:42:15PM +, Simon King wrote:
 +1
 
 There is a method .homogeneous_component(d). Maybe there should be a
 method .homogeneous_component_iter(), iterating over them. But the
 default iterator should iterate over elements.

Ok!

 Shouldn't it be the job of CombinatorialFreeModule to provide a generic
 iterator, relying on the iterators over the base ring and the indexing
 set for the basis? This is currently missing.

Yes. Or probably Modules.WithBasis.FiniteDimensional.Finite. Well, we
also need the base ring to be enumerated, but the category for modules
over an enumerated set. Hmm, we could even just have
Modules.FiniteDimensional inherit from CartesianProduct(...); but
until we have CartesianPower, that probably would be memory
inefficient (since we would need to store the list [R,...,R] of the
cartesian factors).

I'll think about this if this can fit in #1.

Cheers,
Nicolas
--
Nicolas M. Thiéry Isil nthi...@users.sf.net
http://Nicolas.Thiery.name/

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


Re: [sage-combinat-devel] Re: Extednding tableaux

2014-07-11 Thread Nicolas M. Thiery
On Thu, Jul 10, 2014 at 09:25:05AM -0700, Travis Scrimshaw wrote:
On Thursday, July 10, 2014 7:11:52 AM UTC-7, Andrew wrote:
 
I have this vague memory that some one was thinking of
extending/rationalising/reorganising the tableaux code so that it
fitted together better (whatever this might mean:). Does this ring any
bells with anyone?
I ask because I think that I need to implement row standard tableaux
(possibly of composition shape).

Attached are some notes we had taken together when we discussed last
year in Tour.

Cheers,
Nicolas
--
Nicolas M. Thiéry Isil nthi...@users.sf.net
http://Nicolas.Thiery.name/

-- 
You received this message because you are subscribed to the Google Groups 
sage-combinat-devel group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-combinat-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-combinat-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-combinat-devel.
For more options, visit https://groups.google.com/d/optout.
# Abstract classes
class WordLikeObject:
@abstract_method
def evaluation(self):
pass

class AbstractSkewTableau(WordLikeObject):
@abstract_method
def skew_shape(self):
pass
@abstract_method
def rows(self):
pass
@abstract_method
def columns(self):
pass
# access to cells by coordinates
# ...
# Generic methods based on the above accessors
class SemiStandardAbstractSkewTableau(AbstractSkewTableau):
# Crystal operators, ...
class StandardAbstractSkewTableau(SemiStandardAbstractSkewTableau):
# ...

# Concrete classes
class SkewTableau(AbstractSkewTableau):

Defines the data structure for skew tableaux, and low-level
methods on this data structure

def shape():
# ...
skew_shape = shape
def rows():
# ...
class SemiStandardSkewTableau(SkewTableau, SemiStandardAbstractSkewTableau):
# Probably unneeded
class StandardSkewTableau(SemiStandardSkewTableau, StandardAbstractSkewTableau):
pass

class Tableau(ClonableArray?, AbstractSkewTableau):

Defines the data structure for tableaux, and low-level methods on
this data structure

def shape(self):
pass
def skew_shape(self):
return [[], self.shape()]

class SemiStandardTableau(Tableau, SemiStandardAbstractSkewTableau):

Might want to use a different data structure, based on ClonableIntArray

In this case might not want to inherit from Tableau, or introduce
an AbstractTableau class.

class StandardTableau(SemiStandardTableau, StandardAbstractSkewTableau):
pass


[sage-combinat-devel] quiver algebra

2014-07-11 Thread Nicolas M. Thiery
Hi path algebra fans!

I am having doctests failures in #8678 because of the following
feature of quiver path algebras:

sage: P = DiGraph({1:{2:['a']}, 2:{3:['b']}}).path_semigroup()
sage: A = P.algebra(GF(7))
sage: A.list()
[Free module spanned by [e_1, e_2, e_3] over Finite Field of size 7,
 Free module spanned by [a, b] over Finite Field of size 7,
 Free module spanned by [a*b] over Finite Field of size 7]

And indeed ``A.__iter__`` states that it iterates over the homogeneous
components of A. This sounds bad, since the general convention for
parents is to have __iter__, list, ... iterate over its elements.  And
indeed some code that makes this assumption explodes.

Can we just rename this feature? Is it actually useful?

Cheers,
Nicolas
--
Nicolas M. Thiéry Isil nthi...@users.sf.net
http://Nicolas.Thiery.name/

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


[sage-combinat-devel] Re: quiver algebra

2014-07-11 Thread Nicolas M. Thiery
On Fri, Jul 11, 2014 at 09:42:11AM -0700, Travis Scrimshaw wrote:
   I would say this is like matrices: do you want the iterator for
matrices to iterate by default over all elements or rows? Currently the
iterator goes over all rows and you can call M.list() to get a flat
list of entries.
   Actually, this is a question for graded objects in general: should
the default iterator go over each graded component or all elements? I
would say there should be methods for both. My thought is the default
iterator being over graded components since each component might be
infinite, but I don't have a good/strong opinion/reason for this.

Right, though the difference is that containment for a matrix does not
have a strong mathematical meaning. On the other hand, when we speak
of a parent - that models some mathematical set like an algebra, the
notion of containment is unambiguous; it's about the set w.r.t its
elements. Furthermore, whenever we model a set in Python by some
collection, it's expected that containment and iteration are about the
same notion. In particular:

sage: all( x in S for x in S )
True

So I would find quite unnatural to have:

sage: Partitions(4) in Partitions()
True

On the other hand,

sage: Partitions(4) in Partitions().graded_components()

or

sage: for Pk in Partitions().graded_components()

would look natural.

So, what shall we do with this feature of quiver algebras?

Cheers,
Nicolas
--
Nicolas M. Thiéry Isil nthi...@users.sf.net
http://Nicolas.Thiery.name/

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


Re: [sage-combinat-devel] About nested functions not showing up in the doc

2014-06-11 Thread Nicolas M. Thiery
On Wed, Jun 11, 2014 at 11:16:17AM +0200, Nathann Cohen wrote:
Hello everybody !
Vincent implements in #16464 a method for Rings, which is located
inA Rings.Finite.ParentMethods.cyclotomic_cosets [1].
Trouble is, this function does not appear in the html documentation and I
remember Nicolas having said something about that, like Sphinx does not
print too deeply nested functions.
Given that you are the absolute kings of over-nesting stuff, it means that
a lot of Sage's functions do not appear in the doc. What have you tried on
this front ? Have you, for instance, written something to the Sphinx guys
? Do you have any plans to make those functions appear ?
You can of course get the documentation from inside of Sage, but not
through google, and that's a pity.

That's #9107, it just takes pushing through some technical latex
issue according to plan stated on sage-devel ... I hope to have the
time for this at some point, unless someone beats me to it!

Cheers,
Nicolas
--
Nicolas M. Thiéry Isil nthi...@users.sf.net
http://Nicolas.Thiery.name/

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


Re: [sage-devel] Re: [sage-combinat-devel] Re: redesign combinatorial statistics

2014-05-30 Thread Nicolas M. Thiery
On Thu, May 29, 2014 at 11:28:58PM +0200, Paul-Olivier Dehaye wrote:

E.g. when a
  borderline feature is meaningful in the context of Sage, is useful
  for a sister project, but does not yet have a direct use case
  within Sage ...

Correct me if I am wrong, off the top of my head:
Assuming the findstat people start adding information about which maps
are bijective, can't one automatically create new tests, testing two
methods at once?
Assuming the findstat people start adding information about the ranges
of maps, can't one automatically create new tests, testing that the output
of a method is what it should be? (e.g. no [5,4,2] that is supposed to be
a Partition but is in fact a list).

I guess we could. I am not sure to see your point though. Is it that a
potential direct use case within Sage would be to exploit this
semantic information to do more automatic testing which in turn would
contribute to make Sage more robust?

Cheers,
Nicolas
--
Nicolas M. Thiéry Isil nthi...@users.sf.net
http://Nicolas.Thiery.name/

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


Re: [sage-combinat-devel] Re: redesign combinatorial statistics

2014-05-29 Thread Nicolas M. Thiery
On Thu, May 29, 2014 at 11:42:40AM +0200, Nicolas M. Thiery wrote:
 Here is the description of http://trac.sagemath.org/ticket/16410,
 which potentially needs review:
 
 --
 From the discussions of (TODO: add refs to the threads in sage-devel), there 
 is a consensus that, at this point, the combinatorial_map decorator should by 
 default return the decorated method as is, in order to have no impact on 
 speed. On the other hand, projects built on top of Sage, like findstat are 
 welcome to customize locally this hook to instrument the Sage code and 
 exploit the semantic information provided by this decorator.
 
 This ticket therefore:
 
 Defines combinatorial_map as a no-op
 Discuss the purpose of this decorator
 Uses the previous implementation as an example of how to customize 
 combinatorial_map 
 
 Note: this change is slightly backward incompatible since 
 combinatorial_maps_in_class is not functional any more by default.
 --

Vincent on #16410:
 ...this ticket can be reviewed quickly compared to #16408 (which
 needs some design discussions). We can let this one go and then
 start discussing #16408 but I think we need more opinions on this.

Nathann, Christian, Viviane, ... do you mind briefly stating on the
ticket whether this sounds like a reasonable step forward?

Cheers,
Nicolas
--
Nicolas M. Thiéry Isil nthi...@users.sf.net
http://Nicolas.Thiery.name/

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


Re: [sage-combinat-devel] Re: redesign combinatorial statistics

2014-05-29 Thread Nicolas M. Thiery
 On Thu, May 29, 2014 at 10:02 PM, Nathann Cohen nathann.co...@gmail.com
I can hear your frustration ... In similar situations, it helped me to
keep in mind that loud people are not always representative. Of course
the difficulty is to fetch the opinion from the others.
 
 Ahahahahahahah. Well, only including in Sage code that is useful to a
 Sage user or other developpers does not seem that far-fetched. I
 still do not see what the problem is with that.
 Err Well, assuming the obvious : that I am the loud people you
 mention.

Sorry, I should have clearly separated the two topics. My point was
about (1) below.

(1) When a Sage developer believes in his heart that something is the
right thing to do for Sage, (s)he should not get discouraged by
loud opposition without first reaching for the opinions of a
larger pool of developers.

Btw: there are more than one loud people :-) Actually I also put
myself in there, as the graded algebra with basis discussion from
the other month shows ...

(2) About ``only including in Sage code that is useful to a Sage
user or other developpers''. In principle, yes, sure, I
agree. Still there can be legitimate complementary point of views
and discussions about where to put the limit. E.g. when a
borderline feature is meaningful in the context of Sage, is useful
for a sister project, but does not yet have a direct use case
within Sage ...

Cheers,
Nicolas
--
Nicolas M. Thiéry Isil nthi...@users.sf.net
http://Nicolas.Thiery.name/

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


Re: [sage-combinat-devel] combinatorial statistics

2014-05-26 Thread Nicolas M. Thiery
Hi Christian,

On Mon, May 26, 2014 at 09:08:14AM +0200, Christian Stump wrote:
 Let me add that I was thinking of opening a ticket to remove
 combinatorial maps from Sage again (in the medium time future) simply
 because the negative comments about it were louder (and I am currently
 not in the position to be able to spend much time on stuff I don't
 need for my research).

I also won't spend time on arguing about this. Let me just recall my
personal position, for whatever it's worth.

I like having such semantic information in the code, and I am fine
with having it even if we don't yet have a strong use case within
Sage. The only prerequisites are:

- Not having an impact on performance (IIRC that's the case with
  combinatorial maps)

- Not adding functions in the code unless they are actually useful in
  Sage and have a clear mathematical meaning.

 So if you have some use cases for combinatorial maps, please write
 about it so such cases are also visible.

+1

By the way: I second being able to programmatically search for
combinatorial statistics, be it through a remote call to findstat.org,
or by running locally a findstat search engine.

Cheers,
Nicolas
--
Nicolas M. Thiéry Isil nthi...@users.sf.net
http://Nicolas.Thiery.name/

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


Re: [sage-combinat-devel] Re: sum(Composition([1,2,3])) # broken

2014-05-20 Thread Nicolas M. Thiery
On Tue, May 20, 2014 at 11:50:30AM +0200, Vincent Delecroix wrote:
 I agree with Nathan that .sum must be changed. IMHO I would
 - remove sum from the element Composition

+1

 - move the sum from the category CommutativeAdditiveMonoids to AdditiveMagmas

With #10963 (which is merged!), sum has already been moved in
AdditiveMonoids. A version not using the zero (and supporting only non
empty lists) could possibly be added to AdditiveSemigroups. I am not
sure I want to define sum if the addition is not associative (for
multiplicative magmas, prod is only defined in the associative case).

 - Turn the parent Compositions into an additive monoid
 
 That way, the old behavior of sum can still be used through
 {{{
 sage: Compositions().sum([Composition([3,2,1]), Composition([1,2])])
 [3, 2, 1, 1, 2]
 }}}

+1. Or maybe instead into a multiplicative monoid? I don't have a
strong opinion either way, but we should take a consistent decision
here with words and other word-like objects supporting concatenation.

Cheers,
Nicolas
--
Nicolas M. Thiéry Isil nthi...@users.sf.net
http://Nicolas.Thiery.name/

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


Re: [sage-combinat-devel] Re: sum(Composition([1,2,3])) # broken

2014-05-20 Thread Nicolas M. Thiery
On Tue, May 20, 2014 at 09:54:28AM +, Simon King wrote:
 On 2014-05-20, Nathann Cohen nathann.co...@gmail.com wrote:
  What the hell is add ? I did not even know this thing existed !
 
 It is a Python builtin, in contrast to sum, which is defined somewhere
 in sage.misc.

To be fair, `add` does not seem to exist in plain Python. If I read it
right, for whatever it's worth, Sage adds it as an alias for Python's
__builtin__.sum:

sage: add is __builtin__.sum
True

Cheers,
Nicolas
--
Nicolas M. Thiéry Isil nthi...@users.sf.net
http://Nicolas.Thiery.name/

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


Re: [sage-combinat-devel] Re: sum(Composition([1,2,3])) # broken

2014-05-20 Thread Nicolas M. Thiery
On Tue, May 20, 2014 at 03:25:34AM -0700, Simon King wrote:
It would have been a much better longterm solution to keep
__builtin__.sum(). Sage may have its own summation method, but please not
overriding a Python builtin. Give Sage's sum() a different name!

I definitely can see your point. Yet that's how things have been for a
long time, and `sum` is probably being used intensively for symbolic
summation by a wide array of people (teaching, ...). Such a backward
compatible change would require a discussion on sage-devel.

In the mean time, we can implement the other approach since it makes
sense anyway.

Cheers,
Nicolas
--
Nicolas M. Thiéry Isil nthi...@users.sf.net
http://Nicolas.Thiery.name/

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


Re: [sage-combinat-devel] Re: sum(Composition([1,2,3])) # broken

2014-05-20 Thread Nicolas M. Thiery
On Tue, May 20, 2014 at 01:31:27PM +0200, Nathann Cohen wrote:
Sorry but I lost you again. How can we fix this sum problem ? It seems
to have triggered discussions on the additive law among Composition
instances.

Which will be rather trivial to fix once we have settled the decision
on additive or multiplicative notation.

Cheers,
Nicolas
--
Nicolas M. Thiéry Isil nthi...@users.sf.net
http://Nicolas.Thiery.name/

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


Re: [sage-combinat-devel] sum(Composition([1,2,3])) # broken

2014-05-19 Thread Nicolas M. Thiery
On Mon, May 19, 2014 at 04:29:44PM +0200, Vincent Delecroix wrote:
 Not because of Composition but because of sum
 
 sage: import __builtin__
 sage: __builtin__.sum(Composition([1,2,3]))
 6

That being said, since Composition seems to be the single
combinatorial object having a sum method, we could think of renaming
it to something more appropriate that would not conflict with Sage's
sum syntax and semantic. What's the syntax for n-ary concatenation of
words?

Cheers,
Nicolas
--
Nicolas M. Thiéry Isil nthi...@users.sf.net
http://Nicolas.Thiery.name/

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


Re: [sage-combinat-devel] Re: sum(Composition([1,2,3])) # broken

2014-05-19 Thread Nicolas M. Thiery
On Mon, May 19, 2014 at 04:01:52PM +, Simon King wrote:
 Multiplication? I always think of words as elements of a free group, of
 course multiplicatively written. Hence, concatenation of words w1,...,wn
 would be prod([w1,w2,...,wn]).

Indeed.

`+` works too for concatenation of words, which is consistent with
Python strings. But sum does not. Oh well.

Cheers,
Nicolas
--
Nicolas M. Thiéry Isil nthi...@users.sf.net
http://Nicolas.Thiery.name/

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


Re: [sage-combinat-devel] Re: CombinatorialFreeModule

2014-05-17 Thread Nicolas M. Thiery
Hi Bruce,

On Sat, May 17, 2014 at 12:29:54PM -0700, Bruce wrote:
I changed this to
 
class Foo(Element):
def __init__(self, a):
self.data = a
Element.__init__(self, Foos)
 
which seems a bit simpler as we still have Foo(1) without an extra
argument.

Notes:

- this should be `Foos()`, rather than Foos

- elements are more often than not constructed from their parent as:

  sage: F = Foos()
  sage: F(data)

  In this situation, both the parent and the data is passed to the
  constructor of the element class.

- In case your data structure consists of a single value, you can use
  ElementWrapper which does exactly the above __init__ for you
  together with some other goodies. For an example, see

sage: S = Semigroups().example()
sage: S??

Cheers,
Nicolas
--
Nicolas M. Thiéry Isil nthi...@users.sf.net
http://Nicolas.Thiery.name/

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


Re: [sage-combinat-devel] CombinatorialFreeModule

2014-05-16 Thread Nicolas M. Thiery
On Fri, May 16, 2014 at 08:04:11AM -0700, Bruce wrote:
On Friday, 16 May 2014 14:54:32 UTC+1, Viviane Pons wrote:
 
  I think the Foo class must also inherit from the Element class.
 
If I change the first line to
 
class Foo(Element, UniqueRepresentation):
 
then when I create an instance and look at it I get
 
Generic element of a structure

That's fine: that's what the default _repr_ method returns for
Element's. You can implement your own.

By the way: usually an element class need not inherit from
UniqueRepresentation (but there are use cases).

Cheers,
Nicolas
--
Nicolas M. Thiéry Isil nthi...@users.sf.net
http://Nicolas.Thiery.name/

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


Re: [sage-combinat-devel] CombinatorialFreeModule

2014-05-16 Thread Nicolas M. Thiery
Hi Bruce,

On Fri, May 16, 2014 at 06:50:35AM -0700, Bruce wrote:
While I am here: I am constructing an infinite dimensional representation
of an algebra.
This means the next step for me is to construct operators on this vector
space (one for each integer)
and these operators will satisfy the Temperley-Lieb relations.
 
I want to define each operator on the basis and then extend by linearity.
 
Is there an existing category I could/should be using?

At this point (and except for the standard case of a vector space
endowed with the action of the scalars) we only have experimental
category code for spaces endowed with an action of an
algebra/group/... I'd say you can just use the category
ModulesWithBasis for your vector space, and define your operators as
a bunch of morphisms constructed using module_morphism.

Cheers,
Nicolas
--
Nicolas M. Thiéry Isil nthi...@users.sf.net
http://Nicolas.Thiery.name/

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


Re: [sage-combinat-devel] gfun in sage?

2014-05-13 Thread Nicolas M. Thiery
Hi Franco!

On Tue, May 13, 2014 at 02:57:59PM -0400, Franco Saliola wrote:
Does Sage currently include any functionality similar to the gfun package
in Maple? Here is a description of gfun:
Gfun is a Maple package that provides tools for guessing a sequence or a
series from its first terms; manipulating rigorously solutions of linear
differential or recurrence equations, using the equation as a
data-structure.
Website with more information:
http://perso.ens-lyon.fr/bruno.salvy/software/the-gfun-package/

I haven't played seriously with it, but Manuel Kauers (in CC),
Maximilian Jaroschek, Fredrik Johansson, have developed a package that
includes guessing facilities:

http://www.risc.jku.at/research/combinat/risc/software/ore_algebra/doc/guessing.html

The more people play with it, the better! I guess the author would
appreciate any feedback and help toward getting this package
progressively into Sage.

Cheers,
Nicolas
--
Nicolas M. Thiéry Isil nthi...@users.sf.net
http://Nicolas.Thiery.name/

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


Re: [sage-devel] Re: [sage-combinat-devel] Re: About _element_constructor_ of CartesianProduct

2014-04-30 Thread Nicolas M. Thiery
On Wed, Apr 30, 2014 at 08:12:33AM +0200, Nathann Cohen wrote:
Well, if you find the question justified, of course the answer should be
in the doc.

My point was not about the existence of the answer, but the way I
wrote it :-) Was it helpful?

There is also the problem of these __add__ and _add_. From just
looking at the names you have no idea what the difference is,
except if you wrote the code yourself.

This is about the coercion system, which has been in Sage since 2008
or so. When I joined Sage and started implementing elements, I found
the information by reading the documention of
sage.structure.element. Now we have Simon's very nice thematic
tutorial How to implement new algebraic structures in Sage, which
explains this in details.

If you believe the names should be changed, open a thread on the
subject on sage-devel.

HMmm... Yeah, but it contains a class CartesianProductsCategory Why
shouldn't it be taken as the definition of the CartesianProductCategory
from which all other will inherit ? Thus, why shouldn't it be taken as THE
place to implement things like .an_element() or .cardinality() ?

If we put everything about cartesian products in a single spot, we
will end up, for example, with a bunch of irrelevant methods (like
one, product, ...) when we construct a plain cartesian product of
sets. The whole point of the current infrastructure is that when you
make a cartesian product of blahs, you get exactly the cartesian
product methods relevant to blahs. Once this infrastructure is in
place, there is no reason to make a special case for an_element or
cardinality, even though they indeed be around whatever blahs is.

It's by going in this kind of direction that we will finally get rid
of all those irritating irrelevant methods that we find in so many
Sage objects (e.g. Set([1,2,3]).base_ring()).

 - Vector spaces are already endowed with their addition. Sounds like
 A  you accidently overrode it.
HMmmm... I don't get it. CommutativeAdditiveGroup is more general than
vector spaces, so if something is a vector space it should inherit all
addition functions from vector spaces, shouldn't they ?

That's the general principle indeed; I would need to see the code to
find out what went wrong precisely.

 - Using .value directly breaks encapsulation and is thus
 A  implementation dependent.
Yeah but I needed to iterate over all the coordinates of an element of a
cartesian product. Does it mean that I should instead implement an
__iter__ in the ParentMethods of the category they belong to ?.. I'll try
that 

I would iterate through x.cartesian_factors():

sage: C = cartesian_product([GF(3), GF(5)])
sage: x = C.an_element()
sage: x.cartesian_factors()
(0, 0)
sage: for i in x.cartesian_factors(): ...

or its equivalent pre #10963; I don't remember the name, but see:

sage: c.tab

Cheers,
Nicolas
--
Nicolas M. Thiéry Isil nthi...@users.sf.net
http://Nicolas.Thiery.name/

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


Re: [sage-combinat-devel] Should the element of a Parent be Elements ?

2014-04-30 Thread Nicolas M. Thiery
On Wed, Apr 30, 2014 at 09:23:41AM +0200, Vincent Delecroix wrote:
 FiniteEnumeratedSet is aimed to not modify the input it gets. So if
 you feed it with Python objects which are not elements it will not
 complain and you have to go with that.

Yup. We would want to properly support facade FiniteEnumeratedSets
over plain Python objects and in particular have:

sage: F = FiniteEnumeratedSet([a,b,c])
sage: F(a)
a

However the coercion system currently does not support facades over
plain Python objects. That's essentially just because

sage.structure.coerce_maps.DefaultConvertMap._call_

(which is what Parent.__call__ defaults to if there is no coercion)
specifies that its return value should be an Element.

That has been irritating me for a while, but I am not sure what's the
right fix.

Cheers,
Nicolas
--
Nicolas M. Thiéry Isil nthi...@users.sf.net
http://Nicolas.Thiery.name/

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


Re: [sage-combinat-devel] Should the element of a Parent be Elements ?

2014-04-30 Thread Nicolas M. Thiery
On Wed, Apr 30, 2014 at 12:22:41PM +0200, Nathann Cohen wrote:
 Okay... Then would it make sense to make things like
 FiniteEnumeratedSet behave as if they were real parents, for
 instance by implementing the __call__ function manually (or let it be
 inherited from Facade or whatever it is) so that F(a) works ? It is
 not like you need to change coercion code to  make this work ?...
 
  That has been irritating me for a while, but I am not sure what's the
  right fix.
 
 So what about this way out ?

That's indeed one way out I considered. But this means that this
parent won't honor coercions. Possibly we don't care.

Cheers,
Nicolas
--
Nicolas M. Thiéry Isil nthi...@users.sf.net
http://Nicolas.Thiery.name/

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


Re: [sage-devel] Re: [sage-combinat-devel] Re: About _element_constructor_ of CartesianProduct

2014-04-30 Thread Nicolas M. Thiery
On Wed, Apr 30, 2014 at 12:19:41PM +0200, Nathann Cohen wrote:
Not my job.

Nor mine in the case of coercion and the _..._ methods :-) Because I
already spent a lot of time on some pieces of the Sage infrastructure
does not mean I (or anybody on sage-combinat-devel) am responsible for
all of it. Which is why I suggested to report and make your case on
sage-devel.

No, the one thing does not belong to CartesianProduct because it does
not apply to everything. I was just wondering about
category/cartesian_product and sets/cartesian_product. Those two A files
seem to address all cartesian products of everything (and this everything
is always a set, isn't it ?)

Indeed. Still, see my comment about the value of not making a special
case for those methods.

The current Sage *IS* pre-10963. And I hope that you have
summand_projection in mind for it is what I used in #16269.

Certainly.

Thanks for your answers.

Your welcome.
Nicolas
--
Nicolas M. Thiéry Isil nthi...@users.sf.net
http://Nicolas.Thiery.name/

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


[sage-combinat-devel] Re: About _element_constructor_ of CartesianProduct

2014-04-29 Thread Nicolas M. Thiery
Hi Nathann,

On Tue, Apr 29, 2014 at 01:50:42PM +0200, Nathann Cohen wrote:
I need your help for something that I spent all of today (around six 6
hours) trying to do, and I can't. And I tried. So please, help me.

Sorry, I was offline this morning. I just got your message saying you
had fixed most of the issues in the mean time, but since this might be
of general interest here is what I had already typed down.

I am trying to use cartesian products of groups in Sage, and I cannot
implement what I want because of the following problem :
 
sage: GG = GF(2).cartesian_product(GF(2)); GG([2,2])
[2, 2]
 
in Z/2z x Z/2Z, you naturally expect the answer to be (0,0).
 
But it isn't, because the entries of [2,2] are not converted into elements
of the cartesian product I defined.

Yeah, we had discussed this issue a couple months ago; see #15425. The
fix is indeed to change _element_constructor_. Since this is about the
construction of elements, this belongs to the concrete class, not the
category. In this case:

sage.sets.cartesian_product.CartesianProduct._element_constructor.

Which you can get with:

sage: C = cartesian_product([GF(2), GF(2)])

Throwing your _element_constructor_ code there should do the job.

Ah, I see what must have been confusing: the default implementation of
_element_constructor_ is provided by the Sets category:

sage: C._element_constructor_.__module__
'sage.categories.sets_cat'

Hmm, by the above reasoning it should probably be in Parent
instead. Hmm. Opinions anyone?

 Autre question : quand j'ai voulu expliquer au code que le
 cartesianproduct d'un AdditiveCommutativeGroup était un
 AdditiveCommutativeGroup, au debut quand je faisais des tests il
 faisait comme s'il n'avait rien entendu, et il ne faisait rien, même
 quand j'appelais explicitement la fonction
 AdditiveCommutativeGroup().CartesianProduct().extra_super_categories().

Do you have the code on some branch? I guess the issue is some typo,
like a missing s to CartesianProducts. Similarly,
CommutativeAdditiveGroups.

 Autre question : quand j'ai un objet CartesianProduct, comment je
 recupere la liste de ses composantes, qui sont normalement des
 parents ?

Introspection is the tool of choice to recover this kind of
information. From looking at:

sage: C = cartesian_product([GF(2), GF(2)])
sage: C??

or from the code of

sage: C.one??

one can find that there is an internal attribute `_sets` for this, and
a shorthand `cartesian_factors` to recover them. Pre #10963, this was
called `summands` but I was asked to change it. Wait, wait, wait, I
thought we had put a backward compatibility alias, but I can't find
it. I'll fix that now.

In your case it's fine to use the attribute.

Thanks for your work on this!

Cheers,
Nicolas
--
Nicolas M. Thiéry Isil nthi...@users.sf.net
http://Nicolas.Thiery.name/

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


Re: [sage-combinat-devel] Re: About _element_constructor_ of CartesianProduct

2014-04-29 Thread Nicolas M. Thiery
On Tue, Apr 29, 2014 at 03:48:37PM +0200, Nathann Cohen wrote:
Yeah, I found it. I don't remember how, but I did. There is a branch at
u/ncohen/tmp which implements the _element_constructor_ I needed, plus
order/cardinality.

I checked it out; at first glance, the issue is that
element_constructor returns a tuple not an instance of the cartesian
product. I can commit a fix in an hour or so.

Cheers,
Nicolas
--
Nicolas M. Thiéry Isil nthi...@users.sf.net
http://Nicolas.Thiery.name/

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


Re: [sage-devel] Re: [sage-combinat-devel] Re: About _element_constructor_ of CartesianProduct

2014-04-29 Thread Nicolas M. Thiery
On Tue, Apr 29, 2014 at 04:57:37PM +0200, Nicolas M. Thiery wrote:
 I checked it out; at first glance, the issue is that
 element_constructor returns a tuple not an instance of the cartesian
 product. I can commit a fix in an hour or so.

Well, that was a long hour. But it's now on u/nthiery/cartesian_product.

I have added the tests for list and cardinality, but not yet for
element_constructor, so I don't yet guarantee correctness.

I am hesitant on whether _element_constructor should always directly
coerce the elements, or first check if they are already in the right
parent and if not call coercion.

Cheers,
Nicolas
--
Nicolas M. Thiéry Isil nthi...@users.sf.net
http://Nicolas.Thiery.name/

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


Re: [sage-combinat-devel] Re: About _element_constructor_ of CartesianProduct

2014-04-29 Thread Nicolas M. Thiery
On Tue, Apr 29, 2014 at 05:19:32PM +0200, Nathann Cohen wrote:
 At some point I created a function called a in a Parent which just
 printed a line, called it, and the result was :
 1) The line was printed
 2) An attribute error because some other category I had never heard
 about did not implement such a method

Strange. If you can reproduce the example I'd be happy investigating
it.


 I asked Nicolas if there was some caching of the categories hierarchy
 that was not automatically rewritten when I run sage -b.

No. Everything is lazily rebuilt from the code in each Sage session.

Cheers
Nicolas
--
Nicolas M. Thiéry Isil nthi...@users.sf.net
http://Nicolas.Thiery.name/

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


Re: [sage-devel] Re: [sage-combinat-devel] Re: About _element_constructor_ of CartesianProduct

2014-04-29 Thread Nicolas M. Thiery
On Tue, Apr 29, 2014 at 08:17:44PM +0200, Nathann Cohen wrote:
 Why did you have to move the code around, though ?
 What is the difference between sets.cartesian_product and
 categories.cartesian_product ?

disclaimer
My answer is most likely going to be a bit broad and include stuff you
already know; I am just taking the occasion to write a blurb that
could possibly end up somewhere in the documentation (typically as a
complement of cartesian_product?), if someone finds it useful.
/disclaimer

There can be several ways to represent an element of a cartesian
product. The natural implementation is using a tuple (well, a wrapped
tuple). That's what the concrete class in
sets.cartesian_product.CartesianProduct does::

sage: C = cartesian_product([GF(3), GF(5)])
sage: type(C)
class 'sage.sets.cartesian_product.CartesianProduct_with_category'
sage: C.an_element()
(0, 0)

But if you start from vector spaces it's natural to think of the
cartesian product as a direct sum, and therefore represent the
cartesian product by a vector space:

sage: X = CombinatorialFreeModule(QQ, ['a','b']); X.rename(X)
sage: Y = CombinatorialFreeModule(QQ, ['c','d']); Y.rename(Y)
sage: C = cartesian_product([X,Y])
sage: C
X (+) Y
sage: type(C)
class ...CombinatorialFreeModule...

This vector space has a basis indexed by the disjoint unions of that
of X and of Y::

sage: C.basis().keys()
Disjoint union of Family ({'a', 'b'}, {'c', 'd'})
sage: C.an_element()
2*B[(0, 'a')] + 2*B[(0, 'b')] + 3*B[(1, 'c')]

So that's a second concrete implementation of a cartesian
product. There could be others (e.g. one could represent the cartesian
product of two permutation groups as a permutation group).

That's for the concrete classes. Then, you have generic code that
works in all cases (say an_element, one). This code goes in the
relevant abstract classes in the category. For example the code for
`an_element` is something about parents that are cartesian products of
sets; so it goes in the abstract class
Sets.CartesianProducts.ParentMethods. On the other hand `one` is about
monoids (in fact unital magmas), so it goes in
Monoids.CartesianProducts.ParentMethods (in
Magmas.Unital.CartesianProducts.ParentMethods after #10963).

The last player in the game is the `cartesian_product` object, as in
`cartesian_product([A,B,...])`. Its role is to look at the properties
of A,B,..., and decide on an appropriate concrete implementation and a
category. Technically, this object is a covariant functorial
construction and it's implemented in
sage.categories.cartesian_product. In practice, unless one wants to
use it as an example to create a new construction, there is no reason
to fiddle with it.

 Cool. I am trying to clean the CartesianProduct stuff of additive
 groups and it does not look good. The methods are not inherited from
 where they should -_-
 
 Right now, my problem is that the __add__ method from a
 CombinatorialFreeModule is taken from my CommutativeAdditiveGroup.
 And I thought I could expect all those objects to have a .value
 argument, but apparently I can t _

The three points you probably are hitting here are:

- It's best to implement _add_ rather than __add__ (__add__ builds on
  _add_ and takes care of coercion for you). Equivalently you can
  implement the method 'summation' in the parent (that's what done for
  the product).

- Vector spaces are already endowed with their addition. Sounds like
  you accidently overrode it.

- Using .value directly breaks encapsulation and is thus
  implementation dependent. Instead, have a look at some generic
  method that manipulates an element of a cartesian product and see
  how its pieces are recovered there. E.g.:

sage: C = cartesian_product([GF(3), GF(5)])
sage: C.product??

Let me know if you would want me to have a look at the code.

 Okay, so I will try to see if I can guarantee correctness when you can't.

I just meant the usual caveat not tested=likely to be broken.

  I am hesitant on whether _element_constructor should always directly
  coerce the elements, or first check if they are already in the right
  parent and if not call coercion.
 
 Well, your pick. I barely understand what the dilemma is about :-P

Just about the if line I commented out in your code. Maybe it should
really be there. Or we should do a separate `if` for each set.

Cheers,
Nicolas
--
Nicolas M. Thiéry Isil nthi...@users.sf.net
http://Nicolas.Thiery.name/

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

Re: [sage-combinat-devel] Re: About _element_constructor_ of CartesianProduct

2014-04-29 Thread Nicolas M. Thiery
On Tue, Apr 29, 2014 at 03:48:37PM +0200, Nathann Cohen wrote:
 Do you have the code on some branch? I guess the issue is some typo,
 like a missing s to CartesianProducts. Similarly,
 CommutativeAdditiveGroups.
 
A typo ? But I would get some meaningful error in this case, not this,
would I ?

Not necessarily. As a lousy analogy, imagine I want to implement a
special class of graphs, and want to override, say,
is_vertex_transitive with my super great algorithm; but I
inadvertently spell it as is_vertices_transitive. I won't get a
specific error about it.  If the user calls is_vertex_transitive, my
great implementation is going to be silently ignored.

Of course, in some cases there can be tricks to catch such typos and
report them. For example the code could possibly complain if you
implement, and then call, a construction in a category where it has
not been defined (that's done for axioms, but maybe not yet for
constructions like CartesianProducts).

Cheers,
Nicolas
--
Nicolas M. Thiéry Isil nthi...@users.sf.net
http://Nicolas.Thiery.name/

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


Re: [sage-combinat-devel] Re: About _element_constructor_ of CartesianProduct

2014-04-29 Thread Nicolas M. Thiery
On Tue, Apr 29, 2014 at 03:48:37PM +0200, Nathann Cohen wrote:
Nicolas, I can swear that in the mind of somebody who never had anything
to do with categories, there is no link whatsoever between finding those
sets and the function one(). When you know the answer already, it is
very easy to find it again. When you don't, you spend minuteson things
like this, and sometimes you even give up.

That's why I had also mentioned ``C??``. But you are right, I should
have mentioned the reasoning behind: I need to access the underlying
sets. In the methods that are available in C, is there one that is
likely to have the same need that I could copy from. I personally
thought about 'one' since we were in the context of monoids (I may
have some personal bias too :-)). Maybe another more natural one is
an_element (how can I build an_element of a cartesian product? Well,
take an_element in the underlying sets and piece them together).

Cheers,
Nicolas
--
Nicolas M. Thiéry Isil nthi...@users.sf.net
http://Nicolas.Thiery.name/

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


Re: [sage-combinat-devel] fractional powers of a variable

2014-04-18 Thread Nicolas M. Thiery
On Tue, Apr 15, 2014 at 10:19:25AM -0700, Mark Shimozono wrote:
I find myself in legitimate need of fractional powers of a variable q,
which sage  doesn't seem to like.
 
Is there a reasonable workaround?

I haven't followed the tickets on Puiseux polynomials, but that's
something that could be explored. Other than that, it depends on what
kind of operations you want to be doing. If e.g. you don't care about
polynomial operations like factorization, you could use the group
algebra of the additive group QQ:

sage: QQ.algebra(QQ, category=Groups())
Group algebra of Rational Field over Rational Field

I thought about always raising to an extra power (the maximum
denominator is known) but I don't know how to mangle the output
to put the fraction back in.  I assume it is dangerous to mess
with _repr_ for a polynomial and the code is assuming that the
user is allowed to specify their own ring with a q in it.

In theory, _repr_ is not supposed to be used in calculations; so you
could derive your own custom subclass of some class for elements of
polynomial rings, and safely redefine _repr_ there to your
liking. Requesting a polynomial ring to use a custom subclass for its
elements is not as practical as it should be though.

Cheers,
Nicolas
--
Nicolas M. Thiéry Isil nthi...@users.sf.net
http://Nicolas.Thiery.name/

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


Re: [sage-combinat-devel] tensor products of free modules; combinatorial algebras

2014-04-04 Thread Nicolas M. Thiery
On Thu, Apr 03, 2014 at 11:11:25AM -0400, Mark Shimozono wrote:
 I put in that line you suggested for VectorSpaces.TensorProducts().
 The categories that are appearing now tend to be Joins.

Indeed.

 I tried
 {{{
 sage: ModulesWithBasis(QQ).TensorProducts().base_ring()
 Traceback (most recent call last)
 ...
 AssertionError: some subcategory of Join of Category of tensor products of 
 modules with basis over Rational Field and Category of tensor products of 
 vector spaces over Rational Field should be a category over base ring
 }}}
 
 There doesn't seem to be an obvious way to get the base_ring in general.
 The category might be a join, the supercategories might be tensor products
 or not, etc.

Ah, interesting question: we are planning shortly to have the
categories be parametrized by the category of the base ring instead of
the base ring itself. I.e. we would have the category of vector spaces
over a finite field, rather than that of vector spaces over
GF(2). This to avoid creating many instances of basically identical
categories.

So use cases where you actually need to query the base ring are
welcome in preparation for this change!

Cheers,
Nicolas
--
Nicolas M. Thiéry Isil nthi...@users.sf.net
http://Nicolas.Thiery.name/

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


Re: [sage-combinat-devel] tensor products of free modules; combinatorial algebras

2014-04-03 Thread Nicolas M. Thiery
Hi Mark!

On Thu, Apr 03, 2014 at 12:12:10AM -0400, Mark Shimozono wrote:
  I am actually running into trouble with this tensor and
  module over field = vector space category mangling.
  Do you have a suggestion for a workaround, so my
  automatic constructions don't get rejected for
  category mismatching?
 I found the dispatch switch for the Modules(Field) --- VectorSpaces(Field)
 rewriting, and turned this off for default.  This will work fine for me.

Glad you found a workaround. Still, I'd be interested in a small
example illustrating the issue you ran into!

Thanks,
Nicolas
--
Nicolas M. Thiéry Isil nthi...@users.sf.net
http://Nicolas.Thiery.name/

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


Re: [sage-combinat-devel] tensor products of free modules; combinatorial algebras

2014-04-03 Thread Nicolas M. Thiery
On Thu, Apr 03, 2014 at 08:19:16AM -0400, Mark Shimozono wrote:
 Here is an example. I think the problem is that the tensor
 covariant construction functor stores the base category as an attribute
 before the QQ-module --- QQ-vector-space category mangling occurs.
 
 --Mark
 
 {{{
 
 sage: A=CombinatorialFreeModule(QQ,[1])
 sage: B=CombinatorialFreeModule(QQ,[2])
 sage: AB = tensor([A,B])
 sage: BA = tensor([B,A])
 sage: f = AB.module_morphism(on_basis=lambda (x,y): 
 BA.monomial((y,x)), codomain=BA, category=ModulesWithBasis(QQ))
 Traceback (most recent call last):
 ...
 TypeError: Free module generated by {1} over Rational Field # Free 
 module generated by {2} over Rational Field is not in Category of vector 
 spaces with basis over Rational Field
 
 }}}

Ok, thanks! That's the same issue as we had recently: the tensor
construction is supposed to be regressive but it's not implemented as
such.  Namely, C.TensorProducts() should always include C as super
category, which is not the case above:

sage: AB in VectorSpaces(QQ)
False

That's independent of the mangling for Modules.

Cheers,
Nicolas
--
Nicolas M. Thiéry Isil nthi...@users.sf.net
http://Nicolas.Thiery.name/

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


Re: [sage-combinat-devel] tensor products of free modules; combinatorial algebras

2014-04-03 Thread Nicolas M. Thiery
On Thu, Apr 03, 2014 at 08:50:03AM -0400, Mark Shimozono wrote:
 How about this from sage.categories.modules_with_basis.
...
 {{{
 
 class TensorProducts(TensorProductsCategory):
 
 The category of modules with basis constructed by tensor product of
 modules with basis.
 
 @cached_method
 def extra_super_categories(self):
 
 EXAMPLES::
 
 sage: 
 ModulesWithBasis(QQ).TensorProducts().extra_super_categories()
 [Category of modules with basis over Rational Field]
 sage: ModulesWithBasis(QQ).TensorProducts().super_categories()
 [Category of modules with basis over Rational Field]
 
 return [self.base_category()]
 
 }}}

Hmm, good point. If I am not mistaken, this does nothing more than the
default_super_categories of TensorProductsCategory, so we could just
remove this method and this should change nothing. Can you check this?

Thinking more about it, I am now wondering after all whether we want
C.TensorProducts() to always include C as super category. The question
is what semantic we want to attach to this:

  (a) C.TensorProducts() is a C, mathematically speaking

or

  (b) The C structure on C.TensorProducts() is actually implemented

If we want (a), this can be made automatic. Otherwise not, although we
could possibly make it automatic for full subcategories where there is
no extra structure that has to be implemented. This would include
VectorSpaces as a by-product.

At this point, I am leaning toward (b).

For now, I'd suggest to just throw in VectorSpaces:

 class TensorProducts(TensorProductsCategory):
  pass

Cheers,
Nicolas
--
Nicolas M. Thiéry Isil nthi...@users.sf.net
http://Nicolas.Thiery.name/

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


  1   2   3   4   5   6   7   8   9   10   >