Opened 13 years ago

Closed 2 years ago

# multivariate polynomial GCD should work over more base rings

Reported by: Owned by: cwitty malb major sage-8.5 commutative algebra gaetan.bisson@… Thierry Monteil Vincent Delecroix N/A 74cdf73 74cdf733c940cf5a0dbe7a51f95eb87b997a9188

### Description

Consider this example:

```  R.<a,b> = NumberField(x^2-3,'g').extension(x^2-7,'h')[]
h = R.base_ring().gen()
S.<y> = R.fraction_field()[]
xgcd(y^2, a*h*y+b)
```

This fails because Sage attempts to find the GCD of multivariate polynomials over a relative number field using Singular, and Singular does not support relative number fields. This should be implemented in Sage (probably by converting the relative number field into an absolute field, performing the computation, and converting back).

See also #3329, which is about the exact same test case, but requests only a better error message.

### comment:1 Changed 12 years ago by malb

It does something now:

```sage: R.<a,b> = NumberField(x^2-3,'g').extension(x^2-7,'h')[]
sage: h = R.base_ring().gen()
sage: S.<y> = R.fraction_field()[]
sage: xgcd(y^2, a*h*y+b)
(49*a^4*b^2/(343*a^6), 1, ((-1)/(h*a))*y + 49*a^4*b/(343*a^6))
```

### comment:2 follow-up: ↓ 3 Changed 12 years ago by AlexGhitza

• Cc gaetan.bisson@… added

And now:

```----------------------------------------------------------------------
| Sage Version 3.4, Release Date: 2009-03-11                         |
| Type notebook() for the GUI, and license() for information.        |
----------------------------------------------------------------------
sage: R.<a,b> = NumberField(x^2-3,'g').extension(x^2-7,'h')[]
sage: h = R.base_ring().gen()
sage: S.<y> = R.fraction_field()[]
sage: xgcd(y^2, a*h*y+b)
(b^2/(7*a^2), 1, ((-1)/(h*a))*y + b/(7*a^2))
```

This actually looks correct to me. I'm cc-ing the original poster so he can comment on it.

### comment:3 in reply to: ↑ 2 ; follow-up: ↓ 5 Changed 12 years ago by bisson

This actually looks correct to me. I'm cc-ing the original poster so he can comment on it.

Thanks for letting me know this issue has been fixed, and many thanks to the people who fixed it.

Something a little bit weird happens if I try to verify Sage's output:

```sage: R.<a,b> = NumberField(x^2-3,'g').extension(x^2-7,'h')[]
sage: h = R.base_ring().gen()
sage: S.<y> = R.fraction_field()[]
sage: xgcd(y^2, a*h*y+b)
(b^2/(7*a^2), 1, ((-1)/(h*a))*y + b/(7*a^2))

sage: y^2+(((-1)/(h*a))*y + b/(7*a^2))*(a*h*y+b)
h*a*b^2/(7*h*a^3)
```

As you see, the output is not simplified as b2/(7a2); is there a reason for that?

I am not opening a new ticket because I would like to have your opinion on whether it really is a bug or not before possibly doing so.

### comment:4 Changed 2 years ago by tmonteil

• Branch set to u/tmonteil/multivariate_polynomial_gcd_should_work_over_more_base_rings

### comment:5 in reply to: ↑ 3 Changed 2 years ago by tmonteil

• Authors set to Thierry Monteil
• Commit set to 74cdf733c940cf5a0dbe7a51f95eb87b997a9188
• Report Upstream set to N/A
• Status changed from new to needs_review

It seems indeed to work perfectly well now, so let us add a doctest to prevent its comeback.

By the way, replying to bisson:

```sage: y^2+(((-1)/(h*a))*y + b/(7*a^2))*(a*h*y+b)
h*a*b^2/(7*h*a^3)
```

As you see, the output is not simplified as b2/(7a2); is there a reason for that?

Note that we now have:

```sage: y^2+(((-1)/(h*a))*y + b/(7*a^2))*(a*h*y+b)
b^2/(7*a^2)
```

as expected.

New commits:

 ​74cdf73 `#3330 : add doctest for xgcd for polynomials over relative number fields.`

### comment:6 Changed 2 years ago by vdelecroix

• Reviewers set to Vincent Delecroix
• Status changed from needs_review to positive_review

### comment:7 Changed 2 years ago by vdelecroix

• Milestone changed from sage-wishlist to sage-8.5

### comment:8 Changed 2 years ago by vbraun

• Branch changed from u/tmonteil/multivariate_polynomial_gcd_should_work_over_more_base_rings to 74cdf733c940cf5a0dbe7a51f95eb87b997a9188
• Resolution set to fixed
• Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.