Hi Santanu, On Wed, Jul 15, 2009 at 9:46 PM, Santanu Sarkar<sarkar.santanu....@gmail.com> wrote: > Suppose f=2*x^2+3*x+1 is a polynomial in x. How efficiently we > can calculate f^10 modulo 24?
For the ring of polynomials with coefficients over ZZ: ---------------------------------------------------------------------- | Sage Version 4.1, Release Date: 2009-07-09 | | Type notebook() for the GUI, and license() for information. | ---------------------------------------------------------------------- sage: K.<x> = ZZ["x"] sage: f = 2*x^2 + 3*x + 1 sage: %timeit power_mod(f, 10, 24) 10000 loops, best of 3: 93.7 µs per loop sage: %time power_mod(f, 10, 24) CPU times: user 0.00 s, sys: 0.00 s, total: 0.00 s Wall time: 0.00 s 16*x^20 + 8*x^18 + 12*x^12 + 12*x^11 + 21*x^10 + 6*x^9 + 21*x^8 + 18*x^6 + 12*x^5 + 6*x^4 + 12*x^3 + 17*x^2 + 6*x + 1 Here the coefficient ring is QQ: sage: K.<x> = QQ["x"] sage: f = 2*x^2 + 3*x + 1 sage: %timeit power_mod(f, 10, 24) 1000 loops, best of 3: 374 µs per loop sage: %time power_mod(f, 10, 24) CPU times: user 0.00 s, sys: 0.00 s, total: 0.00 s Wall time: 0.00 s 0 So it looks to be pretty fast :-) -- Regards Minh Van Nguyen --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---