Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improved printing for symmetric function bases and misc refactoring #13404

Closed
nthiery opened this issue Aug 27, 2012 · 38 comments
Closed

Improved printing for symmetric function bases and misc refactoring #13404

nthiery opened this issue Aug 27, 2012 · 38 comments

Comments

@nthiery
Copy link
Contributor

nthiery commented Aug 27, 2012

Due to accumulating history, the names of the various bases of
Symmetric functions and variants are not very consistent:

    sage: Sym = SymmetricFunctions(FractionField(QQ['q,t'])); Sym
    Symmetric Functions over Fraction Field of Multivariate Polynomial Ring in q, t over Rational Field
    sage: Sym.s()
    Symmetric Function Algebra over Fraction Field of Multivariate Polynomial Ring in q, t over Rational Field, Schur symmetric functions as basis
    sage: Sym.macdonald().P()
    Macdonald polynomials in the P basis over Fraction Field of Multivariate Polynomial Ring in q, t over Rational Field
    sage: Sym.hall_littlewood().P()
    Hall-Littlewood polynomials in the P basis over Fraction Field of Multivariate Polynomial Ring in q, t over Rational Field

This is not consistent either with NCSF/Qsym:

    sage: NCSF = NonCommutativeSymmetricFunctions(QQ)
    sage: NCSF.Psi()
    Non-Commutative Symmetric Functions over the Rational Field in the Psi basis

Besides, it is verbose and does not support renaming Sym to get shorter names:

    sage: Sym.rename("Sym")
    sage: Sym.s()
    Symmetric Function Algebra over Fraction Field of Multivariate Polynomial Ring in q, t over Rational Field, Schur symmetric functions as basis

I am in the process of refactoring the _repr_ code to improve this:

    sage: Sym = SymmetricFunctions(FractionField(QQ['q,t'])); Sym
    Symmetric Functions over Fraction Field of Multivariate Polynomial Ring in q, t over Rational Field
    sage: Sym.p()
    Symmetric Functions over Fraction Field of Multivariate Polynomial Ring in q, t over Rational Field on the powersum basis

In the following examples, we rename Sym for brevity:

    sage: Sym.rename("Sym"); Sym
    Sym

Classical bases:

    sage: Sym.p()
    Sym in the powersum basis
    sage: Sym.m()
    Sym in the monomial basis
    sage: Sym.e()
    Sym in the elementary basis
    sage: Sym.h()
    Sym in the homogeneous basis
    sage: Sym.s()                           # Mind the capital here
    Sym in the Schur basis
    sage: Sym.f()
    Sym in the forgotten basis

Macdonald polynomials:

    sage: Sym.macdonald().P()
    Sym in the Macdonald P basis
    sage: Sym.macdonald().Ht()
    Sym in the Macdonald Ht basis

Macdonald polynomials, with specialized parameters:

    sage: Sym.macdonald(q=1).S()
    Sym in the Macdonald S with q=1 basis
    sage: Sym.macdonald(q=1,t=3).P()
    Sym in the Macdonald P with q=1 and t=3 basis

Hall-Littlewood polynomials:

    sage: Sym.hall_littlewood().P()
    Sym in the Hall-Littlewood P basis
    sage: Sym.hall_littlewood().Qp()
    Sym in the Hall-Littlewood Qp basis

Hall-Littlewood polynomials, with specialized parameter:

    sage: Sym.hall_littlewood(t=1).P()
    Sym in the Hall-Littlewood P with t=1 basis

Jack polynomials::

    sage: Sym.jack().J()
    Sym in the Jack J basis
    sage: Sym.jack().P()
    Sym in the Jack P basis
    sage: Sym.jack().Q()
    Sym in the Jack Q basis
    sage: Sym.jack().Qp()
    Sym in the Jack Qp basis

Jack polynomials, with specialized parameter::

    sage: Sym.jack(t=1).J()
    Sym in the Jack J with t=1 basis

Zonal polynomials::

    sage: Sym.zonal()
    Sym in the zonal basis

