5
$\begingroup$

Entering

Solve[z^4 == -1]

gives:

{{z -> -(-1)^(1/4)}, {z -> (-1)^( 1/4)}, {z -> -(-1)^(3/4)}, {z -> (-1)^(3/4)}}

or $\left\{\left\{z\to -\sqrt[4]{-1}\right\},\left\{z\to \sqrt[4]{-1}\right\},\left\{z\to -(-1)^{3/4}\right\},\left\{z\to (-1)^{3/4}\right\}\right\}$

It is possible to have the output as:

{{z -> Exp[I*Pi/4]}, {z -> Exp[I*3 Pi/4]}, {z ->     Exp[I*5 Pi/4]}},
{z -> Exp[I*7 Pi/4]}

$$\left\{\left\{z\to \exp \left(\frac{i \pi }{4}\right)\right\},\left\{z\to \exp \left(\frac{i 3 \pi }{4}\right)\right\},\left\{z\to \exp \left(\frac{i 5 \pi }{4}\right)\right\}\right\},\left\{z\to \exp \left(\frac{i 7 \pi }{4}\right)\right\}$$

(with $i$ instead of $I$)

How can these points be plotted for visualization?

Thanks.

$\endgroup$
6
  • $\begingroup$ Overall, many thanks to everyone who has contributed. All the responses make me realise how little I know about Mathematica and leaves me wondering how I can gain a fraction of the knowledge shown in the given answers. $\endgroup$
    – Davo
    Commented Feb 18, 2023 at 20:10
  • $\begingroup$ Thanks also @Syed for tidying up my question 👍🏼 $\endgroup$
    – Davo
    Commented Feb 18, 2023 at 20:20
  • $\begingroup$ You can upvote any of the answers on the page by clicking the triangles (UP). As the OP, you can also accept one answer by clicking the checkmark next to the answer. This is the standard way of saying "Thanks" on all stack sites. We hope to see you again soon. $\endgroup$
    – Syed
    Commented Feb 18, 2023 at 21:22
  • $\begingroup$ Welcome to the Mathematica Stack Exchange. If you have started learning Mathematica, then you will find that the introductory book written by the inventor is a good learning resource. There is a fast intro for math students as well as a fast intro for programmers to choose from. $\endgroup$
    – Syed
    Commented Feb 18, 2023 at 21:23
  • $\begingroup$ Thanks @Syed for the links. Is there a Mathematica book specifically covering Maths including calculus and complex analysis? $\endgroup$
    – Davo
    Commented Feb 18, 2023 at 22:19

4 Answers 4

6
$\begingroup$
pts = Solve[z^4 == -1, z]

{{z -> -(-1)^(1/4)}, {z -> (-1)^( 1/4)}, {z -> -(-1)^(3/4)}, {z -> (-1)^(3/4)}}

Abs[z] E^(I Arg[z]) /. pts

Or

Flatten@({First@# Exp [ I (Last@#)]} & /@ (AbsArg[z] /. pts))

$$\left\{e^{-\frac{1}{4} (3 i \pi )},e^{\frac{i \pi }{4}},e^{-\frac{1}{4} (i \pi )},e^{\frac{3 i \pi }{4}}\right\}$$

As I read Bob Hanlon's answer, I realized that I chose the default argument answer. For an argument between 0 and 2π, you can try this variation:

MapThread[Times, {Abs[z] /. pts, Exp@Mod[Arg[z] /. pts, 2 π] }]

You can also try // TraditionalForm if it is for display purposes only.

To plot:

ComplexListPlot[z /. pts, PlotStyle -> {AbsolutePointSize[6], Red}, 
 Epilog -> {Dashed, Circle[]}, PlotRange -> {{-1, 1}, {-1, 1}}]

enter image description here

$\endgroup$
3
  • $\begingroup$ @Nasser Thank you Syed and Nasser for your quick replies. Both produce the required output, with Syed's also producing the graph. How would I add a surrounding circle at, say, 2, centred at 0? $\endgroup$
    – Davo
    Commented Feb 18, 2023 at 19:03
  • $\begingroup$ @Davo ComplexListPlot[z /. pts, PlotStyle -> {AbsolutePointSize[6], Red}, Epilog -> {Dashed, Circle[], Circle[{0, 0}, 2]}, PlotRange -> {{-2, 2}, {-2, 2}}] $\endgroup$
    – Syed
    Commented Feb 18, 2023 at 19:34
  • $\begingroup$ Perfect! Thank you so much 👍🏼 $\endgroup$
    – Davo
    Commented Feb 18, 2023 at 20:00
6
$\begingroup$
sol = SolveValues[z^4 == -1, z]
ResourceFunction["ComplexToPolar"] /@ sol

Mathematica graphics

$\endgroup$
6
$\begingroup$
$Version

(* "13.2.1 for Mac OS X ARM (64-bit) (January 27, 2023)" *)

Clear["Global`*"]

sol = Solve[z^4 == -1]

(* {{z -> -(-1)^(1/4)}, {z -> (-1)^(1/4)}, {z -> -(-1)^(3/4)}, {z -> (-1)^(3/4)}} *)

To convert to polar

sol2 = sol /. z_?NumericQ :> Abs[z]*Exp[I*Arg[z]]

(* {{z -> E^(-((3 I π)/4))}, {z -> E^((I π)/4)}, {z -> 
   E^(-((I π)/4))}, {z -> E^((3 I π)/4)}} *)

Values[sol] == Values[sol2]

(* True *)

Note that Mathematica automatically converts the arguments to the interval {-Pi, Pi}

{{z -> Exp[I*Pi/4]}, {z -> Exp[I*3 Pi/4]}, {z -> Exp[I*5 Pi/4]}, {z -> 
   Exp[I*7 Pi/4]}}

(* {{z -> E^((I π)/4)}, {z -> E^((3 I π)/4)}, 
    {z -> E^(-((3 I π)/4))}, {z -> E^(-((I π)/4))}} *)

To get the form that you requested would require something along the lines of

sol3 = sol /. 
  z_?NumericQ :> Abs[z]*Exp[Inactive[Times][I, Mod[Arg[z] + 2 Pi, 2 Pi]]]

enter image description here

sol2 === Activate[sol3]

(* True *)
$\endgroup$
1
  • $\begingroup$ I like that the output avoids negative Pi. Very clever! Many thanks Bob. $\endgroup$
    – Davo
    Commented Feb 18, 2023 at 20:07
5
$\begingroup$

Using Syed's idea and Bob Hanlon's idea with ComplexExpand:

SetAttributes[ToComplexExp, Listable]
ToComplexExp[expr_?NumericQ] := 
Abs[expr]*Exp[HoldForm[I]*Mod[Arg[ComplexExpand[expr]], 2 Pi]]

Your example:

sol = SolveValues[z^4 == -1, z]

(*{-(-1)^(1/4), (-1)^(1/4), -(-1)^(3/4), (-1)^(3/4)}*)

Test:

Sort@ToComplexExp[sol]

enter image description here

Using ToComplexExp with Solve:

sol = Flatten@Solve[z^4 == -1, z]

Test:

Sort[MapAt[ToComplexExp, #, {2}] & /@ sol]

enter image description here

$\endgroup$

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.