Hello Mathematica StackExchange community,
I'm hoping that someone can be of help!
Let p be a fixed prime. I have a multivariable polynomial g (of degree t). I need a list of all the monomial terms of g which satisfy:
- Degree of the monomial term is t.
- Each of the exponents in the monomial term is less than or equal to p-2
I have been playing around with the Mathematica commands (MonomialList
, Coefficient
, CoefficientRules
, Expand
, etc.), but have not been successful in reaching my goal.
If anybody can provide some help, it is greatly appreciated! Thank you in advance.
Sincerely, Richard M. Low
UPDATE:---------------------------------
Due to kglr's help, I have been able to make some progress on my problem. Here is kglr's original Mathematica code:
ClearAll[x, y, z, f]
t = 4;
p = 5;
poly = (x + 2 y + z)^t + x^2;
f = Select[And[Total@# == t, Max[#] <= p - 2] &@Exponent[#, {x, y, z}] &];
selected = f@MonomialList[poly]
I'm hoping that kglr (or somebody else) can help me modify it slightly.
Since the typical polynomials that I will be working with may have (literally) billions (~ 6^14) of monomial terms, I would like for the output of f to be 1 monomial term (not the entire list) which satisfies the two conditions (in my original post) AND whose coefficient is not equal to 0 (mod p).
This will greatly decrease the runtime and memory usage of the Mathematica program. The runtime of the original Mathematica program went past several days and I ended up aborting the calculation.
Again, I appreciate any help that the Mathematica StackExchange can provide. I am completely incompetent in Mathematica programming.
Thank you in advance.
Sincerely, Richard M. Low