LLT polynomials:

    sage: Sym.llt(3).hspin()
    Sym in the level 3 LLT spin basis
    sage: Sym.llt(3).hcospin()
    Sym in the level 3 LLT cospin basis
    sage: Sym.kBoundedSubspace(3,1)
    3-bounded Symmetric Functions over Rational Field with t=1
    sage: SymmetricFunctions(QQ['t']).kBoundedSubspace(3)
    3-bounded Symmetric Functions over Univariate Polynomial Ring in t over Rational Field
    sage: Sym.kschur(3,1)                                
    3-bounded Symmetric Functions over Rational Field with t=1 in the 3-Schur basis also with t=1
    sage: Sym.khomogeneous(3)  
    3-bounded Symmetric Functions over Rational Field with t=1 in the 3-bounded homogeneous basis
    sage: SymmetricFunctions(QQ['t']).kschur(3)
    3-bounded Symmetric Functions over Univariate Polynomial Ring in t over Rational Field in the 3-Schur basis

Apply:

Depends on #5457
Depends on #8899

CC: @zabrocki @anneschilling @saliola

Component: combinatorics

Keywords: symmetric functions

Author: Nicolas M. Thiéry, Mike Zabrocki

Reviewer: Anne Schilling

Merged: sage-5.4.beta1

Issue created by migration from https://trac.sagemath.org/ticket/13404

@nthiery

This comment has been minimized.

@nthiery
Copy link
Contributor Author

nthiery commented Aug 27, 2012

Dependencies: #13399

@hughrthomas
Copy link

comment:2

Salut Nicolas--

My 2c:

"in the ... basis", not "on the ... basis".

And for me, I don't think of the h basis as "homogeneous", but rather as "complete". The bases are all homogeneous, after all! I guess some people say "complete homogeneous", and maybe that's best -- it gives the word "complete" more meaning (i.e., the h_i are complete subject to being homogeneous). But maybe I was brought up wrong...

cheers,

Hugh

@saliola
Copy link

saliola commented Aug 27, 2012

comment:4

I agree with Hugh regarding "homogeneous". I prefer "complete" or "complete homogeneous".

@nthiery

This comment has been minimized.

@anneschilling
Copy link

comment:7

Replying to @saliola:

I agree with Hugh regarding "homogeneous". I prefer "complete" or "complete homogeneous".

I definitely disagree. Most author abbreviate to "homogeneous". Why is this symbol for this "h" and not "c"? You can change it to "complete homogeneous" if you care about this. But I think just "complete" is a confusing convention.

@zabrocki
Copy link
Mannequin

zabrocki mannequin commented Aug 28, 2012

comment:8

I'm not super keen on just the name 'complete,' at least not as an 'only' option. To go with what the textbooks say (since they set they tend to motivate the notation in other references) : to describe the generators h_n, Macdonald uses "complete symmetric function" (but then uses the word 'complete' only rarely elsewhere in the book), Sagan and Stanley uses "complete homogeneous symmetric functions". When I write and I shorten 'complete homogeneous' I go with 'homogeneous' and I can provide lots of references that uses this name. The short name 'h' to me is short for 'homogeneous.' While I don't mind using both names, I would vote against restricting to the name 'complete' only.

@nthiery

This comment has been minimized.

@nthiery nthiery changed the title Improve _repr_ for macdonald symmetric functions and friends and further cleanup Improved printing for symmetric function bases and misc refactoring Aug 31, 2012
@nthiery
Copy link
Contributor Author

nthiery commented Aug 31, 2012

comment:10

Oops: the updated patch fixes two remaining fixing doctests and an indirect doctest.

@nthiery
Copy link
Contributor Author

nthiery commented Aug 31, 2012

comment:11

Green light; all tested passed as well 5.3.rc0 on sage.math.u-psud.fr.

@anneschilling
Copy link

comment:12

I looked over the patch and overall it looks very good to me. Thanks, Nicolas, for making these changes! Just a quick questions: so this is now consistent with NSym and QSym, right?

Here is one question:

                            sage: SymmetricFunctions(FractionField(QQ['q','t'])).macdonald().P() 
	 	            Macdonald polynomials in the P basis over Fraction Field of Multivariate Polynomial Ring in q, t over Rational Field 
