6
$\begingroup$

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.

$\endgroup$
  • $\begingroup$ Off[Solve::ifun]; Manipulate[ Solve[(E^(I a))^2 == E^(I b), a], {b, 0, 2 [Pi]}] $\endgroup$ – Dr. belisarius May 20 '12 at 1:50
  • $\begingroup$ Could do: nSolve[b_?NumericQ] := Quiet[a /. NSolve[(E^(I a))^2 == E^(I b), a]] Manipulate[nSolve[b], {b, 0, 2 [Pi]}] $\endgroup$ – Daniel Lichtblau Jun 26 '12 at 23:19
10
$\begingroup$

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])/π) *)
$\endgroup$
  • $\begingroup$ 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. $\endgroup$ – tlehman May 20 '12 at 16:24
6
$\begingroup$
Off[Solve::ifun];
Manipulate[
 Show[{Graphics[{White, Circle[{0, 0}, 1.5], Black, Circle[], PointSize[Large],
       Red,
       Text[b, 1.2 {Cos@b, Sin@b}],
       Point[{Cos@b, Sin@b}],
       Blue,
       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

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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