Hi Greg, I think you’ve got it pretty much figured out :).
Instead of using the trig functions, you could do
z’ = (x + yi) * i^(φ/90)
but it would require a math library that can handle complex numbers, including taking them to exponents. Google calculator can do this, so if you plug in i^(45/90) you get:
which is the x, y coordinate of a 45-degree angle on the unit circle. You could also pass it something like (3 + 4i) * i^(45/90) if you’d like to rotate an existing shape.
The tricky thing is finding (or making) a library to do complex arithmetic! =)
Thank you very much Kalid. I didn’t know google calculater handles komplex numbers. Very good to know really
I’ll look further into finding an algebraic solution or working with a library and do some performance tests to see how CPU and memory heav different solutions are.
If I’ll ever come up with an elegant solution, I’ll surely post it here
Great insight, phenomenal explanation. Complex number multiplication is very important and it has many applications in complex analysis, engineering, trigonometry.
I have a complex number 1 + 1i. I want to calculate its absolute value (length) by |x|=sqrt(xx). If I do it the “vector way”: multiplying the coordinates of the same type and summing up the result (vector dot product) and then take the square root of the resulting scalar then it works. sqrt(11 + 11) = sqrt(2)
If I do it the “algebraic way” then somehow it does not match.
sqrt( (1+i1)(1+i1)) = sqrt( (11 +1i1 + i11 + i1i1) = sqrt( (1 + 2i -1) = sqrt(2i) = sqrt(2)*sqrt(i)
What do I wrong?
Just another thought to the previous post: Is there a separate algebraic product (that is just a flipping for 1 dimension, but a rotation in higher ones) and a dot product. Are these two multiplication happen to be the same for scalars, but for higher dimensions (complex numbers) they give different results?
Could this difference be something like the difference between dot product and the cross product for a vector?
When I consider again the problem, I guess the calculation for the “algebraic way” makes sense too: I have sqrt(2) long vector rotated by 45°. When I square it then angles sum up and length squares, so they are at 2i, this is ok. When I take the square root then I do the inverse, so I find the vector that has half the angle and length is square rooted. 1+1i = sqrt(2)*sqrt(i)
I give the real numbers also a kind of unit coordinate and
Mixed terms products give 0 as these base vectors are orthogonal
then the math works out:
sqrt( (r1+i1)(r1+i1))
= sqrt( (r1r1 +r1i1 + i1r1 + i1i1)
= sqrt( (1rr + 2(r1i1) -1ii)
Now mixed terms become 0 as the r*i 0 as these two vectors are othogonal
= sqrt(1 + 0 +1) = sqrt(2)
BTW, you misspelled Polya as “Poyla”.
George Polya is a well-known mathematician and I really like this quote:
"When you have satisfied yourself that the theorem is true, you start proving it.”