1017	 	            sage: SymmetricFunctions(FractionField(QQ['q','t'])).macdonald(t=2).P() 
1018	 	            Macdonald polynomials in the P basis with t=2 over Fraction Field of Multivariate Polynomial Ring in q, t over Rational Field 
1019	 	            sage: SymmetricFunctions(FractionField(QQ['q','t'])).macdonald(q=2).P() 
1020	 	            Macdonald polynomials in the P basis with q=2 over Fraction Field of Multivariate Polynomial Ring in q, t over Rational Field 
1021	 	            sage: SymmetricFunctions(FractionField(QQ['q','t'])).macdonald(q=2, t=2).P() 
1022	 	            Macdonald polynomials in the P basis with q=2 and t=2 over Fraction Field of Multivariate Polynomial Ring in q, t over Rational Field 
1023	 	            sage: Sym = SymmetricFunctions(FractionField(QQ['t'])).macdonald() 
1024	 	            Traceback (most recent call last): 
1025	 	            ... 
1026	 	            ValueError: parameter q must be in the base ring 
 	1019	            sage: Sym = SymmetricFunctions(FractionField(QQ['q,t'])); Sym.rename("Sym"); Sym 
 	1020	            Sym 
 	1021	            sage: Sym.macdonald().P() 
 	1022	            Sym in the Macdonald P basis 
 	1023	            sage: Sym.macdonald(t=2).P() 
 	1024	            Sym in the Macdonald P with t=2 basis 
 	1025	            sage: Sym.rename() 
 	1026	 
 	1027	        TESTS:: 
 	1028	 
 	1029	            sage: Sym.macdonald().P()._prefix 
 	1030	            'McdP' 
 	1031	            sage: Sym.macdonald().Ht()._prefix 
 	1032	            'McdHt' 

Don't you want to keep some tests when q is set to a value or both parameters are set to a value?

Also, where is zee specified in this code?

 	1519	    def _dual_basis_default(self): 
 	1520	        """ 
 	1521	        Returns the default value for ``self.dual_basis()`` 
 	1522	 
 	1523	        .. SEEALSO:: :meth:`dual_basis` 
 	1524	 
 	1525	        EXAMPLES: 
 	1526	 
 	1527	        This default implementation constructs the dual basis using 
 	1528	        the standard (Hall) scalar product:: 
 	1529	 
 	1530	            sage: Sym = SymmetricFunctions(QQ) 
 	1531	            sage: Sym.p()._dual_basis_default() 
 	1532	            Dual basis to Symmetric Functions over Rational Field in the powersum basis with respect to the Hall scalar product 
 	1533	 
 	1534	        This is meant to be overiden by subclasses for which an 
 	1535	        explicit dual basis is known:: 
 	1536	 
 	1537	            sage: Sym.s()._dual_basis_default() 
 	1538	            Symmetric Functions over Rational Field in the Schur basis 
 	1539	            sage: Sym.h()._dual_basis_default() 
 	1540	            Symmetric Functions over Rational Field in the monomial basis 
 	1541	            sage: Sym.m()._dual_basis_default() 
 	1542	            Symmetric Functions over Rational Field in the homogeneous basis 
 	1543	            sage: Sym.f()._dual_basis_default() 
 	1544	            Symmetric Functions over Rational Field in the elementary basis 
 	1545	            sage: Sym.e()._dual_basis_default() 
 	1546	            Symmetric Functions over Rational Field in the forgotten basis 
 	1547	        """ 
 	1548	        return self.dual_basis(scalar=zee, scalar_name = "Hall scalar product") 

Other than these questions I am happy to set a positive review!

Anne

@nthiery
Copy link
Contributor Author

nthiery commented Aug 31, 2012

comment:13

Hi Anne,

Replying to @anneschilling:

I looked over the patch and overall it looks very good to me. Thanks, Nicolas, for making these changes!

You are welcome!

Just a quick questions: so this is now consistent with NSym and QSym, right?

Yes! Well, almost: there remains the on->in change for NSym and Qsym
(and in general "with realizations"), but that's for another patch.

Don't you want to keep some tests when q is set to a value or both parameters are set to a value?

That would have been better indeed. That being said, the doctests of
SymmetricFunctionsBases.ParentMethods.repr includes an example with
two parameters, and the failure when q is wrong is tested in
Macdonald.init; so if you don't mind I'll be lazy and leave things
as is.

