Opened 2 years ago

Last modified 2 years ago

## #25709 new defect

# inject_variables is broken for orders of number fields

Reported by: | lftabera | Owned by: | |
---|---|---|---|

Priority: | major | Milestone: | sage-8.3 |

Component: | categories | Keywords: | days94 |

Cc: | Merged in: | ||

Authors: | Reviewers: | ||

Report Upstream: | N/A | Work issues: | |

Branch: | Commit: | ||

Dependencies: | Stopgaps: |

### Description

inject_variables may have wrong results:

sage: A = ZZ[sqrt(2)] sage: A.inject_variables() Defining sqrt2 sage: sqrt2 1 sage: A.gens() (1, sqrt2) sage: A.variable_names() ('sqrt2',) sage: B=ZZ[sqrt(2),sqrt(3)] sage: B.inject_variables() Defining sqrt2, sqrt3 sage: sqrt2 -sqrt3*sqrt2 + 3 sage: sqrt3 6*sqrt2 - 5*sqrt3

**Note:**See TracTickets for help on using tickets.

inject_variables uses self.gens to determine the objects to map to variable_names, while the preparser uses _first_ngens.

I suspect that the preparser is correct here. Since gens may have different meanings for subclasses.