Search code examples
matlabpolynomial-mathexponentiationfinite-fieldpolynomials

Computing the powers of a polynomial f(x) modulo irreducible polynomial h(x) in MATLAB


Suppose I have a polynomial f(x)= a_0 + a_1*x + a_2*x^2 +...+ a_(n-1)*x^(n-1) with a_i elements of F_q, q prime. How do I compute the powers f(x)^0, f(x)^1, f(x)^2, ..., f(x)^k modulo another polynomial h(x) of degree n for any positive integer k in Matlab? I am using the functions deconv(conv (f(x)), h(x)) but I am not getting all the individual powers. Thanks!


Solution

  • Try this

    u = f;
    for i=1:t      
      [q{i},r{i}] = deconv(f,h);
      f = conv(f,u);
    end
    

    Your answer for each power will be in the cell array r.