There is already a "routine" called coercion

sage: P = QQ['x','y','z']['u','v']['a']['s','t']
sage: R = QQ['x']['y']['z']['u']['v']['a']['s']['t']

Generators of P:

sage: Px,Py,Pz,Pu,Pv,Pa,Ps,Pt = map(P, 'xyzuvast')

Generators of R:

sage: Rx,Ry,Rz,Ru,Rv,Ra,Rs,Rt = map(R, 'xyzuvast')

A polynomial on P

sage: p = (Px + Pu*(Py*Pz +Pa)) * (1 + Ps + Pt) * (1 + Px)

Its equivalent on R

sage: r = R(p)

Of course, this is not completely automatic like

sage: p.as_I_want()

Note that the data structure used for the above polynomial r will be
*very* slow compared to using directly the multivariate polynomial ring
QQ['x','y','z','u','v','a','s','t']. So I would rather advice you to try
hard using this one instead of the recursive version.

Vincent

On 27/04/15 18:56, Ralf Hemmecke wrote:
> Suppose I have an algorithm that works over univariate polynomials and can 
> be recursively applied to its coefficients which may be themselves 
> univariate polynomials over univariate polynomials ... over some base ring 
> like QQ.
> It probably makes sense to assume that the input polynomial is given 
> exactly in such a recursive format.
> 
> Before I start writing a wrapper routine that turns any polynomial into 
> such a recursive form, I'd like to ask whether such a routine perhaps 
> already exists.
> 
> Input should be a polynomial in any form, for example living in 
> Q[x,y,z][u,v][a][s,t] should be transformed into the "same" polynomial 
> living in Q[x][y][z][u][v][a][s][t] (of course, creating that very 
> recursive polynomial ring during the coercion).
> 
> I hope, it's somehow clear what I mean.
> 
> Thank you in advance.
> 
> Ralf
> 

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.

Reply via email to