[PATCH] fix 'principalIdeal' in EuclideanDomain

3 views
Skip to first unread message

Qian Yun

unread,
May 19, 2026, 7:38:26 PM (7 days ago) May 19
to fricas-devel
(1) -> principalIdeal([2/3])

2
(1) [coef = [-], generator = 1]
3

(2) -> principalIdeal([2/3,2/3])

3
(2) [coef = [0, -], generator = 1]
2

principalIdeal : List % -> Record(coef : List %, generator : %)
++ principalIdeal([f1, ..., fn]) returns a record whose
++ generator component is a generator of the ideal
++ generated by \spad{[f1, ..., fn]} whose coef component satisfies
++ \spad{generator = sum (input.i * coef.i)}

unitNormal : % -> Record(unit : %, canonical : %, associate : %)
++ unitNormal(x) tries to choose a canonical element
++ from the associate class of x.
++ The attribute canonicalUnitNormal, if asserted, means that
++ the "canonical" element is the same across all associates of x
++ if \spad{unitNormal(x) = [u, c, a]} then
++ \spad{u*c = x}, \spad{a*u = 1}.

As illustrated in the example and documentation above, it should
be "uca.associate" instead of "uca.unit" in "principalIdeal".

- Qian

diff --git a/src/algebra/catdef.spad b/src/algebra/catdef.spad
index 262ba2ba..ff3334c7 100644
--- a/src/algebra/catdef.spad
+++ b/src/algebra/catdef.spad
@@ -528,7 +528,7 @@
l = [] => error "empty list passed to principalIdeal"
rest l = [] =>
uca := unitNormal(first l)
- [[uca.unit], uca.canonical]
+ [[uca.associate], uca.canonical]
rest rest l = [] =>
u := extendedEuclidean(first l, second l)
[[u.coef1, u.coef2], u.generator]

Waldek Hebisch

unread,
May 21, 2026, 6:34:19 PM (5 days ago) May 21
to fricas...@googlegroups.com
On Wed, May 20, 2026 at 07:38:22AM +0800, Qian Yun wrote:
> (1) -> principalIdeal([2/3])
>
> 2
> (1) [coef = [-], generator = 1]
> 3
>
> (2) -> principalIdeal([2/3,2/3])
>
> 3
> (2) [coef = [0, -], generator = 1]
> 2
>
> principalIdeal : List % -> Record(coef : List %, generator : %)
> ++ principalIdeal([f1, ..., fn]) returns a record whose
> ++ generator component is a generator of the ideal
> ++ generated by \spad{[f1, ..., fn]} whose coef component satisfies
> ++ \spad{generator = sum (input.i * coef.i)}
>
> unitNormal : % -> Record(unit : %, canonical : %, associate : %)
> ++ unitNormal(x) tries to choose a canonical element
> ++ from the associate class of x.
> ++ The attribute canonicalUnitNormal, if asserted, means that
> ++ the "canonical" element is the same across all associates of x
> ++ if \spad{unitNormal(x) = [u, c, a]} then
> ++ \spad{u*c = x}, \spad{a*u = 1}.
>
> As illustrated in the example and documentation above, it should
> be "uca.associate" instead of "uca.unit" in "principalIdeal".

Thanks, please commit

> diff --git a/src/algebra/catdef.spad b/src/algebra/catdef.spad
> index 262ba2ba..ff3334c7 100644
> --- a/src/algebra/catdef.spad
> +++ b/src/algebra/catdef.spad
> @@ -528,7 +528,7 @@
> l = [] => error "empty list passed to principalIdeal"
> rest l = [] =>
> uca := unitNormal(first l)
> - [[uca.unit], uca.canonical]
> + [[uca.associate], uca.canonical]
> rest rest l = [] =>
> u := extendedEuclidean(first l, second l)
> [[u.coef1, u.coef2], u.generator]
>
> --
> You received this message because you are subscribed to the Google Groups "FriCAS - computer algebra system" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to fricas-devel...@googlegroups.com.
> To view this discussion visit https://groups.google.com/d/msgid/fricas-devel/1966ca8a-85e5-4edc-8abe-317f1608e506%40gmail.com.

--
Waldek Hebisch
Reply all
Reply to author
Forward
0 new messages