01-28-2019, 05:47 PM

Here's a question that's pure math, but came up while developing rules to simplify expressions for newRPL:

Let's start with a simple case: √(x^2)

We can use rational exponents which is easy for the CAS to simplify:

√(x^2) = (x^2)^(1/2) = x^(2/2) = x^1 = x

Usually, we simplify √(x^2) as ABS(x) because we only consider the positive result of the square root. The simplification above would appear to be incorrect.

It seems to be customary (is it? any references proving this?) to consider x^(a/b) to be (x^a)^(1/b), and then take just one of the 'b' roots.

However, commutative multiplication suggests I could also consider x^(a/b) = (x^(1/b))^a, which I would prefer as a solution, because when b==a (or a multiple of a) it correctly collapses 'b' roots into a single result and the simplification above is correct. The other way around you end up with 'b' possible roots, and the decision of which branch to follow can change the results.

But doing that means the CAS would say that:

√(x^2) = (√x)^2 = x^(2/2) = x

For the above to be true, we should (arbitrarily?) choose the negative root of √(x^2) when x<0.

It seems out of this world that we should accept:

√(2^2) = √4 = 2

√((-2)^2) = √4 = -2

Whats the proper way this should be done?

Also, as a side thought, let's make sure any solution also applies when x is complex.

Let's start with a simple case: √(x^2)

We can use rational exponents which is easy for the CAS to simplify:

√(x^2) = (x^2)^(1/2) = x^(2/2) = x^1 = x

Usually, we simplify √(x^2) as ABS(x) because we only consider the positive result of the square root. The simplification above would appear to be incorrect.

It seems to be customary (is it? any references proving this?) to consider x^(a/b) to be (x^a)^(1/b), and then take just one of the 'b' roots.

However, commutative multiplication suggests I could also consider x^(a/b) = (x^(1/b))^a, which I would prefer as a solution, because when b==a (or a multiple of a) it correctly collapses 'b' roots into a single result and the simplification above is correct. The other way around you end up with 'b' possible roots, and the decision of which branch to follow can change the results.

But doing that means the CAS would say that:

√(x^2) = (√x)^2 = x^(2/2) = x

For the above to be true, we should (arbitrarily?) choose the negative root of √(x^2) when x<0.

It seems out of this world that we should accept:

√(2^2) = √4 = 2

√((-2)^2) = √4 = -2

Whats the proper way this should be done?

Also, as a side thought, let's make sure any solution also applies when x is complex.