Magma allows the extension to and contraction from the ring of quotients of an ideal, defined over a field, with respect to certain variables. See [BW93, pp. 54--58 and 388--397] for the relevant definitions and theory.
Given an ideal I of the polynomial ring P = K[x1, ..., xn], where K is a field, together with a sequence U of integers each between 1 and n, create the (ring of quotients) extension Q of P, and return the ideal J of Q, together with the map f: P -> Q.If U has length k and the values (in order) of U are u1, ..., uk, then first the rational function field F = K(xu1, ..., xuk) is constructed, then the list v1, ..., vn - k is constructed as the list 1, ..., n with the ui removed, and finally the extension Q of P is defined to be the polynomial ring F[xv1, ..., x_(vn - k)] = K(xu1, ..., xuk)[xv1, ..., x_(vn - k)].
The map f is constructed in the obvious way so that xi is mapped to the appropriate variable in F if i is in U, or the appropriate variable in Q otherwise. The image under f of an ideal of P is just the appropriate ideal of Q whose basis is obtained by taking the image under f of each of the polynomials in the basis of I.
The inverse image under f of a polynomial of Q is obtained by first making the polynomial monic, then multiplying by the LCM of the denominators ("clearing the denominators"), then mapping each variable back to the appropriate one in P---this is possible since there are no proper denominators. The inverse image under f of an ideal H of Q is defined to be the ideal of P generated by the inverse images under f of the polynomials in the basis of H (note that this is not always equal to the contraction of H---see [BW93, p. 389], for a simple algorithm to compute the contraction of an ideal of Q).