1
$\begingroup$

Let's say I have a complex exponential A*Exp[I*B], and I want to find B. The obvious way is to use the Arg[] function, but it only gives you values between -Pi and +Pi. Is there any way I can extract B even if it's not within this range?

$\endgroup$
1
  • $\begingroup$ I believe that this question is not well-defined. You can always shift $B$ by integer multiples of $2\pi$ without changing $A \exp(i B)$. $\endgroup$
    – user46676
    Commented Apr 3, 2017 at 1:52

1 Answer 1

2
$\begingroup$

I would use something like the following

A Exp[I B];

Cases[%, Exp[u_] :> Cancel[u/I], ∞] // First
(* B *)
$\endgroup$
1
  • $\begingroup$ Very useful answer thanks! I made it into a function like this (obvious for the most) GetArg[x_]:=Cases[{x}, Exp[u_] :> Cancel[u/I], ∞] // First; $\endgroup$
    – Massimo
    Commented Mar 7, 2023 at 22:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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