ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Sat, 13 May 2017 18:07:39 +0200Multivariate rational function field of rank 3 over Rational Fieldhttps://ask.sagemath.org/question/37584/multivariate-rational-function-field-of-rank-3-over-rational-field/I'm want to rewrite a small Magma code in Sage, and I want to define a multivariate rational function field of rank 3 over rational field. Simply, I have the following Magma code:
aInv<a2,a4,a6> := FunctionField(Rationals(), 3);
_<X> := PolynomialRing(aInv);
f := X^3 + a2*X^2 + a4*X + a6;
fprim := Derivative(f);
I started doing something like this:
aInv<a2,a4,a6> = FunctionField(QQ['a2,a4,a6'])
But, I get a TypeError, more specifically, I get:
> TypeError: constant_field must be a
Any idea how to achieve what I want?
> field.Sat, 13 May 2017 15:38:07 +0200https://ask.sagemath.org/question/37584/multivariate-rational-function-field-of-rank-3-over-rational-field/Answer by tmonteil for <p>I'm want to rewrite a small Magma code in Sage, and I want to define a multivariate rational function field of rank 3 over rational field. Simply, I have the following Magma code:</p>
<pre><code>aInv<a2,a4,a6> := FunctionField(Rationals(), 3);
_<X> := PolynomialRing(aInv);
f := X^3 + a2*X^2 + a4*X + a6;
fprim := Derivative(f);
</code></pre>
<p>I started doing something like this:</p>
<pre><code>aInv<a2,a4,a6> = FunctionField(QQ['a2,a4,a6'])
</code></pre>
<p>But, I get a TypeError, more specifically, I get:</p>
<blockquote>
<p>TypeError: constant_field must be a</p>
</blockquote>
<p>Any idea how to achieve what I want?</p>
<blockquote>
<p>field.</p>
</blockquote>
https://ask.sagemath.org/question/37584/multivariate-rational-function-field-of-rank-3-over-rational-field/?answer=37587#post-id-37587For some reason (which i do not know), `FunctionField` only works in one variable (see the doc with `FunctionField?`). So you have to create it as a fraction field of a polynomial ring:
sage: aInv_poly = PolynomialRing(QQ,'a2,a4,a6')
sage: aInv_poly
Multivariate Polynomial Ring in a2, a4, a6 over Rational Field
sage: aInv = aInv_poly.fraction_field()
sage: aInv.inject_variables()
Defining a2, a4, a6
sage: R.<X> = PolynomialRing(aInv); R
Univariate Polynomial Ring in X over Fraction Field of Multivariate Polynomial Ring in a2, a4, a6 over Rational Field
sage: f = X^3 + a2*X^2 + a4*X + a6 ; f
X^3 + a2*X^2 + a4*X + a6
sage: fprim = f.derivative()
sage: fprim
3*X^2 + 2*a2*X + a4
Sat, 13 May 2017 18:07:39 +0200https://ask.sagemath.org/question/37584/multivariate-rational-function-field-of-rank-3-over-rational-field/?answer=37587#post-id-37587