Why a negative number to the power of 2 equals negative?

Ah, you are right. I went in the wrong direction:

image

I’m not sure if the image formatted correctly since I’m on mobile, but the bottom expression is undefined (due to order of operations) despite both being algebraically equivalent to (-5)^(12/10). Interesting to note how google defaults to a complex solution if you search up (-5)^1.2, but gives you a real solution if you do ((-5)^12)^(1/10), so it must be some internal floating point stuff.

image

Lua(u) does not support imaginary numbers.

Coincidentally enough, one of PIL’s examples is a primitive implementation for complex numbers.
https://www.lua.org/pil/15.1.html

A square root is an even root, and you can’t find the square root of -1 using real numbers since 1^2 is 1 and (-1)^2 is also 1. However, your solution to (-5)^1.2 depends on how you approach the problem, since there is both a real and complex solution.

1 Like