More on radcan()

Richard Fateman <[email protected]>
Newsgroups gmane.comp.mathematics.maxima.general
Message-ID <CADB8Zm7DWr-7qWjX94akaG45q7j0T68YhtXU3q7D3PUdWWcqMQ@mail.gmail.com>
Here's a paper Simplification of Radical Expressions, unfortunately rather
dense..
https://dl.acm.org/doi/pdf/10.1145/800205.806352

by Caviness and Fateman.  A quote from it..

Roughly speaking the answers are that sqrt(x) can stand for either of the
single-valued branches of the "square root function without affecting the
way the arithmetic and simplifica- tion is carried out. The ambiguity in
the symbol /sqrt(x^2) is inherent and an arbitrary choice must be made to
resolve it. The choice of Ixl for this symbol would lead to certain
difficulties that we do not consider herein. In section 3 one precise way
is given that changes ~sqrt(x ^2 )into x. With suitable modifications the
same ideas could be used to change it into -x. Basically what is done in
section 3 is to give a set of rules that transform ambiguous expressions
into non- ambiguous ones. The rules given there are not the only ones that
can be given but the important point is that the ambiguities must be
resolved and the rules for resolving them should be clearly stated.
...............
Probably relevant here is to note that radcan does some manipulation of
radicals, but also logs, exponentials.  The nub of this 'bug'
 is polynomial radicals.  In this case, square root of polynomials in 1
variable.  Which already provides an opportunity for
ambiguity.
One purpose here was to make constructive the operations needed to
implement the Risch integration 'algorithm'.
(To be nit-picky, Risch requires solving some sub-tasks that are not always
computable, so 'algorithm' in quotes.)

I think this paper, and my thesis, chapter 4 (also rather dense).  defines,
for computational purposes,  given polynomials a(x) and b(x):
(a(x)/b(x)) ^ (p/q)     as  a(x)^(p/q)   / b(x)^(p/q).

reducing radicals of rational functions [i.e. ratio of polynomials]     to
 radicals of polynomials.

Ultimately, the problem is that there are insufficient mechanisms in Maxima
(or competitive systems) for
dealing with 'multi-valued' objects.  sqrt(x^2) is not x, abs(x),  or -x.
It might be   z = root_of(x=y^2, y).
But then one must extend the whole system to work on, say,   if z>0 then
.... ,  or exp(z^3), ....
Even simple 'solutions'   like enumerated sets  {x,-x} would require much
more complication.
Ambitious graduate students are invited to investigate.

RJF


On Fri, Aug 21, 2026 at 8:21 AM Richard Fateman <[email protected]> wrote:

>
>
> ---------- Forwarded message ---------
> From: Richard Fateman <[email protected]>
> Date: Fri, Aug 21, 2026, 6:58 AM
> Subject: Re: [maxima:bugs] #5156 radcan() rewrites sqrt(1/z) as 1/sqrt(z),
> which has the opposite sign for negative z
> To: Stavros Macrakis <[email protected]>
>
>
> Yes, radcan()  chooses a ' positive real interpretation'   (PRI) of
> radicands. This ignores 'declarations' or 'domains', which did not exist
> when radcan was written.
>
> Maybe Claude should consult Gemini, which observes:
>
>
> ".... Key Caveats and Behaviors
>
>    - Branch Choices: For multi-valued functions like square roots
>    (\(\sqrt{u}\)) or inverse trig functions, radcan picks a single
>    consistent branch/sign and sticks with it rather than tracking all Riemann
>    surfaces or returning absolute value terms like \(\text{abs}(x)\). [1
>    <https://ask.sagemath.org/question/8324/simplification-errors-in-simple-expressions/>,
>    2 <https://sourceforge.net/p/maxima/bugs/2123/?limit=25>]
>    - Ignores Assumptions: It generally treats variables inside radicals
>    uniformly as they scale up or change bounds, which can occasionally lead to
>    transformations that are only true for positive real domains. [1
>    <https://groups.google.com/g/sage-devel/c/rDBcSR5YpSI>]
>    - ...."
>    -
>
> The details are described in my thesis
> https://people.eecs.berkeley.edu/~fateman/papers/tr-95.pdf
> but is not reflected in the online Maxima manual.  That text includes gobs
> of info on bits and twiddles that were added to
> the general simplifier, but basically fails to describe edge cases of
> radcan, which is not part of that.  Obviously radcan has to deal
> with multiple values of radicals, and it does so in a particular way which
> may not be the same as you have
> in mind, as in this example.  I'm looking around for a blurb not stuck in
> PDF, and maybe it is in the old Macsyma manual.
> Or some paper.  The key is to identify a branch cut by this RPI
> heuristic.  The manual should include this, since it should
> take only a sentence or two.
>
> RJF
>
>
> On Fri, Aug 21, 2026 at 5:18 AM Stavros Macrakis <[email protected]>
> wrote:
>
>> I believe this is the way *radcan* is supposed to work. Fateman, can you
>> look at it?
>>
>> ---------- Forwarded message ---------
>> From: David Scherfgen <[email protected]>
>> Date: Fri, Aug 21, 2026 at 3:56 AM
>> Subject: [maxima:bugs] #5156 radcan() rewrites sqrt(1/z) as 1/sqrt(z),
>> which has the opposite sign for negative z
>> To: Ticket #5156: radcan() rewrites sqrt(1/z) as 1/sqrt(z), which has the
>> opposite sign for negative z <[email protected]>
>>
>>
>> ------------------------------
>>
>> *[bugs:#5156] <https://sourceforge.net/p/maxima/bugs/5156/> radcan()
>> rewrites sqrt(1/z) as 1/sqrt(z), which has the opposite sign for negative z*
>>
>> *Status:* open
>> *Group:*
>> *Labels:* radcan simplification complex
>> *Created:* Fri Aug 21, 2026 07:56 AM UTC by David Scherfgen
>> *Last Updated:* Fri Aug 21, 2026 07:56 AM UTC
>> *Owner:* nobody
>>
>> (%i1) display2d:false$(%i2) domain:complex$(%i3) radcan(sqrt(1/z));(%o3) 1/sqrt(z)(%i4) [subst(z = -4,sqrt(1/z)),subst(z = -4,1/sqrt(z))];(%o4) [%i/2,-(%i/2)]
>>
>> sqrt(1/z) and 1/sqrt(z) are different functions on the principal branch:
>> they agree for positive z and differ by a sign wherever z is negative,
>> as (%o4) shows at z = -4. radcan() is a simplifier and must preserve the
>> value, so it should leave sqrt(1/z) alone for a symbol of unknown sign.
>> The same rewrite applies to any exponent, e.g. radcan((1/z)^(1/3)) gives
>> 1/z^(1/3).
>>
>> Detected by Claude.
>> ------------------------------
>>
>> Sent from sourceforge.net because you indicated interest in
>> https://sourceforge.net/p/maxima/bugs/5156/
>>
>> To unsubscribe from further messages, please visit
>> https://sourceforge.net/auth/subscriptions/
>>
>

_______________________________________________
Maxima-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/maxima-discuss
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.