Ask Your Question

Revision history [back]

Building upon @FrédéricC 's comment, here is how to convert SageMath's syntax R.<x> = QQ[] into Python code to be written in a file. In a SageMath session, type

preparse("R.<x> = QQ[]")

This reveals that R.<x> = QQ[] is a shortcut for the following sequence of two Python commands:

R = QQ['x']
(x,) = R._first_ngens(1)

These two lines are to be included in your Python file instead of R.<x> = QQ[].