On Tue, Jan 14, 2025 at 02:19:46PM +0100, 'Ralf Hemmecke' via FriCAS - computer algebra system wrote: > Hi Waldek, > > I know that rsimp isn't perfect and that you will improve it in the future. > But somehow I find this result a bit weird given that 31^2=961. > > Ralf > > %%% (240) -> xx := sqrt(-155*sqrt(5)+543) > > +----------------+ > | +-+ > (240) \|- 155 \|5 + 543 > %%% (241) -> (rsimp(xx)$RootSimplification) > > +---+ > +-+ |961 > (31 \|5 - 25) |--- > \| 10 > (241) -------------------- > 31
The attached patch makes this simpler: when numerator or denominator is an exact power it pulls corresponding factor before root sign. -- Waldek Hebisch -- 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+unsubscr...@googlegroups.com. To view this discussion visit https://groups.google.com/d/msgid/fricas-devel/Z4bcfUCckf032oxp%40fricas.org.
diff --git a/src/algebra/rsimp.spad b/src/algebra/rsimp.spad index 8f2e867e..9ce27902 100644 --- a/src/algebra/rsimp.spad +++ b/src/algebra/rsimp.spad @@ -967,7 +967,13 @@ RootSimplification() : Exports == Implementation where "failed" my_root(s1 : eI, k : Integer, opr : BasicOperator) : eI == - numer(s1) = 1 => 1/kernel(opr, [1/s1, k::eI]) + n1 := numer(s1)::eI + n1 = 1 => 1/kernel(opr, [1/s1, k::eI]) + d1 := denom(s1)::eI + (nu1 := rsimp1(n1, k)) case eI => + nu1::eI/kernel(opr, [d1, k::eI]) + (du1 := rsimp1(d1, k)) case eI => + kernel(opr, [n1, k::eI])/du1::eI kernel(opr, [s1, k::eI]) eval_rl(rl : List(eI), kf : eI, k : Integer) : eI ==