numworks / epsilon

Modern graphing calculator operating system.
https://www.numworks.com/resources/engineering/software/
1.75k stars 463 forks source link

-8 in power of 1/3 should be undefined. #1080

Closed alexeyneu closed 4 years ago

alexeyneu commented 5 years ago

So you should change it to cubic root of -8 on screen .

Ecco commented 5 years ago

I'm not sure what you mean. (-8)^(1/3) gives -2. Is anything wrong with that?

alexeyneu commented 5 years ago

yeah coz a^x defined only for a>0 (i do not remember about a=0) for non-integer x

Ecco commented 5 years ago

I guess it all boils down to the definition you decide to use for a^x.

alexeyneu commented 5 years ago

a^x if written exactly like this is pseudocode for ax which is math function you cant redefine So if someone writes it yeah he mean cubic root but you cant repeat it as is adding =-2 After exec it prints exactly (-8)1/3 = -2
It's incorrect.
but is ok

which is to say , if we consider it right then we'll have say

alexeyneu commented 5 years ago

Безымянный
as it should be

ghost commented 5 years ago

Well if you look at this basic identity, then image

(-8)(1/3)=-3√-8=-2 So they should be equal

and google agrees image

Whatever calc you are using is the one with the problem I think

alexeyneu commented 5 years ago

that picture you'd posted is for kids
hp first sci calc released when google staff starts their lives at best. It's screencopy of hp prime
when i've started this issue i didnt test it there. It's from math lessons in our school

suazhero commented 5 years ago

@alexeyneu is right pointing out the righting is abusive, since a^x is indeed undefined when x is rational (and more globally other than integer) and a < 0. It's really a matter of definition. But does the numworks calculator have a nth root symbol at all?

alexeyneu commented 5 years ago

yeah it has. I've thinking it has just button but i see it hasn't got it. But you can use and then left arrow and type n there.

suazhero commented 5 years ago

Which version? Don't have that using version 11.2.

adriweb commented 5 years ago

Manually, not from the physical button: choose the root function in the toolbox. Then you can go to the left and enter a number.

suazhero commented 5 years ago

Oh wow thx

alexeyneu commented 5 years ago

i've pressed button in online simulator. Without toolbox or so. Безымянны3й

adriweb commented 5 years ago

Yes, the button is only a shortcut to square root template and not to the n-th root template.

alexeyneu commented 5 years ago

but i didnt have to select anything in toolbox(?).
button then left arrow

alexeyneu commented 5 years ago

haha Just have tested it .it doesn't work.

adriweb commented 5 years ago

It works as per what Romain said, that is.

Image

Note that I'm testing with the iOS app which isn't updated to the latest epsilon version yet, as I don't have the calc with me right now.

Anyway, it's up to the NumWorks team to decide what to do or not do now I guess.

alexeyneu commented 5 years ago

no i mean stuff with square root button. It allows you to type n but cant solve it

suazhero commented 5 years ago

Well it would be convenient for the hw button to return root(x,n) and allow to leave the exponent blank when actually wanting square root. Back to the initial topic, is the suggestion that the calculator returns ³✓-8 when the input is (-8)^(1/3) ?

alexeyneu commented 5 years ago

@suazhero yeah. And i've seen it done that sometimes . With other numbers

alexeyneu commented 5 years ago

fails to fit domain of any function known in real math.
There're two for this : an
,
and
ax
, plus some stuff around a=0 case

side notes:
i use latex.codecogs.com for math symbols here. So in real text there's things like this one :

