On Wednesday, September 4, 2024 at 3:05:19 AM UTC+9 dim...@gmail.com wrote:
On Tue, Sep 3, 2024 at 5:08 PM Kwankyu Lee <ekwa...@gmail.com> wrote: > > > That in Python one has non-real value for (-1)**(1/3) is > two things: 1/3 is actually a float, and absence of typing. > These are artifacts of the programming language, and make little sense > mathematically. > > > Do you mean that the value of (-1)**(1/3) is arbitrarily chosen, regardless of the mathematical value of (-1)^(1/3)? no, I mean that 1) 1/3 gets converted to a float, and then you cannot escape dealing with (-1)**(0.333333...3), which is not equal to ((-1)**(0.333333...3))**3, unlike exact (-1)**(1/3). >>> a=(-1)**(1/3); a (0.5000000000000001+0.8660254037844386j) >>> a**3 (-1+3.885780586188048e-16j) 2) Python used to be untyped, and still is, to an extent, so returning a complex number instead of real wasn't such a big deal. I agree that python language could not define (-1)**(1/3) as the real cube root of -1. Hence it chose (-1)**(1/3) to return the complex principal root of -1, yes by computing exp(log(x)*y) with branch cut negative axis, *which makes a perfect mathematical sense.* Now back in sage, sage chose to be compatible with python's behavior in x^(1/3) for whatever x that represents a number in the complex field, say x = -1, RR(-1), CC(-1), QQbar(-1). For x = ZZ(-1), QQ(-1), they chose to return symbolic expression (-1)^(1/3), which again converted to the same value with QQbar(-1)^(1/3). For x = RBF(-1), it chose to raise an error. For x = RDF(-1), it chose to return "nan". All these suggest to sage users that x^(1/3) means the principal cube root of the number x. Now AA(-1)^(1/3) returns -1. So AA made a different choice. There is no mathematical definition that applies to AA(-1)^(1/n). Is it n-th root in AA? Then look AA(-1)^(1/4) = 0.7071067811865475? + 0.7071067811865475?*I . Is it the principal root? Then look AA(-1)^(1/3) = -1. It is AA that is an artifact of mathematical programming language. I think that only valid argument for AA(-1)^(1/3) = -1 is that it is the status quo. It is just human that likes what she/he used to. Removing inconsistency is for the future. Kwankyu -- You received this message because you are subscribed to the Google Groups "sage-devel" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/sage-devel/1b8b2b07-033b-424e-a2da-375520cf31b8n%40googlegroups.com.