On 3/7/07, Kyle Schalm <[EMAIL PROTECTED]> wrote:

> . the question is: how do i evaluate w while leaving z untouched?
> (i actually want to do this when R1 is a multivariable ring, but i imagine
> it works the same way.)
>

Can't you just work with all the variables together, like:

sage: P.<z,w>=QQ['z','w']
sage: P
_2 = Polynomial Ring in z, w over Rational Field
sage: f=z*w
sage: f(z,2)
_4 = 2*z

If, not, you can always make a little function to evaluate (if there
is no "built-in" way).

sage: R1.<w> = QQ['w']
sage: R2.<z> = R1['z']
sage: f = z*w
sage: def my_eval(f,a):
   ...:         coef=f.coeffs()
   ...:     res=0
   ...:     for i in range(len(coef)):
   ...:             res+=coef[i](a)*z^i
   ...:     return res
   ...:
sage: f = z*w
sage: my_eval(f,2)
_5 = 2*z
sage: g=(w+1)+w^2*z+3*z^3
sage: my_eval(g,2)
_7 = 3*z^3 + 4*z + 3



HTH,

Luis

--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://sage.math.washington.edu/sage/ and http://sage.scipy.org/sage/
-~----------~----~----~----~------~----~------~--~---

Reply via email to