Solve Reduction Problem for (1+x)^1/3 in Mathcad

  • Thread starter Thread starter PoFon
  • Start date Start date
  • Tags Tags
    Reduction
AI Thread Summary
The discussion revolves around a function, (1+x)^(1/3), that fails to compute correctly for negative numbers in MathCAD. The original poster notes that while the function works for positive inputs, it does not return real numbers for negative inputs, leading to complex results. Participants explain that raising negative numbers to fractional powers typically results in complex numbers, but emphasize that the cube root of a negative number should yield a real number. They suggest that MathCAD may be using logarithmic methods that require positive inputs, and propose a workaround: implementing logic to handle negative inputs by adjusting the calculation. The conversation highlights the distinction between principal roots and the general behavior of odd roots, asserting that odd roots like cube roots should return real values for all real inputs, despite MathCAD's limitations.
PoFon
Messages
2
Reaction score
0
I have a function : (1+x)^1/3 and I need to do reduction in mathcad.

I wrote this :
15s7ntz.png


But the problem is that : it does not work with negative numbers.
How to fix it?
 
Technology news on Phys.org
PoFon said:
does not work with negative numbers.
How so? What does your code do or not do?
 
Mark44 said:
How so? What does your code do or not do?

This code does reduction with positive numbers ( function (x+1)^1/3), but doesn't work with negative. And i don't know how to fix it.
 
PoFon said:
This code does reduction with positive numbers ( function (x+1)^1/3), but doesn't work with negative. And i don't know how to fix it.
Does the problem occur when your code attempts to raise a negative number to the 1/3 power? If so, algebraically there shouldn't be a problem, but MathCad is probably using logs to compute powers, in which case the expression x + 1 needs to be positive. One workaround would be to have logic that determines the sign of x + 1. If x + 1 turns out to be negative, compute (-x - 1) to the 1/3 power. That should give you a positive number, which you'll need to multiply by -1.
 
Except that raising a negative number to a fractional power generally results in a complex number. For instance, here are the results we get raising 2 and -2 to the 1/3 power (in J since I don't have MathCAD):
Code:
   2 _2 ^ %3
1.25992 0.629961j1.09112
As you can see, the result of the negative number raised to the reciprocal of 3 power is a complex number with real part 0.629961 and imaginary part 1.09112. In MathCAD, this would be represented as 0.629961 + 1.09112i .
 
DavidHume said:
Except that raising a negative number to a fractional power generally results in a complex number. For instance, here are the results we get raising 2 and -2 to the 1/3 power (in J since I don't have MathCAD):
Code:
   2 _2 ^ %3
1.25992 0.629961j1.09112
As you can see, the result of the negative number raised to the reciprocal of 3 power is a complex number with real part 0.629961 and imaginary part 1.09112. In MathCAD, this would be represented as 0.629961 + 1.09112i .
I understand what you're saying, but the problem is that the result should be a real number, not a complex number. The function ##f(x) = \sqrt[3]{x} = x^{1/3}## is defined for all real numbers, and the range is all real numbers, so taking the cube root of -2 (or raising -2 to the 1/3 power) should result in a negative real number. In my previous post I explained why many computer systems produce results that are mathematically incorrect.
 
It's not true that the range of cube root is real numbers - it's not even true for the cube root of one. Take a look at this MathCAD paper - http://gekor-it.de/media/81174be56cf4ccc5ffff870fac144233.pdf - where the author shows the cube roots of one to be (1, (-1/2)+(√3 i)/2, (-1/2)-(√3 i)/2). You can see the same result in the Wikipedia article on the root of unity: https://en.wikipedia.org/wiki/Root_of_unity .

The point for the original poster is that MathCAD can handle complex numbers but I don't know how well it does this or what it does in the context of a reduction.
 
DavidHume said:
It's not true that the range of cube root is real numbers - it's not even true for the cube root of one.
##\sqrt[3]{-1} = -1## and ##\sqrt[3]{-8} = -2##, which you can verify by raising -1 and -2 to the third power, respectively.
All of the odd roots (cube root, fifth root, seventh root, etc.) have real values for any real numbers.

DavidHume said:
Take a look at this MathCAD paper - http://gekor-it.de/media/81174be56cf4ccc5ffff870fac144233.pdf - where the author shows the cube roots of one to be (1, (-1/2)+(√3 i)/2, (-1/2)-(√3 i)/2).
Sure, there are n values for the nth root of any real number, but the principal cube root (or fifth root or seventh root, etc.) of any real number is a real number. The principal cube root of 1 is 1, just as the principal square root of 4 (denoted ##\sqrt{4}##) is 2, even though -2 is also a square root of 4. All of the odd roots have one real number principal root, so if you take the cube root of -2, you should get a real number back.
DavidHume said:
You can see the same result in the Wikipedia article on the root of unity: https://en.wikipedia.org/wiki/Root_of_unity .

The point for the original poster is that MathCAD can handle complex numbers but I don't know how well it does this or what it does in the context of a reduction.
My point is that MathCAD (or whatever) is able to find the square root of a positive number, but should also be able to take an odd root of a negative number, producing a negative real number. Due to the algorithm used, it isn't able to do so, and I gave a workaround for this inability.
 
I see - your workaround should be fine as long as you only care about the principal root.
 
Back
Top