I'm working on a project where I need to do composition of polynomials; something like
P(Q1 + Q2)
where P
, Q1
, and Q2
are univariate polynomials with several hundred terms, and large integer coefficients (on the order of 10^10 or so). I've been doing this with the .subs()
method which, I think, moves things to the symbolic ring and does the substitutions there. (I think this because when I get errors, they have to do with coercing to or from the symbolic ring.) But it occurred to me I could also define a ring homomorphism sending the variable of P
to Q1 + Q2
, and then apply the homomorphism to P
.
So my question: will this be worth my while, or are the ring homomorphism methods too slow?