Simplify in GF(2)
Afficher commentaires plus anciens
I have computations that I perform symbolically, but they involve integers modulo 2.
It seems that Matlab does not simplify mod expressions (e.g., mod(sym('x')+2,2) results in mod(x + 2, 2) ; specifying that x is an integer does not change anything). Even assuming my variables are integers between 0 and 1 does not result in simpler expressions. For instance:
syms x;
assume(in(x,"integer") & (x>=0) & (x<=1));
simplify(x*x)
% ans = x^2
% I would expect ans = x
In my expressions where I only work in GF(2) using polynomial expressions recursively on matrices of symbols, I rapidly obtain gigantic expressions that would be trivially simplified (e.g: 2*x^8*y*z + x*y^2 + x^2*y etc. that would here be 0, but my formulas are way longer and I can't do it by hand).
Is-there any way to make Matlab simplify expressions knowing that they involve computations modulo 2 ? I use R2023b.
Thanks !
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Number Theory dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!