radcan and assume (was Re: maxima bug)



On 3/14/12 8:37 AM, Robert Dodier wrote:
> On 3/9/12, Raymond Toy<toy.raymond at gmail.com>  wrote:
>
>>> reset();kill(all);
>>> assume(z>r);
>>> radcan(sqrt(r^2-2*z*r+z^2));
>>>
>>> it gives
>>>
>>> z-r
>>>
>>> works fine
>>>
>>> but with capital R
>>>
>>> reset();kill(all);
>>> assume(z>R);
>>> radcan(sqrt(R^2-2*z*R+z^2));
>>>
>>> it gives
>>>
>>> R-z
>>>
>>> should be
>>> z-R
>> I don't think this is a bug.  Radcan does sometimes do things like this and
>> that is the expected result.  I don't think radcan recognizes assume either.
> radcan ignores assume -- I think that's a bug. That the result depends on
> the ordering of the variables is OK only if all possible results are
> equally valid.
> That's not the case when there are facts (stated by assume) to take into
> account.

radcan was written before assume.  Radcan produces a particular 
well-defined answer, and
yes it depends on the ordering of variable names.

If you want to write a different program to do something else, then I 
suggest you
(a) define what that program will do
(b) implement a working version of assume() and friends so that it too 
can be well
defined
(c) implement your new version of simplification of radicals with 
respect to assumptions.
While you are at it, use denesting and perhaps rootof() features.

By the way, this may require re-writing a substantial part of Maxima, 
because you have
to deal with multi-valued objects.
For example, assume(x>0) does not make sqrt(x^2) equal to x. nor does 
assume(x<=0) make
sqrt(x^2) = -x.


sqrt(3^2) = sqrt(9) =  {-3,+3}
sqrt((-3)^2)=sqrt(9) = {-3,3}
>
> It's true that many functions in Maxima ignore assume. I don't think
> that's desirable, although I do understand that it's hard to fix.
Unless assume works a lot better than it works now, it is hard to get
excited about making other things depend on it.  In general, assume and
deductions from it can be used to express undecidable predicates, but
assume() falls far short, even in the places that are decidable.

RJF