Opened 3 years ago

no conversion between number fields over base rings which have conversion

Reported by: Owned by: dkrenn major sage-9.5 number fields vdelecroix, jipilab Daniel Krenn N/A u/dkrenn/conversion-nf-base 3da22b8efd0a774537cedf35292ad9d07525daa4

Description

```sage: CyclotomicField(3).extension(x^2+1, 'i')(QQ.extension(x^2+1, 'i').gen())
```

returns

```TypeError: Cannot coerce element into this number field
```

comment:1 follow-up: ↓ 2 Changed 3 years ago by nbruin

While in sage it would make sense that a homomorphism sending i to i would be the preferred one, it requires some work to see if that's valid. For instance, you'd have to distinguish it from

```CyclotomicField(4).extension(x^2+3, 'i')(QQ.extension(x^2+1, 'i').gen())
```

I'm not sure we can fix this easily.

comment:2 in reply to: ↑ 1 Changed 3 years ago by dkrenn

While in sage it would make sense that a homomorphism sending i to i would be the preferred one, it requires some work to see if that's valid. For instance, you'd have to distinguish it from

```CyclotomicField(4).extension(x^2+3, 'i')(QQ.extension(x^2+1, 'i').gen())
```

I'm not sure we can fix this easily.

I see your point. So a conversion in general is difficult.

However, we could focus on (special) coercions (in contrast to conversions): If we have two bases `A` and `B` where `B` has a coercion map from `A`, then `B.extensions(f, 'i')` should have a coercion map from `A.extension(f, 'i')` for I guess all `f`.

comment:3 Changed 3 years ago by dkrenn

• Branch set to u/dkrenn/conversion-nf-base

comment:4 Changed 3 years ago by dkrenn

• Authors set to Daniel Krenn
• Status changed from new to needs_review

I've made some changes that do what I expected from this ticket. Please have a look (as I am no expert on the insights of the implementation of number fields in SageMath).

New commits:

 ​c42d4bd `Trac #26443: conversion in relative number fields when bases have conversion` ​3da22b8 `Trac #26443: enable coercion for previous extensions in conversion`

comment:5 Changed 2 years ago by jipilab

While working on polyhedron over algebraic numbers, we struggled around something that might (or not) be related. But in anycase is something similar.

comment:6 Changed 2 years ago by vdelecroix

What you ask for is not a well defined operation! The answer could equally be `i` or `-i`. You should specify what you actually want.

The current (clean but tedious) way to do it is

```sage: K = CyclotomicField(3).extension(x^2+1, 'i')
sage: L = QQ.extension(x^2+1, 'i')
sage: f = Hom(L, K)([K.gen()])
sage: f
Ring morphism:
From: Number Field in i with defining polynomial x^2 + 1
To:   Number Field in i with defining polynomial x^2 + 1 over its base field
Defn: i |--> i
sage: f(L.gen())
i
```

comment:7 Changed 2 years ago by vdelecroix

This is even more true if you specify complex embedding for your number fields! The conversion that you implemented ("the obvious algebraic one") might not be the one the user expect...

comment:8 Changed 19 months ago by vdelecroix

• Milestone changed from sage-8.4 to sage-9.1
• Status changed from needs_review to needs_info

comment:9 Changed 17 months ago by mkoeppe

• Milestone changed from sage-9.1 to sage-9.2

Moving tickets to milestone sage-9.2 based on a review of last modification date, branch status, and severity.

comment:10 Changed 11 months ago by mkoeppe

• Milestone changed from sage-9.2 to sage-9.3

comment:11 Changed 6 months ago by mkoeppe

• Milestone changed from sage-9.3 to sage-9.4

Moving this ticket to 9.4, as it seems unlikely that it will be merged in 9.3, which is in the release candidate stage

comment:12 Changed 2 months ago by mkoeppe

• Milestone changed from sage-9.4 to sage-9.5

Setting a new milestone for this ticket based on a cursory review.

Note: See TracTickets for help on using tickets.