Symbolic expressions: abs(x^(1/3)) =?= abs(x)^(1/3)

16 visualizaciones (últimos 30 días)
Thomas
Thomas el 17 de Abr. de 2013
I have Matlab 2011b and when i do this:
>> x = sym('x')
x =
x
>> abs(x^(1/3))
ans =
abs(x)^(1/3)
then Matlab swaps the abs() and the ^(1/3).
Someone please correct me, but I would assume that x^(1/3) has three solutions, one real and two complex ones. (like here: http://en.wikipedia.org/wiki/Cubic_root#Real_numbers)
So putting the abs() around the root should yield exaxtly the one real(non-complex) solution (with multiplicity 3 if you want), because the magnitude of all three real and complex solutions should be identical.
However, by swapping abs() and the root to abs(x)^(1/3) i still get three solutions (one real, two complex again).
So where is my error or is it a bug?
Btw, if x is a lengthy expression itself it is annoying that i cannot make matlab evaluate this in the real numbers by putting an abs() around the root...

Respuestas (2)

the cyclist
the cyclist el 18 de Abr. de 2013
I think you do have an error in thinking about this, but it is a subtle one.
First, and I think this is the important part, the expression
>> fx1 = abs(x).^(1/3);
and the expression
>> fx2 = abs(x.^(1/3));
are equal for all values of x. Agreed?
Note that there is nothing about root-finding of a function here. Those are just two expressions. x.^(1/3) does not have any "solutions". There is no equation there!
If you want to find roots before you do the absolute value, then do the root-finding on the equation first [x.^(1/3) - 1 == 0, or whatever], then do the absolute value.
Does that make sense?
  3 comentarios
bym
bym el 18 de Abr. de 2013
maybe you can start off by declaring your variables to be real e.g.
syms x y z real
Thomas
Thomas el 19 de Abr. de 2013
Thanks for the idea. I already did this, however it does not solve the problem, since result is still complex.

Iniciar sesión para comentar.


Ahmed A. Selman
Ahmed A. Selman el 19 de Abr. de 2013
Editada: Ahmed A. Selman el 19 de Abr. de 2013
Some times we get confused between mathematics and programming, it is an often thing. Yet, mathematics means logic, programs try to reason that logic with numbers to us. So in mathematics, there's no difference between:
abs(-2^(1/3)) = 1.2599
(abs(-2)) ^(1/3) = 1.2599
assuming that the function abs is meaningless for positive real arguments. Now, let's elaborate more:
y= (-2)^(1/3)
y= 0.6300 + 1.0911i
no matter how many times I tried that with Matlab it gives the same, i.e., no random numbers here. One more thing:
abs(y)= 1.2599
The same as above!
Would Matlab be having a problem if it said so? I don't think that.
However, if you tried, e.g.,
syms x z
y=abs(x^z)
y=
abs(x^z)
leaving mathematical possibilities for any values of z to be reasonably usable.
  1 comentario
Thomas
Thomas el 19 de Abr. de 2013
Take a look at:
  • (8)^(1/3) ----> 2 (good)
  • (-8)^(1/3) ----> 1.0000 + 1.7321i (would like -2 more as an answer...)
So i can use
  • nthroot(-8,3) ----> -2 (better now)
However, nthroot doesn't work for symbolic expressions. But as i have seen now, matlab 2013 offers a function "surd" that seems to do what i need - unfortunately i don't have M2013 yet...

Iniciar sesión para comentar.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by