Revision history [back]

The problem is adding expressions in a and B.

Your code tries to do that in the second coordinate of P.

Here is a simpler incarnation of your problem.

sage: k.<B> = NumberField(x^2 - 2)
sage: k.<a> = NumberField(x^4 - 5*x^2 - 32)
sage: a^2-4*B
Traceback (most recent call last)
...
TypeError: unsupported operand parent(s) for '-': 'Number Field in a with defining polynomial x^4 - 5*x^2 - 32' and 'Number Field in B with defining polynomial x^2 - 2'


The problem is adding expressions in involving a and B.

Your code tries to do that in the The second coordinate of P in your code is 27*a*(a^2-4*B-5).

Here is a simpler incarnation of your problem.

sage: k.<B> = NumberField(x^2 - 2)
sage: k.<a> = NumberField(x^4 - 5*x^2 - 32)
sage: a^2-4*B
Traceback (most recent call last)
...
TypeError: unsupported operand parent(s) for '-': 'Number Field in a with defining polynomial x^4 - 5*x^2 - 32' and 'Number Field in B with defining polynomial x^2 - 2'


The problem is adding expressions involving a and B.

The second coordinate of P in your code is 27*a*(a^2-4*B-5).

Here is a simpler incarnation of your problem.

sage: k.<B> = NumberField(x^2 - 2)
sage: k.<a> = NumberField(x^4 - 5*x^2 - 32)
sage: a^2-4*B
Traceback (most recent call last)
...
TypeError: unsupported operand parent(s) for '-': 'Number Field in a with defining polynomial x^4 - 5*x^2 - 32' and 'Number Field in B with defining polynomial x^2 - 2'


Maybe you need to use relative number fields?

See the documentation for relative number fields at http://doc.sagemath.org/html/en/reference/number_fields/sage/rings/number_field/number_field_rel.html

The problem is adding expressions involving a and B.

The second coordinate of P in your code is 27*a*(a^2-4*B-5).

Here is a simpler incarnation of your problem.

sage: k.<B> = NumberField(x^2 - 2)
sage: k.<a> = NumberField(x^4 - 5*x^2 - 32)
sage: a^2-4*B
Traceback (most recent call last)
...
TypeError: unsupported operand parent(s) for '-': 'Number Field in a with defining polynomial x^4 - 5*x^2 - 32' and 'Number Field in B with defining polynomial x^2 - 2'


Maybe you need to use relative number fields?

See the documentation for relative number fields at http://doc.sagemath.org/html/en/reference/number_fields/sage/rings/number_field/number_field_rel.html

If instead of the above you define a relative number fields, this works.

sage: k.<a> = NumberField(x^4 - 5*x^2 - 32)
sage: K.<B> = k.extension(x^2+2)
sage: a^2-4*B
-4*B + a^2