I do not understand why? (AN -> Numeric)

3 views
Skip to first unread message

Grégory Vanuxem

unread,
Mar 28, 2026, 1:39:53 PM (12 hours ago) Mar 28
to fricas...@googlegroups.com
Hello,

Why:

(21) -> sqrt((-77051393/2)/6561)

+----------+
| 77051393
|- --------
\| 2
(21) -------------
81

Type: AlgebraicNumber
(22) -> numeric(%)

>> Error detected within library code:
cannot retract nonconstant polynomial

I know a little of how AN is implemented, EXPR(INT) in a personal way
from memory, but why this?

Greg

Grégory Vanuxem

unread,
Mar 28, 2026, 1:43:38 PM (12 hours ago) Mar 28
to fricas...@googlegroups.com
Just because the output is a complex number?

Waldek Hebisch

unread,
Mar 28, 2026, 1:48:34 PM (12 hours ago) Mar 28
to fricas...@googlegroups.com
numric essentially convert algebraic number (or more general expression)
to Expression(Float). Expression(Float) exaluates all what it can
so in many cases this gives a single numer which is the result of
'numeric'. But you take square root of a negative number, which can
not be evaluated inside Float:

(5) -> sqrt((-77051393/2)/6561)::EXPR(FLOAT)

+------------+
(5) 0.0123456790_1234567901_2\|- 38525696.5
Type: Expression(Float)

If you want complex result use:

(6) -> complexNumeric(sqrt((-77051393/2)/6561))

(6) 76.6284834638_91664735 %i
Type: Complex(Float)

--
Waldek Hebisch

Grégory Vanuxem

unread,
Mar 28, 2026, 2:13:31 PM (12 hours ago) Mar 28
to fricas...@googlegroups.com
Oh, my error, thanks I was trying to coerce a Nemo AN to its numeric
values and forgot this:

(3) -> jnan(-77051393/2)/6561

(3) {a1: -5871.92}

Type: NMAlgebraicNumber

Time: 0.03 (EV) = 0.03 sec
(4) -> %::EXPR FLOAT

Cannot convert the value from type NMAlgebraicNumber to Expression(Float) .

(4) -> jnan(-77051393/2)/6561

(4) {a1: -5871.92}

Type: NMAlgebraicNumber

Time: 0.01 sec
(5) -> numeric %


I need some further improvements in my settings of NMAlgebraicNumber.
I know that.

Sorry, and thanks (shame on me)

Greg
=========================================================
PS:

(16) -> %^2

(16) {a2: -0.894974 + 0.446118*im}

Type: NMAlgebraicNumber

Time: 0 sec
(17) -> real %

(17) {a1: -0.894974}

Type: NMAlgebraicNumber

Time: 0.01 (EV) = 0.02 sec
(18) -> %::Float

Cannot convert the value from type NMAlgebraicNumber to Float .

(18) -> %::SF

Cannot convert the value from type NMAlgebraicNumber to DoubleFloat .

(18) -> %::AN

77051393
(18) - --------
86093442

Type: AlgebraicNumber

Time: 0.11 (IN) = 0.11 sec
(19) -> sqrt %

+----------+
| 77051393
|- --------
\| 2
(19) -------------
6561

Type: AlgebraicNumber

Time: 0 sec
(20) -> %::NMA
NMAcbField NMAlgebraicNumber NMArbField
(20) -> %::NMA
NMAcbField NMAlgebraicNumber NMArbField
(20) -> %::NMAlgebraicNumber

Cannot convert the value from type AlgebraicNumber to NMAlgebraicNumber .

(20) -> %::NMAcbField

Although NMAcbField is the name of a constructor, a full type must
be specified in the context you
have used it. Issue )show NMAcbField for more information.

(20) -> %::NMF
NMFactored NMField NMFiniteField NMFraction
(20) -> %::NMF
NMFactored NMField NMFiniteField NMFraction
(20) -> %::NMField

Cannot convert the value from type AlgebraicNumber to NMField .

(20) -> numeric %

>> Error detected within library code:
cannot retract nonconstant polynomial

(20) -> %%(19)

+----------+
| 77051393
|- --------
\| 2
(20) -------------
6561

Type: AlgebraicNumber

Time: 0 sec
(21) -> numeric %

>> Error detected within library code:
cannot retract nonconstant polynomial

> --
> 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/acgUb3WGsnQPkF6I%40fricas.org.

Grégory Vanuxem

unread,
Mar 28, 2026, 2:16:05 PM (12 hours ago) Mar 28
to fricas...@googlegroups.com
But, somewhat, the error message is somewhat strange...

Le sam. 28 mars 2026 à 18:48, Waldek Hebisch <de...@fricas.org> a écrit :
>
Reply all
Reply to author
Forward
0 new messages