Also, where is zee specified in this code?

 	1519	    def _dual_basis_default(self): 
 	1520	        ...
 	1548	        return self.dual_basis(scalar=zee, scalar_name = "Hall scalar product") 
                                                      ^^^ Here ?

Other than these questions I am happy to set a positive review!

Thanks!

Cheers,
Nicolas

@nthiery
Copy link
Contributor Author

nthiery commented Aug 31, 2012

comment:14

zee is defined as a function around the top of sfa.py.

Cheers,
Nicolas

@anneschilling
Copy link

comment:15

Could you please also comment on this line in the commit message:

"- Updated to doctests in jack.py: the new outputs are equal but
not identical to the previous ones. Why did it change?"

Could you please be more specific what previous means and what precisely is equal, but not identical?

Anne

@nthiery
Copy link
Contributor Author

nthiery commented Aug 31, 2012

comment:16

Replying to @anneschilling:

Could you please be more specific what previous means and what precisely is equal, but not identical?

It's about this hunk:

@@ -363,21 +361,18 @@ class Jack(UniqueRepresentation):
             sage: Sym = SymmetricFunctions(FractionField(QQ['t']))
             sage: JP = Sym.jack().P()
             sage: JQp = Sym.jack().Qp(); JQp
-            Jack polynomials in the Qp basis over Fraction Field of Univariate Polynomial Ring in t over Rational Field
+            Symmetric Functions over Fraction Field of Univariate Polynomial Ring in t over Rational Field in the Jack Qp basis
             sage: a = JQp([2])
             sage: a.scalar(JP([2]))
             1
             sage: a.scalar(JP([1,1]))
             0
             sage: JP(JQp([2]))                        # todo: missing auto normalization
-            ((-t+1)/(-t-1))*JackP[1, 1] + JackP[2]
+            ((2*t-2)/(2*t+2))*JackP[1, 1] + JackP[2]
             sage: JP._normalize(JP(JQp([2])))
