1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170
|
newPackage(
"SymmetricPolynomials",
Version => "1.0",
Date => "May 20 2009",
Authors => {{Name => "Alexandra Seceleanu", HomePage => "http://www.math.uiuc.edu/~asecele2/"}},
Headline => "symmetric polynomials",
Keywords => {"Combinatorics", "Representation Theory"},
DebuggingMode => false
)
export {"buildSymmetricGB","elementarySymmetric"}
mons = (X,i)-> (
n := #X;
a := unique flatten apply( apply( partitions (i), p-> toList p| for i from #p to n-1 list 0),q-> permutations q);
return apply(a, r-> product for i to n-1 list X_i^(r_i))
)
symring= R->(
X:= flatten entries vars R;
n := #X;
w := (for i to n-1 list (1))|toList(1..n);
e := getSymbol "e";
S := (coefficientRing R)[X,e_1..e_n,MonomialOrder=>{Weights => w,Lex}];
return S
)
protect elementarySymmetricRing
elementarySymmetricPolynomialRing =(cacheValue symbol elementarySymmetricRing)symring
buildSymmetricGB =method();
buildSymmetricGB (PolynomialRing) := R -> (
n := # flatten entries vars R;
S := elementarySymmetricPolynomialRing R;
xvars := select(n,gens S,i->true);
svars :=select(2*n,gens S,i->true)-set xvars;
x := local x;
A :=coefficientRing(R)[svars,xvars][x];
svars =apply(svars,i->(map(A,S))(i));
xvars =apply(xvars,i->(map(A,S))(i));
g :=x^n+sum for i to n-1 list svars_i*x^(n-i-1);
l := {};
for i to n-1 do (
f :=sub(g,x=>-xvars_(n-i-1));
l = append(l,f);
g=g//(x+xvars_(n-i-1));
);
F := map(S,A);
l= apply(l,i-> F i);
use R;
return l
)
elementarySymmetric = method();
elementarySymmetric (RingElement):= f -> (
R := ring f;
n := # flatten entries vars R;
if n<2 then return f;
l := buildSymmetricGB(R);
I := ideal l;
S := ring I;
forceGB matrix {l};
F := map(S,R);
answer := F(f)%I;
xvars := select(n,gens S,i->true);
svars := gens S -set xvars;
if isSubset(support(answer),svars) then (use R; return answer)
else (use R; print "your input is not a symmetric polynomial")
)
elementarySymmetric (PolynomialRing):= R->(
forceGB matrix{buildSymmetricGB R};
return map(elementarySymmetricPolynomialRing R,R)
)
beginDocumentation()
document {
Key =>SymmetricPolynomials,
Headline => "the algebra of symmetric polynomials",
PARA{"This package uses an explicit description of the Groebner basis of the ideal of obvious relations in this algebra based on:"},
PARA{"Grayson, Stillmann - Computations in the intersection theory of flag varieties, preprint, 2009"},
PARA{"Sturmfels - Algorithms in Invariant Theory, Springer Verlag, Vienna, 1993"}
}
document {
Key =>elementarySymmetric,
Headline => "expression in terms of elementary symmetric polynomials",
Inputs => {"f, a symmetric", TO RingElement},
Outputs =>{"the expression of f in terms of the elementary symmetric functions e_i"},
Usage => "elementalSymm f",
Caveat => {"if the input is not symmetric the function will announce this"},
EXAMPLE lines ///
n=5;
R=QQ[x_1..x_n];
f=(product gens R)*(sum gens R);
elementarySymmetric f
///,
PARA{"This function should work up to a size of 15 variables in the base ring."},
PARA{"This function is part of the package SymmetricPolynomials."}
}
document {
Key =>(elementarySymmetric,RingElement),
Headline => "expression in terms of elementary symmetric polynomials",
Inputs => {"f"=> {"a symmetric", TO RingElement}},
Outputs =>{"the expression of f in terms of the elementary symmetric functions e_i"},
Usage => "elementalSymm f",
Caveat => {"if the input is not symmetric the function will announce this"},
EXAMPLE lines ///
n=5;
R=QQ[x_1..x_n];
f=(product gens R)*(sum gens R);
elementarySymmetric f
///,
PARA{"This function should work up to a size of 15 variables in the base ring"},
PARA{"This function is part of the package SymmetricPolynomials."}
}
document {
Key =>(elementarySymmetric,PolynomialRing),
Headline => "elementary symmetric polynomials algebra",
Inputs => {"R"=>{ "a", TO PolynomialRing}},
Outputs =>{"a map from R adjoin the elementary symmetric functions e_i to R"},
Usage => "elementalSymm R",
EXAMPLE lines ///
n=5;
R=QQ[x_1..x_n];
elementarySymmetric R
///,
PARA{"This function should work up to a size of 15 variables in the base ring"},
PARA{"This function is part of the package SymmetricPolynomials."}
}
document {
Key =>buildSymmetricGB,
Headline => "Groebner basis of elementary symmetric polynomials algebra",
Inputs => {"R"=>{ "a", TO Ring}},
Outputs =>{"the Groebner basis of the elementary symmetric algebra"},
Usage => "buildSymmetricGB R",
EXAMPLE lines ///
n=5;
R=QQ[x_1..x_n];
buildSymmetricGB R
///,
PARA{"This function should work up to a size of 15 variables in the base ring"},
PARA{"This function is part of the package SymmetricPolynomials."}
}
document {
Key =>(buildSymmetricGB,PolynomialRing),
Headline => "Groebner basis of elementary symmetric polynomials algebra",
Inputs => {"R"=>{ "a", TO PolynomialRing}},
Outputs =>{"the Groebner basis of the elementary symmetric algebra"},
Usage => "buildSymmetricGB R",
EXAMPLE lines ///
n=5;
R=QQ[x_1..x_n];
buildSymmetricGB R
///,
PARA{"This function should work up to a size of 15 variables in the base ring"},
PARA{"This function is part of the package SymmetricPolynomials."}
}
end
|