Inverse (symbolic comuptation) - information - Nemo (FLINT) from Julia used

7 views
Skip to first unread message

Grégory Vanuxem

unread,
May 15, 2025, 1:41:18 PMMay 15
to fricas...@googlegroups.com
Hello here,

Can you explain me this:

==

└─$ jlfricas
Checking for foreign routines
FRICAS="/usr/local/lib/fricas/target/x86_64-linux-gnu"
spad-lib="/usr/local/lib/fricas/target/x86_64-linux-gnu/lib/libspad.so"
foreign routines found
openServer result 0
                       FriCAS Computer Algebra System
          Version: jlFriCAS 1.3.12-dev built with SBCL 2.5.2.debian
                 Timestamp: Wed Apr 16 09:50:54 AM CEST 2025
-----------------------------------------------------------------------------
   Issue )copyright to view copyright notices.
   Issue )summary for a summary of useful system commands.
   Issue )quit to leave FriCAS and return to shell.
-----------------------------------------------------------------------------


(1) -> jnecf (-2/3)

   (1)  -0.666667 {-2/3}
                                                                                     Type: NMExactCalciumField
                                                                        Time: 0.13 (EV) + 3.88 (OT) = 4.01 sec
(2) -> sqrt %

   (2)  0.816497*I {(a)/3 where a = 2.44949*I [a^2+6=0]}
                                                                                     Type: NMExactCalciumField
                                                                                                Time: 0.01 sec
(3) -> sin %

   (3)
  0.910291*I {(-a^2*c+c)/(2*a) where a = 0.441977 [Exp(-0.816497 {(b*c)/3})], b = 2.44949*I [b^2+6=0], c = I [c^
  2+1=0]}
                                                                                     Type: NMExactCalciumField
                                                                                    Time: 0.02 (EV) = 0.02 sec

(4) -> asin %

   (4)  0.816497*I {(a)/3 where a = 2.44949*I [a^2+6=0]}
                                                                                     Type: NMExactCalciumField
                                                                                    Time: 0.02 (EV) = 0.02 sec
(5) -> %^2

   (5)  -0.666667 {-2/3}
                                                                                     Type: NMExactCalciumField
                                                                                                Time: 0.02 sec
(6) -> -2/3

          2
   (6)  - -
          3
                                                                                       Type: Fraction(Integer)
                                                                                                   Time: 0 sec
(7) -> sqrt %

         +---+
         |  2
   (7)   |- -
        \|  3
                                                                                         Type: AlgebraicNumber
                                                                                    Time: 0.03 (OT) = 0.03 sec
(8) -> sin %

             +---+
             |  2
   (8)  sin( |- - )
            \|  3
                                                                                     Type: Expression(Integer)
                                                                                                   Time: 0 sec
(9) -> asin %

                  +---+
                  |  2
   (9)  asin(sin( |- - ))
                 \|  3
                                                                                     Type: Expression(Integer)
                                                                                                   Time: 0 sec
(10) -> %^2

                   +---+  2
                   |  2
   (10)  asin(sin( |- - ))
                  \|  3
                                                                                     Type: Expression(Integer)
                                                                                                   Time: 0 sec
(11) ->

Is it related to complex number handling or the fact that EXPR(INT) is used a lot (algebraic number for example). Or I am totally wrong.

Greg   

Grégory Vanuxem

unread,
May 15, 2025, 3:20:42 PMMay 15
to fricas...@googlegroups.com
Another way using WS language:

(1) -> jWSExpr(-2/3)

   (1)

     2
   -(-)
     3
                                                                                          Type: JLWSExpression
                                                            Time: 0.01 (IN) + 0.01 (EV) + 5.61 (OT) = 5.64 sec

(2) -> sqrt %

   (2)

          2
   I sqrt(-)
          3
                                                                                          Type: JLWSExpression
                                                                        Time: 0.02 (EV) + 0.10 (OT) = 0.12 sec

(3) -> sin %

   (3)

               2
   I sinh(sqrt(-))
               3
                                                                                          Type: JLWSExpression
                                                                                    Time: 0.08 (OT) = 0.09 sec

(4) -> asin %

   (4)

          2
   I sqrt(-)
          3
                                                                                          Type: JLWSExpression
                                                                                    Time: 0.09 (OT) = 0.10 sec
(5) -> %^2

   (5)

     2
   -(-)
     3

