Hi!
I'm having difficulties solving a certain problem in Mathematica.
The task is the find the smallest positive integer "n" for which Z^n is a real number where Z = cos(pi/3) + i*sin(pi/3)
The problem I have is I don't even know where to begin. I've done quite a bit of Mathematica problems before, but this is completely new to me.
Thanks!
Rohits approach is really cool. But there is a more "analytical" way:
a = Cos[Pi/3] + I*Sin[Pi/3] b = Exp[I*Pi/3] a - b // FullSimplify b^n // FullSimplify
Here you can see that n= 3 is a solution, and for sure the smallest one.
Hi Adam,
There is probably a much better way to do this
z = Cos[Pi/3] + I*Sin[Pi/3] FindInstance[z^n \[Element] Reals && n > 0 && n \[Element] Integers, n, 2] (* {{n -> 135}, {n -> 531}} *)
Those are not guaranteed to be the smallest though. So
FindInstance[z^n \[Element] Reals && n > 0 && n \[Element] Integers && n < 135, n, 2] (* {{n -> 108}, {n -> 24}} *) FindInstance[z^n \[Element] Reals && n > 0 && n \[Element] Integers && n < 24, n, 2] (* {{n -> 18}, {n -> 3}} *)
The answer is 3
I like the following result.
a = Cos[Pi/3] + I*Sin[Pi/3]; a^Range[3, 99, 3] // FullSimplify (* {-1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1}*)
Thanks for the help! That's quite a bit of unfamiliar code for me, but I think I get it.