box and unbox

8 views
Skip to first unread message

Ralf Hemmecke

unread,
Dec 20, 2024, 5:12:39 AM12/20/24
to fricas-devel
Obviously, the output of (3) is not really what one would expect.

Second question. Having an expression like x, how can I turn it into
something like y, i.e. how can I unbox such an expression?

%%% (1) -> x := 1/box(sqrt(2)); y := sqrt(2)/2;
Type: AlgebraicNumber
%%% (2) -> (x=y)@Boolean

(2) false
Type: Boolean
%%% (3) -> trueEqual(x,y)

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

Ralf

Kurt Pagani

unread,
Dec 20, 2024, 6:32:57 AM12/20/24
to fricas-devel
distribute ?




--
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/b3347a2e-e6f9-4746-b92c-e7f18c88dcdc%40hemmecke.org.

Kurt Pagani

unread,
Dec 20, 2024, 7:06:22 AM12/20/24
to FriCAS - computer algebra system
Indeed, in my version: 
 
trueEqual(distribute x,y)

   (3)  true
                                                                Type: Boolean



(5) -> (distribute x = y)

                 +-+
           1    \|2
   (5)  ---- = ----
          +-+     2
         \|2
                                              Type: Equation(AlgebraicNumber)
(6) -> test(distribute x = y)

   (6)  true
                                                                Type: Boolean

Ralf Hemmecke

unread,
Dec 20, 2024, 7:41:24 AM12/20/24
to fricas...@googlegroups.com
Cool. That is a name that would never come to my mind. Thank you.

But no.

%%% (38) -> distribute(x)

1
(38) ----
+-+
\|2
Type: AlgebraicNumber
> (5) -> (distribute x = y)
>
> +-+
> 1 \|2
> (5) ---- = ----
> +-+ 2
> \|2
> Type: Equation(AlgebraicNumber)

Ha... that is funny. The reason I added box in the first place was to
get the sqrt(2) in the denominator without it being moved to the
numerator in further compuations Apparrently, I can perhaps do without
box. Must investigate.

%%% (46) -> [distribute x, x]::InputForm

(46)
(construct (:: (/ 1 (^ 2 (/ 1 2))) (AlgebraicNumber))
(:: (/ 1 (%box (^ 2 (/ 1 2)))) (AlgebraicNumber)))

As can be seen, the %box is gone as you said initially.

The question is how would I construct such an expression without
AlgebraicNumber moving the sqrt to the numerator?

It seem I can unbox and "normalize" in that way:

%%% (64) -> inv inv distribute x

+-+
\|2
(64) ----
2

Ralf

Reply all
Reply to author
Forward
0 new messages