Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I wrote the following code to observe how the solutions to the equation $(e^{i a})^2 = e^{i b}$ varied as $b$ varied between 0 and $2\pi$

Manipulate[NSolve[(E^(I a))^2 == E^(I b), a], {b, 0, 2 \[Pi]}]

However, the following error appears: Inverse function error

How would I use Reduce to solve the above equation? I thought reduce was a way to fold up a list with a binary operator.

share|improve this question
Off[Solve::ifun]; Manipulate[ Solve[(E^(I a))^2 == E^(I b), a], {b, 0, 2 [Pi]}] – Dr. belisarius May 20 '12 at 1:50
Could do: nSolve[b_?NumericQ] := Quiet[a /. NSolve[(E^(I a))^2 == E^(I b), a]] Manipulate[nSolve[b], {b, 0, 2 [Pi]}] – Daniel Lichtblau Jun 26 '12 at 23:19
up vote 9 down vote accepted

The "reduce" that you're thinking of is called Fold in Mathematica. Here, Reduce is a function to solve equations/inequalities.

The error message that you get for NSolve is the same as Solve::ifun, which you often get when there are an infinite number of solutions. A simple example that gives you this warning and is easy to relate to is:

Solve[Sin[k π] == 0, k]    
(* Solve::ifun: Inverse functions are being used by Solve, so some solutions may not be found; use Reduce for complete solution information.

{{k -> 0}} *)

Of course, $k=0\ $ is not the only solution, and the correct solution is $k\in \mathbb{Z}$. If you take the advice given in the warning and use Reduce, you get the full set:

Reduce[Sin[k Pi] == 0, k]
(* C[1] ∈ Integers && (k == 2 C[1] || k == (π + 2 π C[1])/π) *)
share|improve this answer
That helps a lot, thank you. I wouldn't think that an equation with only one free variable would have more than one solution, but since Solve and NSolve are using inverse functions, that must mean that it is using the many-valued complex logarithm right? If so, this makes a lot more sense. – tlehman May 20 '12 at 16:24
 Show[{Graphics[{White, Circle[{0, 0}, 1.5], Black, Circle[], PointSize[Large],
       Text[b, 1.2 {Cos@b, Sin@b}],
       Point[{Cos@b, Sin@b}],
       Text[#, 1.2 {Cos@#, Sin@#}],
       Point[{Cos@#, Sin@#}]}]} & /@
   (a /. Solve[(E^(I a))^2 == E^(I b), a])],
 {b, 0, 2 Pi}]

enter image description here

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.