Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Reduction problem

  1. Oct 17, 2015 #1
    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?
     
  2. jcsd
  3. Oct 17, 2015 #2

    Mark44

    Staff: Mentor

    How so? What does your code do or not do?
     
  4. Oct 17, 2015 #3
    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.
     
  5. Oct 17, 2015 #4

    Mark44

    Staff: Mentor

    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.
     
  6. Oct 29, 2015 #5
    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 (J):
     
       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 .
     
  7. Oct 30, 2015 #6

    Mark44

    Staff: Mentor

    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.
     
  8. Oct 30, 2015 #7
    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.
     
  9. Oct 30, 2015 #8

    Mark44

    Staff: Mentor

    ##\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.

    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.
    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.
     
  10. Oct 30, 2015 #9
    I see - your workaround should be fine as long as you only care about the principal root.
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook




Similar Discussions: Reduction problem
  1. Javascript problem (Replies: 6)

  2. Problem with dgesv (Replies: 5)

  3. Function problem (Replies: 8)

  4. Problem with Excel (Replies: 4)

Loading...