Hello,

does somebody see my error? I don't understand why the function "nicer" does not work, but the individual commands on the input do. What I also find strange is that the error message for "nicer" changes in the end.

The commands of the following session are attached.

Thanks in advance.
Ralf


%%% (1) -> ZZ ==> Integer

Type: Void
%%% (2) -> EX ==> Expression

Type: Void
%%% (3) -> combineRadicals := rule sqrt(x)*sqrt(y) == sqrt(x*y)

           +-+ +-+       +---+
   (3)  %B\|x \|y  == %B\|x y
Type: RewriteRule(Integer,Integer,Expression(Integer)) %%% (4) -> nicer(x: EX ZZ): AlgebraicNumber == ( AM ==> AlgebraicManipulations(ZZ, EX ZZ); xx := combineRadicals(rootSplit(x)$AM); rs := rsimp((numer xx)::EX(ZZ))$RootSimplification; zz := rootSplit(rs)$AM / denom xx; combineRadicals(zz) :: AlgebraicNumber)
   Function declaration nicer : Expression(Integer) -> AlgebraicNumber
      has been added to workspace.

Type: Void
%%% (5) -> nicer x0

   >> System error:
   The variable $$$ is unbound.

%%% (5) -> x0 := sqrt((184726398605281*sqrt(-163)+14962838287027761)/20010)/17502080

         +--------------------------------------------+
         |                 +-----+
         |184726398605281 \|- 163  + 14962838287027761
         |--------------------------------------------
        \|                    20010
   (5)  -----------------------------------------------
                            17502080
Type: AlgebraicNumber
%%% (6) -> AM ==> AlgebraicManipulations(ZZ, EX ZZ)

Type: Void
%%% (7) -> xx := combineRadicals(rootSplit(x0)$AM)

         +--------------------------------------------+
         |                 +-----+
        \|184726398605281 \|- 163  + 14962838287027761
   (7)  -----------------------------------------------
                                 +-----+
                       17502080 \|20010
Type: Expression(Integer)
%%% (8) -> rs := rsimp((numer xx)::EX(ZZ))$RootSimplification;

Type: Union(Expression(Integer),...)
%%% (9) -> zz := rootSplit(rs)$AM / denom xx;

Type: Expression(Integer)
%%% (10) -> combineRadicals(zz) :: AlgebraicNumber

                    +-----+               +-------+
         (13591409 \|- 163  + 2215399667)\|1630815
   (10)  ------------------------------------------
                       57085309190400
Type: AlgebraicNumber
%%% (11) -> nicer x0

   >> System error:
   The function BOOT::|*1;nicer;1;initial| is undefined.

--
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/fricas-devel/ed9d75fc-8418-4d67-a364-a87f2cfe68de%40hemmecke.de.
ZZ ==> Integer
EX ==> Expression
combineRadicals := rule sqrt(x)*sqrt(y) == sqrt(x*y)

-- `nicer` transforms an expression of the form
-- $\frac{\sqrt{a+b\sqrt{c/d}}}{e}$ into something of the form
-- $\frac{u+v\sqrt{w}}{y}\sqrt{x}$ if possible.

nicer(x: EX ZZ): AlgebraicNumber == (_
  AM ==> AlgebraicManipulations(ZZ, EX ZZ);_
  xx := combineRadicals(rootSplit(x)$AM);_
  rs := rsimp((numer xx)::EX(ZZ))$RootSimplification;_
  zz := rootSplit(rs)$AM / denom xx;_
  combineRadicals(zz) :: AlgebraicNumber)

nicer x0
x0 := sqrt((184726398605281*sqrt(-163)+14962838287027761)/20010)/17502080
AM ==> AlgebraicManipulations(ZZ, EX ZZ)
xx := combineRadicals(rootSplit(x0)$AM)
rs := rsimp((numer xx)::EX(ZZ))$RootSimplification;
zz := rootSplit(rs)$AM / denom xx;
combineRadicals(zz) :: AlgebraicNumber
nicer x0

Reply via email to