![](https://latex.codecogs.com/gif.latex?x\in\mathbb{R})
ghost commented 5 years ago

(-8)^(1/3) is indeed not usually defined among real numbers, but I do not think it is a mistake doing it. Exponentiation can be extended to complex numbers, when (-8)^1/3 is meaningful. However this complex exponentiation is problematic (either not continuous or multivalued). The wikipedia article on exponentiation can be a good starting point to read about it ( https://en.wikipedia.org/wiki/Exponentiation ). @alexeyneu mentioned the HP prime. If you turn on complex calculations and try (-8)^1/3, you still get an error message. However, if you try (-8+0*i)^1/3 (which is the same number in the base) you do get an answer (which is not -2). The reason it is not -2 is that there are three complex numbers with the property that z^3=-8 (one of which is -2, the other is what the HP prime gives and there is a third one). All three can be meaningfully considered to be (-8)^1/3 (and in some cases all three together are called (-8)^1/3). The choice made by HP prime is somewhat arbitrary (although well-defined). If you turn on complex calculations in Numworks (in settings) and try (-8)^1/3, you will not get -2. You get the same answer as the one the HP prime gives. As I said, there are three numbers as a candidate for being (-8)^1/3. One real and two complex. In real mode the HP prime gives an error message, the Numworks gives the real value. In complex mode they both give the same complex number. I did not find anything about this in the user manual of either the HP prime or Numworks though.

nsajko commented 5 years ago

screenshot

Interestingly, another possible solution is chosen with a non-"Real" setting for the "Complex format" option in Settings.

I guess the "Real" "Complex format" setting searches for a real solution, while otherwise the "first" one is chosen?

ghost commented 5 years ago

I think in complex mode Numworks is using the algorithm described in the Wolfram Mathematica documentation of the power function.

x^y=e^(yLog(x)), where Log(x) is the complex logarithm function. So now the question is, what is Log(x)? For complex numbers, it is Log(|x|)+iArg(x) (where Log(|x|) is the usual real natural logarithm). Since the argument of x is not unique, Wolfram Mathematica (and based on this example, Numworks) chooses the principal argument between -pi and pi (not including -pi, including pi).

If I translate this general approach to the case of (-8)^1/3, we get the following: (-8)^1/3=e^(1/3Log(-8)) Log(-8)=Log(8)+iArg(-8) The principal argument of -8 is pi, so Log(-8)=Log(8)+ipi Using this, e^(1/3Log(-8))=e^(1/3(Log(8)+ipi))=e^(1/3Log(8)) e^(ipi/3) Since 1/3Log(8)=1/3Log(2^3)=Log(2), we get e^(1/3Log(8))=e^Log(2)=2 (note, that I am using Log for the natural logarithm) Hence (-8)^1/3=2e^(i*pi/3), as given by Numworks.

Interestingly, Numworks gives the exact value for (-8)^1/3 (as seen in the previous message), but it does not give the exact value of ln(-8) as ln(8)+i*pi. Maybe this can be changed in the future?

nsajko commented 5 years ago

@fbeleznay Maybe you should open another bug-report for displaying ln(-8) as ln(8) + i*pi?

alexeyneu commented 4 years ago

@fbeleznay you can try to define third f(x) there but you sould not consider that it is defined. You cant change meaning of ax just coz you want.

ghost commented 4 years ago

@alexeyneu I am not sure I understand your comment. The concept of multivalued complex exponential is an established mathematical concept to extend the definition of exponentiation to cases where the real function does not work (for example to negative base). It is not me who want to do this, it is done by others and accepted by the mathematics community. You can read a quite detailed version of this for example in http://scipp.ucsc.edu/~haber/ph116A/clog_11.pdf

alexeyneu commented 4 years ago

it's about

but I do not think it is a mistake doing it

Looks like we have hp vs ti clash here. Numworks just got caught up in the grinder. Безымянный

nsajko commented 4 years ago

@alexeyneu Dude. Why would you rather your calculator give you no answer than give you one? It is simply a matter of usefulness, undefined is not useful, while giving one answer, among n correct answers, is useful.

nsajko commented 4 years ago

Note that even purely on the reals, x^(1/2) is multivalued.

alexeyneu commented 4 years ago
  1. coz say you may have this question on exams

  2. x1/2 really is f(x)=x1/2 with its domain. And it's not multivalued

AlexPMLikesNumWorks commented 4 years ago

As a guy who studied mathematics and physics, (-8)^1/3 is definitely 2e^pi/3. Generally speaking, thinking in the complex plane usually makes more sense. If complex arithmetics are forbidden, then (-8)^1/3 must be rejected.

Note that the semantics of the n-th root are slightly different than the 1/n-th power, depending on your acceptance of complex numbers or not. For example, it is widely accepted that the 3rd-root of 1 is e^(2pi/3), generator of the multiplicative group of the 3-roots of the unit (also known as j), whereas 1^(1/3) would not be understood other than being 1.

alexeyneu commented 4 years ago

looks like nobody wanna talk in function/domain terms. Different math school idk.

suazhero commented 4 years ago

Well, doesn't look that simple.

The asumption is that a^x is only defined for a > 0 when x is non integer.

But you can find in this post that the definition can be extended to a < 0. https://math.stackexchange.com/questions/1628759/what-are-the-laws-of-rational-exponents

And your example is taken by someone who ends up with the following comment:

"Reading the paper by Tirosh and Even, I was surprised to learn this matter has drawn serious attention from math educators.

A long time ago, I assumed that, apart from complex extensions, a^x for non-integer x should be defined only for a>0. I reasoned that it made no sense to have a function (−2)^x defined only for rational numbers x with odd denominator. I objected strenuously to notations like (−8)^1/3.

But that was before I taught a calculus class, which is when I realized why some textbook authors are so happy to define a^x for a<0, following the second convention. The reason is that the formula d/dx(x^r)=rx^(r−1) is perfectly valid for x<0 and r with odd denominator."

alexeyneu commented 4 years ago

But thats not end . He wrote the rest in comments. Haha
i'm not sure what these guys ended up with.

artaxxx commented 4 years ago

Let's close this issue since we keep this definition in real mode.