4
$\begingroup$

As the title suggests, I want to have Mathematica resolve

Element[p, Primes]
PolynomialMod[(1+x)^p, p]

to $1+x^p$. I have a massive symbolic function I would like to reduce in this fashion, and it involves many terms of the form above for two arbitrary primes $p$ and $q$. I can do a replace all with the reductions above, but that'll involve going through the pages of output and manually finding things to replace. I was hoping for something more automatic and elegant. Also, is it possible to have the above reduction occur within a square root?

$\endgroup$
2
$\begingroup$

If I'm understanding the documentation for PolynomialMod correctly, it appears to be treating (1+x)^p as a polynomial where the order p term has a coefficient of 1. Hence, that coefficient won't be reduced further modulo anything and MMA just spits back the polynomial you started with.

One simple solution might be to just use ReplaceAll like this:

(1+x)^p /. Power[1 + y_,q_] -> 1 + Power[y,q] 

This can also be extended to square roots (I'm assuming you mean $\sqrt{(1+x)^p} \rightarrow \sqrt{1 + x^p}$), for example:

 {(1 + x)^p, (1 + z)^t + (1 + r)^m, Sqrt[(1 + tasty)^taco]} /. {Sqrt[Power[1 + y_, q_]] -> Sqrt[1 + y^q], Power[1 + y_, q_] -> 1 + y^q}

(*{1 + x^p, 2 + r^m + z^t, Sqrt[1 + tasty^taco]}*)

As long as you know what the relevant transformations should be, you should be able to use them to define patterns and rules that will give you what you want. This approach won't be able to automate any mathematics behind the scenes if there are other transformations you don't already know.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.