Dear Wakdek,
your recent contribution of rsimp is not totally satisfactory to me,
since it applies only to expressions that start with an 'nthRoot
operator. It's a good service function, but I wanted something that also
applies to combinations of such expression. So I wrote the following
function to apply rsimp recursively.
ZZ ==> Integer
EXZ ==> Expression ZZ
recursiveRootSimplification(x: EXZ): EXZ ==
liu: Union(List EXZ, "failed") := isTimes x
liu case List EXZ =>
reduce(_*, [recursiveRootSimplification(z) for z in liu], 1)
liu := isPlus x
liu case List EXZ =>
reduce(_+, [recursiveRootSimplification(z) for z in liu], 0)
is?(x, 'nthRoot) =>
r: Kernel EXZ := retract(x)@Kernel(EXZ)
a: List EXZ := argument retract x
ra: EXZ := recursiveRootSimplification(a.1)
ex := if #a < 2 then sqrt(ra) else ra^(1/a.2)
u: Union(EXZ, "failed") := rsimp(ex)$RootSimplification
u case "failed" => ex
u :: EXZ
x
Do you think that it makes sense to include that somewhere (where?) in
FriCAS?
I do not care much about the name except that it should have no
abbreviation.
The specification of rsimp does not say much about validity of the
transformation, i.e. whether x and rsimp(x) are actually the same root
(over complex numbers). Or do we have a statement in FriCAS about which
of the n possible values of an nthRoot expression, the nthRoot
expression actually represents.
With recursive application that could lead to a completely different
root value. Maybe that must be either said in the documentation or some
numerical code must be added to ensure that not suddenly a different
branch is chosen.
Ralf
--
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 on the web visit
https://groups.google.com/d/msgid/fricas-devel/d41d69f2-1d66-428c-9e34-230a316346d7%40hemmecke.org.