Skip to content

Commit 988ae0a

Browse files
committed
avoid division by zero
1 parent 98f852a commit 988ae0a

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

src/sage/rings/function_field/drinfeld_modules/charzero_drinfeld_module.py

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
Drinfeld modules over rings of characteristic zero
44
55
This module provides the classes
6-
:class:`sage.rings.function_fields.drinfeld_module.charzero_drinfeld_module.DrinfeldModule_charzero`,
6+
:class:`sage.rings.function_fields.drinfeld_module.charzero_drinfeld_module.DrinfeldModule_charzero` and
77
:class:`sage.rings.function_fields.drinfeld_module.charzero_drinfeld_module.DrinfeldModule_rational`,
8-
which inherits
8+
which both inherit
99
:class:`sage.rings.function_fields.drinfeld_module.drinfeld_module.DrinfeldModule`.
1010
1111
AUTHORS:
@@ -527,8 +527,9 @@ def class_polynomial(self):
527527
When the coefficients of the Drinfeld module have small
528528
enough degrees, the class module is always trivial::
529529
530-
sage: r = 4
531-
sage: phi = DrinfeldModule(A, [T] + [A.random_element(degree=q**i) for i in range(1, r+1)])
530+
sage: gs = [T] + [A.random_element(degree = q^i)
531+
....: for i in range(1, 5)]
532+
sage: phi = DrinfeldModule(A, gs)
532533
sage: phi.class_polynomial()
533534
1
534535
@@ -606,8 +607,9 @@ def taelman_exponential_unit(self):
606607
The same occurs more generally when the coefficients of the
607608
Drinfeld module have small enough degrees::
608609
609-
sage: r = 4
610-
sage: phi = DrinfeldModule(A, [T] + [A.random_element(degree=q**i) for i in range(1, r+1)])
610+
sage: gs = [T] + [A.random_element(degree = q^i - 1)
611+
....: for i in range(1, 5)]
612+
sage: phi = DrinfeldModule(A, gs)
611613
sage: phi.taelman_exponential_unit()
612614
1
613615
@@ -649,5 +651,6 @@ def taelman_exponential_unit(self):
649651

650652
unit = V.left_kernel().basis()[0]
651653
expunit = sum(unit[i]*ps[i] for i in range(s+1))
652-
expunit /= expunit.numerator().leading_coefficient()
654+
if expunit:
655+
expunit /= expunit.numerator().leading_coefficient()
653656
return expunit

0 commit comments

Comments
 (0)