I essentially have something of the form
pm[1, 2] pm[3, 4] pm[5, 6] c[{1, 2, 5, 6}, "+"] c[{3, 4}, "-"]
I want to add next to each pm a corresponding plus or minus; so I want to have an expression that looks like
pm[1, 2]["+"] pm[3, 4]["-"] pm[5, 6]["+"] c[{1, 2, 5, 6}, "+"] c[{3, 4}, "-"]
Does anybody know a simple way to do this? My problem is that I'm not sure how to access the indices in the "c" and match them up with my list entries for each pm;
Edit: so here's a bit of an explanation of what is going on. I need to code the multiplication of two diagrams which looks like this:
So the first cycle will have the representation in code of
pp[1,4]pp[2,3]pm[1,2]pm[3,4]c[{1,2,3,4},"+"]
while the second will look like
pp[1,2]pp[3,4]pm[1,2]pm[3,4]c[{1,2},"+"]c[{3,4},"-"]
So the "pp"s represent that matchings on top while the "pm"s represent the matchings on bottom. Each "c" tells me I have a cycle, as well as which vertices are in the cycle and if the cycle has been assigned a plus or minus.
So here's how the multiplication works; the bottom of the first and the top of the second get ignored, and I just get back the top of the first combined with the bottom of the second, with some replacement rules for the plus/minuses. Specifically,
$$(+,+)\to+$$ $$(+,-)\to -$$ $$(-,+)\to -$$ $$(-,-)\to 0$$
So the reason we get a minus out, is that between vertices 1 and 2 we get $(+,+)\to+$ and between 3 and 4 we get $(+,-)\to -$ and then overall we are left with $(+,-)\to-$ for the single cycle. So the way to get the "pp/pm" structure of the result is simple; I just ignore what I don't need. I need the "c" structures to tell me where my plus and minuses are. So what I'd ideally like my code to do is take our two inputs from the picture, and give me
pp[1,4]["+"]pp[2,3]["+"]pm[1,2]["+"]pm[3,4]["-"]
which I can then use to do some combining and give me a final result of
pp[1,4]pp[2,3]pm[1,2]pm[3,4]c[{1,2,3,4},"-"]
Yes I know this is long and convoluted. I'm also pretty new to Mathematica so if you think my whole approach is awful don't be afraid to tell me.
NOTE: I forgot to mention there may be an arbitrary (but always even) number of vertices. I just used four vertices in my example because it was simplest.
pm[a, b]
wherea
is inc[... "+"]
andb
is inc[... "-"]
? If that's not the case, I suspect that there's way to simplify your "data structure". $\endgroup$