Ask Your Question

Revision history [back]

Functions in polynomials rings

I want to define a function in a polynomial ring in several variables.

R.<x1,x3,x5>=PolynomialRing(QQ)

I am trying to define a function that takes $(i,j)$ to $x_i^j$.

I tried

def f(i,j):
   return xi^j

This does not work. I tried replacing xi with x[i], that doesn't work. Can someone please tell me what I am doing wrong and how to fix it? If instead of taking 3 variables I take only 1 variable then the method works.