I know how to use a table to create expressions, for example I can create a table of variables $p_{i,j}$ where $i$ runs from 0 to 10 and $j$ runs from 0 to 10 by using the following code
variables=Table[Subscript[p,i,j],{i,0,10},{j,0,10}]
Now, I want to create the following expressions: $p_{i,j}*p_{k,l}$ such that $i+k=6$ and $j+l=4$. I tried the following code:
polynomials = Table[If[i + k == 6 && j + l == 4,
Subscript[p, i, j]*Subscript[p, k, l]], {i, 0, 10}, {j, 0, 10},
{k, 0, 10}, {l, 0, 10}]
And I got the following output
{{{{Null, Null, Null}, {Null, Null, Null}, {Null, Null, Null}, {Null,
Null, Null}, {Null, Null, Null}, {Null, Null, Null}, {Null, Null,
Null}}, {{Null, Null, Null}, {Null, Null, Null}, {Null, Null,
Null}, {Null, Null, Null}, {Null, Null, Null}, {Null, Null,
Null}, {Null, Null, Null}}, {{Null, Null, Null}, {Null, Null,
Null}, {Null, Null, Null}, {Null, Null, Null}, {Null, Null,
Null}, {Null, Null, Null}, {Null, Null,
Subscript[p, 0, 2] Subscript[p, 6, 2]}}}, {{{Null, Null,
Null}, {Null, Null, Null}, {Null, Null, Null}, {Null, Null,
Null}, {Null, Null, Null}, {Null, Null, Null}, {Null, Null,
Null}}, {{Null, Null, Null}, {Null, Null, Null}, {Null, Null,
Null}, {Null, Null, Null}, {Null, Null, Null}, {Null, Null,
Null}, {Null, Null, Null}}, {{Null, Null, Null}, {Null, Null,
Null}, {Null, Null, Null}, {Null, Null, Null}, {Null, Null,
Null}, {Null, Null, Subscript[p, 1, 2] Subscript[p, 5, 2]}, {Null,
Null, Null}}}, {{{Null, Null, Null}, {Null, Null, Null}, {Null,
Null, Null}, {Null, Null, Null}, {Null, Null, Null}, {Null, Null,
Null}, {Null, Null, Null}}, {{Null, Null, Null}, {Null, Null,
Null}, {Null, Null, Null}, {Null, Null, Null}, {Null, Null,
Null}, {Null, Null, Null}, {Null, Null, Null}}, {{Null, Null,
Null}, {Null, Null, Null}, {Null, Null, Null}, {Null, Null,
Null}, {Null, Null, Subscript[p, 2, 2] Subscript[p, 4, 2]}, {Null,
Null, Null}, {Null, Null, Null}}}, {{{Null, Null, Null}, {Null,
Null, Null}, {Null, Null, Null}, {Null, Null, Null}, {Null, Null,
Null}, {Null, Null, Null}, {Null, Null, Null}}, {{Null, Null,
Null}, {Null, Null, Null}, {Null, Null, Null}, {Null, Null,
Null}, {Null, Null, Null}, {Null, Null, Null}, {Null, Null,
Null}}, {{Null, Null, Null}, {Null, Null, Null}, {Null, Null,
Null}, {Null, Null,
\!\(\*SubsuperscriptBox[\(p\), \(3, 2\), \(2\)]\)}, {Null, Null,
Null}, {Null, Null, Null}, {Null, Null, Null}}}, {{{Null, Null,
Null}, {Null, Null, Null}, {Null, Null, Null}, {Null, Null,
Null}, {Null, Null, Null}, {Null, Null, Null}, {Null, Null,
Null}}, {{Null, Null, Null}, {Null, Null, Null}, {Null, Null,
Null}, {Null, Null, Null}, {Null, Null, Null}, {Null, Null,
Null}, {Null, Null, Null}}, {{Null, Null, Null}, {Null, Null,
Null}, {Null, Null, Subscript[p, 2, 2] Subscript[p, 4, 2]}, {Null,
Null, Null}, {Null, Null, Null}, {Null, Null, Null}, {Null, Null,
Null}}}, {{{Null, Null, Null}, {Null, Null, Null}, {Null, Null,
Null}, {Null, Null, Null}, {Null, Null, Null}, {Null, Null,
Null}, {Null, Null, Null}}, {{Null, Null, Null}, {Null, Null,
Null}, {Null, Null, Null}, {Null, Null, Null}, {Null, Null,
Null}, {Null, Null, Null}, {Null, Null, Null}}, {{Null, Null,
Null}, {Null, Null, Subscript[p, 1, 2] Subscript[p, 5, 2]}, {Null,
Null, Null}, {Null, Null, Null}, {Null, Null, Null}, {Null, Null,
Null}, {Null, Null, Null}}}, {{{Null, Null, Null}, {Null, Null,
Null}, {Null, Null, Null}, {Null, Null, Null}, {Null, Null,
Null}, {Null, Null, Null}, {Null, Null, Null}}, {{Null, Null,
Null}, {Null, Null, Null}, {Null, Null, Null}, {Null, Null,
Null}, {Null, Null, Null}, {Null, Null, Null}, {Null, Null,
Null}}, {{Null, Null,
Subscript[p, 0, 2] Subscript[p, 6, 2]}, {Null, Null, Null}, {Null,
Null, Null}, {Null, Null, Null}, {Null, Null, Null}, {Null, Null,
Null}, {Null, Null, Null}}}}
We can spot some polynomials in this big table of NULL's which satisfy this property.
Question: How do I get rid of all these NULL's and only get the polynomials I want?