Hello,
Thanks for the quick response!
> This is what I get:
> ...
> So looks like it hasn't been implemented yet.
Right on. I'll start poking around, then.
> Good question. First, I would implement RootOf.mypow(n) and see if you
> can figure out how to get the answer you want. That's the hard part.
> What's the algorithm to determine which powers simplify and which not?
I was considering starting with a binary method like the one outlined here:
http://en.wikipedia.org/wiki/Modular_exponentiation
(I remember this from a number theory course I took with William Stein back in my undergraduate days!) I guess the simplification convention, if there is one, is to reduce modulo the leading term of the polynomial. So if `alpha` is a root of
f(x) = c x**n + lower_order_terms(x)
then
alpha**n = lower_order_terms(alpha) / c
Any high power of the root can be given in terms of lower powers. The harder part will be making this fast. (To my knowledge the binary method is the most common fast approach.)
> Then the next question is how to hook this up into sympy, so that it
> simplifies automatically, I guess one would need to add an if
> statement into the Pow simplification somewhere.
The more I think about it the more it looks like the bulk of the problem is to implement modular exponentiation of polynomials...
I'll implement a "mypow" first and see what people have to say about making this play nice with everything.
--
Chris Swierczewski
University of Washington
Department of Applied Mathematics
www.cswiercz.info