Problems with the sqrt function



Am Donnerstag, den 14.01.2010, 09:48 -0700 schrieb Robert Dodier:
> On Sat, Jan 9, 2010 at 10:01 AM, Dieter Kaiser <drdieterkaiser at web.de> wrote:
> 
> > I have already reported some work to overcome some of the problems.
> > Perhaps it is of interest to go on and to start to correct the problems
> > step by step. Perhaps it of interest to add the file rtest_sqrt.mac to
> > the testsuite too.
> 
> Yes, let's go ahead and try to fix these problems.
> It's very important to correct the basic stuff since
> otherwise more complicated operations might be incorrect,
> as you're well aware, I'm sure.
> I think committing rtest_sqrt is a good start.
> 
> Thanks very much for your work on this topic & many others.

Hello Robert,

thank you for the feed back.

I have already the code which helps to solve the three most important
problems with the sqrt function.

We have four issues with the testsuite I am working on. Most are not
serious:

1. 

A lot of integrals in rtest_integrate.mac simplifies differently. Mostly
because sqrt(-z^2) will no longer simplify to  %i sqrt(z^2). I am
reworking the examples.

2. 

Some integrals in rtestint.mac fails. This is because sqrt(1/x) is no
longer 1/sqrt(x). To get these integrals to work again we can switch on
the flag radexpand:all.

3.

Some results of rtest_odelin.mac in the share_testsuite simplifies
differently. I think the new results are simplified much better.

4.

The most serious problem is, that radcan hangs for expressions like
sqrt(1/(1+z)). This expression no longer simplifies to 1/sqrt(1+z), but
the code of radcan seems to depend on this simplification. I have looked
at the algorithm of radcan in more detail and I think I have found the
code which causes the problem.

A simple solution is to set radexpand:all in radcan. This does not
change anything, because it is the way radcan simplifies the power
function already.

Examples with the code we have. Maxima does not automatically simplify
the product:

(%i2) sqrt(a*b);
(%o2) sqrt(a*b)

With radexpand:all the arguments a and b are assumend to be positive:

(%i3) sqrt(a*b),radexpand:all;
(%o3) sqrt(a)*sqrt(b)

This is what radcan does too:

(%i4) radcan(sqrt(a*b));
(%o4) sqrt(a)*sqrt(b)

Again for the sqrt of a power:

(%i5) sqrt(a^b);
(%o5) sqrt(a^b)

We get the expansion with radexpand:all:

(%i7) sqrt(a^b),radexpand:all;
(%o7) a^(b/2)

Again radcan does it immediately:

(%i8) radcan(sqrt(a^b));
(%o8) a^(b/2)

I will report more of this work and show more examples.

Dieter Kaiser