I have polynomials in several variables x[i]
and y[j]
, and I am using First@SymmetricReduce@
twice (first with respect to the x's, then the y's), so that each term of the final result takes the form
symmetric poly in the x[i]
* symmetric poly in the y[j]
.
Now I need to convert the "x" part and "y" part into Schur polynomials separately. I've written the function to do that manually one term at a time, but now how can I map that function at the "x" part of every term simultaneously? (Likewise for the "y" part then.)
Edit: Specifically, given a polynomial in which each term consists of an unspecified number of x[i]
factors followed by an unspecified number of y[j]
factors, how can I map one function to the "x" part of every term, and then map another function to the "y" part of every term?
The functions I'll be mapping are the following:
XtoSchur[expr_] := toSchur@(Expand[expr] /. x -> $x);
YtoSchur[expr_] := toSchur@(Expand[expr] /. y -> $x);
(The toSchur
function is from Coquereaux's SymPol$Package.) But a typical input I begin with looks like this (there are only 6 main terms here):
1 + (x[1]^2 x[2] + x[1] x[2]^2 + x[1]^2 x[3] + x[1] x[2] x[3] +
x[2]^2 x[3] + x[1] x[3]^2 + x[2] x[3]^2) y[1] y[2] y[3] +
x[1]^2 x[2]^2 x[3]^2 y[1]^2 y[2]^2 y[3]^2 +
(-x[1]^2 x[2] x[3] - x[1] x[2]^2 x[3] - x[1] x[2] x[3]^2) y[1] y[2] y[
3] (y[1] + y[2] + y[3]) +
(-x[1] x[2] - x[1] x[3] - x[2] x[3]) (y[1] y[2] + y[1] y[3] + y[2] y[3]) +
x[1] x[2] x[3] (y[1] + y[2] + y[3]) (y[1] y[2] + y[1] y[3] + y[2] y[3])
So every term has an "x" part followed by a "y" part, but I can't figure out how to make a function map at each of the "x" parts at once (and then another function map at all the "y" parts).
ps = Position[eq, _x]; ps2 = Position[eq, _x^_]; MapAt[Test@# &, eq, Join[Complement[ps, Append[#, 1] & /@ ps2], ps2]]
Forx[1]^2 x[2] + x[1] x[2]^2
output isTest[x[1]^2] Test[x[2]] + Test[x[1]] Test[x[2]^2]
$\endgroup$Position
will be the key. I can tell my description was not entirely clear; here is a better example. I am often starting with something like(x[1]^4 x[2] + x[1]^3 x[2]^2 + x[1]^2 x[2]^3 + x[1] x[2]^4) y[1] y[2] y[3] y[4] y[5]
. Given two functions TestX and TestY, I need to be able to obtain the outputTestX[x[1]^4 x[2] + x[1]^3 x[2]^2 + x[1]^2 x[2]^3 + x[1] x[2]^4] * TestY[y[1] y[2] y[3] y[4] y[5]]
. I'm working on modifying your idea to get this result ... $\endgroup$