Waldek Hebisch

unread,
May 15, 2025, 4:53:10 PMMay 15
to fricas...@googlegroups.com
On Thu, May 15, 2025 at 07:40:39PM +0200, Grégory Vanuxem wrote:
> Hello here,
>
> Can you explain me this:

I am not sure what you want explained? Algorithms then Nemo uses
to give possible symbolic values of floating pint results? Or
maybe why FriCAS outputs specific things?

If you wander why FriCAS leaves asin(sin(x)) unsimplified, this
is due to branches, sin(x) = sin(x + 2*%pi), applaying asin
to both sides and using unsound transformation of asin(sin(x))
to x would give false equality x = x + 2*%pi. Similarly,
pulling %i before square roots leads to nonsense like the last
result in the following mail.
> --
> 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/CAHnU2dYwrs775fFCMMh5%3D1WXb_M1EO_ghe3kkQmW1dzb%3DvpeXQ%40mail.gmail.com.

--
Waldek Hebisch

Grégory Vanuxem

unread,
May 16, 2025, 7:41:36 AMMay 16
to fricas...@googlegroups.com
Hello Waldek, *

Le jeu. 15 mai 2025 à 22:53, Waldek Hebisch <de...@fricas.org> a écrit :
On Thu, May 15, 2025 at 07:40:39PM +0200, Grégory Vanuxem wrote:
> Hello here,
>
> Can you explain me this:

I am not sure what you want explained?  Algorithms then Nemo uses               
to give possible symbolic values of floating pint results?  Or                 
maybe why FriCAS outputs specific things? 

The Calcium library, https://fredrikj.net/calcium/introduction.html, was added to Nemo, and in fact displaying the floating point is an expensive option. Normally this is not computed. This is the same for algebraic number, computations are done on roots of polynomials but display also the resulting floating point number:

(2) -> sqrt jnan(-2/3)

   (2)  Root 0.816497*im of 3x^2 + 2  
 
                                   

If you wander why FriCAS leaves asin(sin(x)) unsimplified, this
is due to branches, sin(x) = sin(x + 2*%pi), applaying asin
to both sides and using unsound transformation of asin(sin(x))
to x would give false equality x = x + 2*%pi.  Similarly,
pulling %i before square roots leads to nonsense like the last
result in the following mail.

The second mail use behind the scene Mathematica (jWSExpression)

I can agree that, in general, branches can interfere but in this case, applying the operations used here on -3/2 should return from my point of view -3/2. That's just surprising for me. Other CAS returns in fact -3/2 and that's correct.

I find it's a pity for FriCAS.

Greg

PS / I am trying to rebuild SAGE to check their results also. I used to build SAGE easily but from time to time I am unable to build it.

Waldek Hebisch

unread,
May 16, 2025, 8:28:34 AMMay 16
to fricas...@googlegroups.com
On Fri, May 16, 2025 at 01:40:55PM +0200, Grégory Vanuxem wrote:
> Hello Waldek, *
>
> Le jeu. 15 mai 2025 à 22:53, Waldek Hebisch <de...@fricas.org> a écrit :
>
> > On Thu, May 15, 2025 at 07:40:39PM +0200, Grégory Vanuxem wrote:
>
> >
> >
> > If you wander why FriCAS leaves asin(sin(x)) unsimplified, this
> > is due to branches, sin(x) = sin(x + 2*%pi), applaying asin
> > to both sides and using unsound transformation of asin(sin(x))
> > to x would give false equality x = x + 2*%pi. Similarly,
> > pulling %i before square roots leads to nonsense like the last
> > result in the following mail.
> >
>
> The second mail use behind the scene Mathematica (jWSExpression)
>
> I can agree that, in general, branches can interfere but in this case,
> applying the operations used here on -3/2 should return from my point of
> view -3/2. That's just surprising for me. Other CAS returns in fact -3/2
> and that's correct.

Yes, in this case it is what you want. Transformation 'asin(sin(x))'
to 'x' was in NAG Axiom, it was blocked later because it may lead to
wrong results.

> I find it's a pity for FriCAS.

--
Waldek Hebisch

Grégory Vanuxem

unread,
May 16, 2025, 10:17:03 AMMay 16
to fricas...@googlegroups.com
I guessed that. BTW thanks for your response. 

Greg 
Reply all
Reply to author
Forward
0 new messages