Contact
CoCalc Logo Icon
StoreFeaturesDocsShareSupport News AboutSign UpSign In
| Download
Project: Teaching
Views: 137
Visibility: Unlisted (only visible to those who know the link)
Image: ubuntu2004
### Below is a Sage worksheet for our class on Symmetric Functions. ### Class webpage: https://www.math.ucla.edu/~galashin/206A_2022_sym_fcns.html ### To run the below code, create an account on cocalc.com, create a new Sage worksheet there, and copy the code. #initialization: Sym = SymmetricFunctions(QQ) #the ring of symmetric functions m = Sym.m() #monomial e = Sym.e() #elementary symmetric h = Sym.h() #complete homogeneous p = Sym.p() #power sum s = Sym.s() #Schur functions print("Init OK!")
Init OK!
print("To specify a basis element, supply a partition in the form [lambda_1,lambda_2,...] as an argument:") h([2,2]) print("expanded in a different basis: ",h([2,2]),"=",m(h([2,2])))
To specify a basis element, supply a partition in the form [lambda_1,lambda_2,...] as an argument: h[2, 2] expanded in a different basis: h[2, 2] = 6*m[1, 1, 1, 1] + 4*m[2, 1, 1] + 3*m[2, 2] + 2*m[3, 1] + m[4]
print("Cycle through all partitions like this:") n=3 for la in Partitions(n): #"lambda" is protected in python print(h(la),"=",m(h(la)))
Cycle through all partitions like this: h[3] = m[1, 1, 1] + m[2, 1] + m[3] h[2, 1] = 3*m[1, 1, 1] + 2*m[2, 1] + m[3] h[1, 1, 1] = 6*m[1, 1, 1] + 3*m[2, 1] + m[3]
print("You can also get directly the transition matrix:") h.transition_matrix(m,n=3)
You can also get directly the transition matrix: [1 1 1] [1 2 3] [1 3 6]
print("Expand a symmetric polynomial in some number of variables:") poly=h([2]).expand(3) #specify the number of variables print("h_2(x_0,x_1,x_2) =",poly) print("Inverse operation is also sometimes useful:") poly_inverse=Sym.from_polynomial(poly) print(poly,"=",poly_inverse,"=",h(poly_inverse))
Expand a symmetric polynomial in some number of variables: h_2(x_0,x_1,x_2) = x0^2 + x0*x1 + x1^2 + x0*x2 + x1*x2 + x2^2 Inverse operation is also sometimes useful: x0^2 + x0*x1 + x1^2 + x0*x2 + x1*x2 + x2^2 = m[1, 1] + m[2] = h[2]
scalar1 = m([2,2]).scalar(h([2,2])) scalar0 = m([2,2]).scalar(h([2,1,1])) om = h([2,2]).omega() #Below I'm using the percent notation for output formatting; #see e.g. https://stackabuse.com/python-string-interpolation-with-the-percent-operator/ print("Scalar product: <%s,%s>=%s, but <%s,%s>=%s"%(m([2,2]),h([2,2]),scalar1,m([2,2]),h([2,1,1]),scalar0)) print("Omega involution: omega(%s) = %s = %s"%(h([2,2]),om,e(om)))
Scalar product: <m[2, 2],h[2, 2]>=1, but <m[2, 2],h[2, 1, 1]>=0 Omega involution: omega(h[2, 2]) = h[1, 1, 1, 1] - 2*h[2, 1, 1] + h[2, 2] = e[2, 2]
print("Useful functions for partitions:") la = Partition([5,3,1,1,1,0,0]) #this is not the same as [5,3,1,1,1,0,0], which is a list in python print("lambda=",la) print("size (sum of parts)=",la.size(),"; length (number of nonzero parts)=",la.length()) print("z_lambda = 1^3 * 3! * 3^1 * 1! * 5^1 * 1! = ",la.aut()) print("epsilon_lambda = (-1)^{number of even parts of lambda} =",la.sign())
Useful functions for partitions: lambda= [5, 3, 1, 1, 1] size (sum of parts)= 11 ; length (number of nonzero parts)= 5 z_lambda = 1^3 * 3! * 3^1 * 1! * 5^1 * 1! = 90 epsilon_lambda = (-1)^{number of even parts of lambda} = 1
print("Let's check that p_lambda's are orthogonal.") n = 3 for la in Partitions(n): for mu in Partitions(n): print("<%s,%s>=%s"%(p(la),p(mu),p(la).scalar(p(mu)))) if la == mu: print("z_lambda=",la.aut())
Let's check that p_lambda's are orthogonal. <p[3],p[3]>=3 z_lambda= 3 <p[3],p[2, 1]>=0 <p[3],p[1, 1, 1]>=0 <p[2, 1],p[3]>=0 <p[2, 1],p[2, 1]>=2 z_lambda= 2 <p[2, 1],p[1, 1, 1]>=0 <p[1, 1, 1],p[3]>=0 <p[1, 1, 1],p[2, 1]>=0 <p[1, 1, 1],p[1, 1, 1]>=6 z_lambda= 6
print("And now let's check that p_lambda's are eigenvectors of omega:") n = 4 for la in Partitions(n): print("omega(%s) = %s; epsilon_%s = %s "%(p(la),p(la).omega(),la,la.sign())) if p(la).omega() != la.sign() * p(la): raise Exception("Theorem is false!")
And now let's check that p_lambda's are eigenvectors of omega: omega(p[4]) = -p[4]; epsilon_[4] = -1 omega(p[3, 1]) = p[3, 1]; epsilon_[3, 1] = 1 omega(p[2, 2]) = p[2, 2]; epsilon_[2, 2] = 1 omega(p[2, 1, 1]) = -p[2, 1, 1]; epsilon_[2, 1, 1] = -1 omega(p[1, 1, 1, 1]) = p[1, 1, 1, 1]; epsilon_[1, 1, 1, 1] = 1
print("Exercise: do the same for Schur functions and see what happens!")
Exercise: do the same for Schur functions and see what happens!
# For more information, check these links: # https://doc.sagemath.org/html/en/reference/combinat/sage/combinat/partition.html # http://sporadic.stanford.edu/reference/combinat/sage/combinat/sf/sfa.html print("To get quick help on a function, place a question mark right next to it and evaluate:") la=Partition([5,3,1,1,1]) Tableau(la.hook_lengths()).pp() #pp means "pretty print" la.hook_lengths?
To get quick help on a function, place a question mark right next to it and evaluate: 9 5 4 2 1 6 2 1 3 2 1
File: /ext/sage/9.6/local/var/lib/sage/venv-python3.10.3/lib/python3.10/site-packages/sage/combinat/partition.py Signature : la.hook_lengths(self) Docstring : Return a tableau of shape "self" with the cells filled in with the hook lengths. In each cell, put the sum of one plus the number of cells horizontally to the right and vertically below the cell (the hook length). For example, consider the partition "[3,2,1]" of 6 with Ferrers diagram: # # # # # # When we fill in the cells with the hook lengths, we obtain: 5 3 1 3 1 1 EXAMPLES: sage: Partition([2,2,1]).hook_lengths() [[4, 2], [3, 1], [1]] sage: Partition([3,3]).hook_lengths() [[4, 3, 2], [3, 2, 1]] sage: Partition([3,2,1]).hook_lengths() [[5, 3, 1], [3, 1], [1]] sage: Partition([2,2]).hook_lengths() [[3, 2], [2, 1]] sage: Partition([5]).hook_lengths() [[5, 4, 3, 2, 1]] REFERENCES: * http://mathworld.wolfram.com/HookLengthFormula.html