3
$\begingroup$

In my calculation, there exist some expressions like $-i e^{\frac{i k}{2}} \sqrt{-e^{-i k}}$, which are not simplified to be $1$, and makes further calculations rather complicated.

I tried to simplify the expression:

Simplify[-I Exp[(I k)/2] Sqrt[-Exp[-I k]]]
(* I E^((3 I k)/2) (-E^(-I k))^(3/2) *)

But these expressions are made lengthier using Mathematica. I find Mathematica does compute the square root of negative number:

Simplify[Sqrt[-1]]
(* I *)

But Mathematica doesn't combine them in the easiest way.

How is it possible to use Mathematica to simplify $-i e^{\frac{i k}{2}} \sqrt{-e^{-i k}}$ to $1$ in my calculation?

$\endgroup$
4
  • $\begingroup$ Hi. Welcome to Mathematica.SE! Please give your raw code as a copy-pasteable text, not as latex. $\endgroup$
    – yohbs
    Sep 8, 2015 at 7:59
  • $\begingroup$ Greetings! Make the most of Mma.SE and take the tour now. Help us to help you, write an excellent question. Edit if improvable, show due diligence, give brief context, include minimum working examples of code and data in formatted form. As you receive give back, vote and answer questions, keep the site useful, be kind, correct mistakes and share what you have learned. $\endgroup$
    – rhermans
    Sep 8, 2015 at 8:01
  • 1
    $\begingroup$ I guess k is along the lines of a wavenumber and can become complex. The standard approach is to manage your range of values for k by defining a branch cut. You then have to work out the Riemann surface on which your calculation is restricted. $\endgroup$
    – Hugh
    Sep 8, 2015 at 9:46
  • $\begingroup$ Yes, I think that is what I need, I can reformulate my calculation in this way, but how to define a branch cut? Could you please give me an example? $\endgroup$
    – phchen
    Sep 8, 2015 at 12:49

3 Answers 3

2
$\begingroup$

One thing you can try is PowerExpand

PowerExpand[-I Exp[(I k)/2] Sqrt[-Exp[-I k]]]

which returns 1. Note that PowerExpand works by making assumptions about the domain of the variables.

$\endgroup$
1
  • 1
    $\begingroup$ This method does solve my problem, which has a restricted range of k. But other readers should be careful about the assumption on the variables: "PowerExpand expands a square root, implicitly assuming positive real values". It's copied from the documentation center. $\endgroup$
    – phchen
    Sep 8, 2015 at 17:24
12
$\begingroup$

This doesn't work simply because the expression -I Exp[I k/2] Sqrt[-Exp[-I k]] is not equal to 1. Try plugging in $k=-1.0$ and see.

$\endgroup$
4
  • 1
    $\begingroup$ I see the problem, the expression has two possible values : $\pm1$. But how can I choose its value to be 1 in my calculation? $\endgroup$
    – phchen
    Sep 8, 2015 at 8:45
  • $\begingroup$ Can someone explain to me why this evaluates this way? Am I not allowed to pull the -1 outside of the square root? As in, Sqrt[a b]=Sqrt[a] Sqrt[b]? Because if I do this manually, {-I Exp[I k/2] Sqrt[-Exp[-I k]], -I Exp[I k/2] I Sqrt[Exp[-I k]]} /. k -> -1.0 then it gives the expected answer. $\endgroup$
    – Jason B.
    Sep 8, 2015 at 9:19
  • 4
    $\begingroup$ @JasonB No, you are not allowed to do that for general complex numbers. Look at this, for example: $$1=\sqrt{1}=\sqrt{-1\cdot-1}=\sqrt{-1}\cdot\sqrt{-1}=i\cdot i=-1$$ $\endgroup$
    – yohbs
    Sep 8, 2015 at 9:23
  • $\begingroup$ @JasonB, This is called "Root of unity", for a general complex number $z$, $z^{1/n}$ will give you $n$ different solutions. Usually we need to define a solution space to refine the solution as Hugh mentioned, but I don't know how to do it in Mathematica. And I missed it when I wrote this question at the beginning. $\endgroup$
    – phchen
    Sep 8, 2015 at 13:17
8
$\begingroup$

Further to yohbs' answer ...

Plot[-I Exp[(I k)/2] Sqrt[-Exp[-I k]], {k, 0, 50}, 
     Exclusions -> None,
     PlotRangePadding -> 0.5, Frame -> True, 
     FrameTicks -> {2 \[Pi] Range[10], Automatic}]

enter image description here

$\endgroup$
3
  • $\begingroup$ In this graph, Mathematica seems to choose solution to be 1 or -1 periodically ([0,2$\pi$],[2$\pi$,4$\pi$],[4$\pi$,6$\pi$]......). What if I want to choose them to be 1, how can I make it? I try the following code: "Simplify[-I E^((I k)/2) Sqrt[-E^(-I k)],Assumptions->{k>0,k<2[Pi]}]" but it still gives me the complicated form. $\endgroup$
    – phchen
    Sep 8, 2015 at 9:01
  • $\begingroup$ @chrisDegnen I changed the plot a bit to have more descriptive ticks. Hope you don't mind. $\endgroup$
    – yohbs
    Sep 8, 2015 at 9:55
  • $\begingroup$ May be Mathematica only choose one solution from two when we ask it to numerically plot the result. But Mathematica doesn't automatically choose any solution when we ask it calculate it analytically? $\endgroup$
    – phchen
    Sep 8, 2015 at 12:54

Your Answer

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

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