Powers simplification with mathematical correctness
|
01-28-2019, 05:47 PM
Post: #1
|
|||
|
|||
Powers simplification with mathematical correctness
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. |
|||
01-29-2019, 07:57 PM
Post: #2
|
|||
|
|||
RE: Powers simplification with mathematical correctness | |||
01-29-2019, 10:12 PM
Post: #3
|
|||
|
|||
RE: Powers simplification with mathematical correctness
Much depends on whether your numbers are integers or floating point. With integers, most simplifications work with maybe one or two branch points. With floating point (AKA reals) there are infinitely many branches.
|
|||
01-29-2019, 11:12 PM
Post: #4
|
|||
|
|||
RE: Powers simplification with mathematical correctness
(01-29-2019 07:57 PM)Hlib Wrote:In your example the expression is not being simplified, √(x^2) is left like that and passed to the solve function, so I guess your answer is don't simplify it? It's a valid option, and the one that will take me the least effort. (01-29-2019 10:12 PM)ttw Wrote: Much depends on whether your numbers are integers or floating point. With integers, most simplifications work with maybe one or two branch points. With floating point (AKA reals) there are infinitely many branches. I wouldn't try to simplify an expression with X^2.37 for example, it is best if it stays that way. I just tried it in Wolfram Alpha, and it's a bit confusing but consistent I guess: (X^2)^(1/2) is NOT simplified, it offers ABS(X) as an alternate form but it actually keeps it as √(x^2) (so as to not lose the other roots). However, (X^(1/2))^2 is simplified to X I'll have to do the same, wouldn't be consistent otherwise with ->NUM. |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 3 Guest(s)