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!
Asked
Active
Viewed 553 times
0
-
If you are taking [q,r] = deconv(conv(f,f),h), then r should be your answer (for the case where k = 2). Are you saying this does not produce the expected result? What do you mean about not getting all the individual powers? – dustincarr Apr 21 '14 at 23:25
-
Thanks Dustincarr for the comment. Taking [q,r]=deconv(conv(f,f),h), r is my answer. But I need for example to calculate f, f^2=f.f, f^3 = f^2.f, f^4=f^3.f, ..., f^t=f^(t-1).f with all the powers. For example for f^t I would like to have all the powers in form of f, f^2, ...,f^t. Using a for loop I am only getting f^t and not all the powers in between. I know it is probably easy but I am trying and can't figure it out. I am doing it as follows: for i=1:t, u=f, [q,r]=deconv(conv(f,u),h); end. But I am only geting f^t.Instead of f^1, f^2, f^3,...f^t. Any idea? Thanks – Simon Robert Apr 22 '14 at 10:26
1 Answers
1
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.

dustincarr
- 1,365
- 1
- 9
- 14
-
Would that not produce the dyadic powers of f, reduced by h? i.e., f mod h, f^2 mod h, f^4 mod h,...,f^(2^(t-1)) mod h? – Lutz Lehmann Apr 22 '14 at 18:47
-
This answered my question, thanks alot for the hint. Eventually the array r((length(f)-length(k)):end) would be an alternative way to save the answer depending on wether with or without the leading zeros at most significant values. But with your answer I can indeed get all the powers of a given polynomial f. – Simon Robert Apr 23 '14 at 17:45
-
@SimonRobert, glad it worked. Be sure to "accept" this as the answer. I thought of trying to make it work with an array like you describe, but cells seemed to make more sense for this. – dustincarr Apr 23 '14 at 18:21