sagemath/sage

Remove abuse of predefined x in doctests

Closed this issue · 4 comments

For example in src/sage/rings/number_field/number_field.py

        sage: K.<a> = NumberField(x^2 - 2)

This leads to numerous errors when sage.symbolic is not available (#32601).

CC: @tscrim @orlitzky

Component: refactoring

Issue created by migration from https://trac.sagemath.org/ticket/32721

slel commented
comment:3

Many NumberField and FiniteField definitions
use a polynomial in x.

The corresponding documentation examples
would be improved by first defining x as:

sage: x = polygen(ZZ)
slel commented
comment:4

Many calculus and plotting examples use a symbolic variable x.

The corresponding documentation examples
would be improved by first defining x as:

sage: x = SR.var('x')
comment:5

Perhaps, but that's not in the scope of this ticket.

comment:6

Some of these fixes are done in #32609.