# Re: [sage-devel] valuation() for relative number fields raises errors

9 views

### Dima Pasechnik

Apr 17, 2020, 9:20:10 PM4/17/20
to sage-devel, sage-nt
On Sat, Apr 18, 2020 at 4:15 AM Evan O'Dorney <emo91...@gmail.com> wrote:
>
> Hi all,
>
> Running the code
> K.<pi, w> = NumberField([x^2 - 2, x^2 + x + 1]);
> K.valuation(pi)
> yields a strange AssertionError.

Still present in 9.1.rc0:

sage: K.<p, w> = NumberField([x^2 - 2, x^2 + x + 1]);
....: K.valuation(p)
....:
---------------------------------------------------------------------------
AssertionError Traceback (most recent call last)
<ipython-input-1-287e617d0b40> in <module>()
1 K = NumberField([x**Integer(2) - Integer(2), x**Integer(2) + x
+ Integer(1)], names=('p', 'w',)); (p, w,) = K._first_ngens(2);
----> 2 K.valuation(p)

/home/dimpase/sage/local/lib/python3.7/site-packages/sage/rings/number_field/number_field.py
in valuation(self, prime)
7277 """
7280
7281 def some_elements(self):

/home/dimpase/sage/local/lib/python3.7/site-packages/sage/structure/factory.pyx
in sage.structure.factory.UniqueFactory.__call__
(build/cythonized/sage/structure/factory.c:2162)()
365 False
366 """
--> 367 key, kwds = self.create_key_and_extra_args(*args, **kwds)
368 version = self.get_version(sage_version)
369 return self.get_object(version, key, kwds)

in create_key_and_extra_args(self, R, prime, approximants)
134 return self.create_key_for_local_ring(R, prime), {}
135 elif is_NumberField(R.fraction_field()) or
is_PolynomialQuotientRing(R):
--> 136 return
self.create_key_and_extra_args_for_number_field(R, prime,
approximants=approximants)
137 else:
implemented for %r"%(R,))

in create_key_and_extra_args_for_number_field(self, R, prime,
approximants)
201 return
self.create_key_and_extra_args_for_number_field_from_valuation(R,
K.valuation(prime), prime, approximants=approximants)
202 elif prime in L or isinstance(prime,
NumberFieldFractionalIdeal):
--> 203 return
self.create_key_and_extra_args_for_number_field_from_ideal(R,
L.fractional_ideal(prime), prime)
204 else:
205 raise ValueError("prime must be a discrete
pseudo-valuation, a prime in the base ring, or a fractional ideal")

in create_key_and_extra_args_for_number_field_from_ideal(self, R, I,
prime)
301
302 candidates_for_I = [c for c in candidates if
all(c(g.polynomial()) > 0 for g in I.gens())]
--> 303 assert(len(candidates_for_I) > 0) # This should not be
possible, unless I contains a unit
304 if len(candidates_for_I) > 1:
305 raise ValueError("%s does not single out a unique
extension of %s to %s"%(prime, vK, L))

AssertionError:

BTW, note that 'pi' is a defined constant in Sage, so using it to name
a variable is not a good idea.

> Oddly enough, constructing the same number field in this way:
> K2.<w2, pi2> = NumberField([x^2 + x + 1, x^2 - 2]);
> K2.valuation(pi2)
> works just fine.
>
> I'm running SageMath 8.8 on Linux Mint 18 Cinnamon 64-bit.
>
> Thanks,
> Evan
>
> --
> You received this message because you are subscribed to the Google Groups "sage-devel" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+...@googlegroups.com.