-            ((-t+1)/(-t-1))*JackP[1, 1] + JackP[2]
+            ((t-1)/(t+1))*JackP[1, 1] + JackP[2]
         """

@anneschilling
Copy link

comment:17

Yes, this is weird, but I think it is related to the comment "missing auto normalization". Mike and I ran into a similar issue win 5457.

Patch looks good otherwise!

Anne

@anneschilling
Copy link

Reviewer: Anne Schilling

@anneschilling
Copy link

comment:19

There is one more thing that Mike pointed out to me. Currently we have

sage: Sym = SymmetricFunctions(FractionField(QQ['t']))
sage: ks = Sym.kschur(4)
sage: ks
4-Schur functions with t=t
sage: s = Sym.schur()
sage: s
Symmetric Functions over Fraction Field of Univariate Polynomial Ring in t over Rational Field in the Schur basis

Should ks be changed to

4-Bounded Subspace of Symmetric Functions over Fraction Field of Univariate Polynomial Ring in t over Rational Field in the 4-Schur basis

Thanks,

Anne

@nthiery
Copy link
Contributor Author

nthiery commented Sep 1, 2012

comment:21

Replying to @anneschilling:

There is one more thing that Mike pointed out to me. Currently we have

sage: Sym = SymmetricFunctions(FractionField(QQ['t']))
sage: ks = Sym.kschur(4)
sage: ks
4-Schur functions with t=t
sage: s = Sym.schur()
sage: s
Symmetric Functions over Fraction Field of Univariate Polynomial Ring in t over Rational Field in the Schur basis

Should ks be changed to

4-Bounded Subspace of Symmetric Functions over Fraction Field of Univariate Polynomial Ring in t over Rational Field in the 4-Schur basis

Good question. It's a bit long, but has some desirable features
besides consistency with realizations/bases:

  • The ground field is specified
  • It refers to Sym, in such a way that if Sym is renamed to something short, this gets shorter as well

Btw 1: it would be good to have t specified in the name of the kBoundedSubspace.

sage: Sym.kBoundedSubspace(3)
3-bounded Subspace of Symmetric Functions over Fraction Field of Univariate Polynomial Ring in t over Rational Field
sage: Sym.kBoundedSubspace(3,1)
3-bounded Subspace of Symmetric Functions over Fraction Field of Univariate Polynomial Ring in t over Rational Field with t = 1

Btw 2: in the docstrings of new_kschur, wouldn't we want to change

sage: KBoundedSubspace(Sym,3,1)

to

sage: Sym.kBoundedSubspace(3,1)

(except probably once in the __init__, for testing purposes)?

I am not sure I'll have the time to implement that before Tuesday, so
feel free to beat me to it.

Cheers,
Nicolas

@zabrocki zabrocki mannequin added s: needs review and removed s: needs info labels Sep 3, 2012
@anneschilling
Copy link

comment:24

Replying to @zabrocki:

Latest patch modifies the doc-tests in new_kschur.py to reflect Nicolas' note "Btw 2". If you are happy with the names, this is ready for review.

Hi Mike, the changes look good to me with one exception. Nicolas mentioned in his Btw 2:
"(except probably once in the init, for testing purposes)". Could you please leave one of the original kBoundedSubspace tests in the _init_ ?

Other than that, all tests pass for me on sage-5.3.rc0 + 2 5457 patches + 13399 patch.

Anne

@zabrocki
Copy link
Mannequin

zabrocki mannequin commented Sep 4, 2012

comment:25

Hi Mike, the changes look good to me with one exception. Nicolas mentioned in his Btw 2:
"(except probably once in the init, for testing purposes)". Could you please leave one of the original kBoundedSubspace tests in the _init_ ?

Thanks for catching that. I had that change but didn't qrefresh before I attached the patch.

Ignore/delete the patch trac_13404_kschur_rename-mz.2.patch ... it was an accident

@anneschilling
Copy link

comment:26

Replying to @zabrocki:

Hi Mike, the changes look good to me with one exception. Nicolas mentioned in his Btw 2:
"(except probably once in the init, for testing purposes)". Could you please leave one of the original kBoundedSubspace tests in the _init_ ?

Thanks for catching that. I had that change but didn't qrefresh before I attached the patch.

Ignore/delete the patch trac_13404_kschur_rename-mz.2.patch ... it was an accident

Ok, looks good and tests pass!

Anne

@nthiery
Copy link
Contributor Author

nthiery commented Sep 4, 2012

comment:28

Replying to @zabrocki:

Ignore/delete the patch trac_13404_kschur_rename-mz.2.patch ... it was an accident

Deleted.

Thanks for finalizing this patch!

@nthiery
Copy link
Contributor Author

nthiery commented Sep 4, 2012

Changed author from Nicolas M. Thiéry to Nicolas M. Thiéry, Mike Zabrocki

@nthiery
Copy link
Contributor Author

nthiery commented Sep 4, 2012

comment:30

And thanks Anne for the review!

@jdemeyer jdemeyer removed this from the sage-5.4 milestone Sep 5, 2012
@anneschilling
Copy link

Changed dependencies from #13399 to #5457

@anneschilling

This comment has been minimized.

@anneschilling
Copy link

comment:33

Hi Nicolas and Mike,

I fodled your two patches together and commuted it past 13399, so that it now only depends on #5457. I did not change any content.

Please and set a positive review if happy!

Anne

@anneschilling
Copy link

comment:34

Apply: trac_13404-sf-nt.3.patch

@zabrocki
Copy link
Mannequin

zabrocki mannequin commented Sep 5, 2012

comment:35

I've tested and looked it over and I am happy with it. Thanks Anne for doing all the work to get these cleaned up. 12140-comment! It has a positive review already so I'm not changing anything but I am satisfied it seems to apply cleanly and runs as before.

@anneschilling anneschilling added this to the sage-5.4 milestone Sep 5, 2012
@anneschilling
Copy link

comment:37

The new uploaded patch fixes a doc test failure in relation with #8899.

Anne

@anneschilling
Copy link

Changed dependencies from #5457 to #5457, #8899

@anneschilling
Copy link

Attachment: trac_13404-sf-nt.3.patch.gz

@nthiery
Copy link
Contributor Author

nthiery commented Sep 8, 2012

comment:39

I double checked the change and confirm the positive review. Thanks Anne!

@jdemeyer
Copy link

Merged: sage-5.4.beta1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants