Tag Info

New answers tagged complex

0

Solve[4 z^2 + 8 z Conjugate[z] - 3 == 0, z] (* {z -> -1/2}, {z -> 1/2}, {z -> (-I/2)*Sqrt[3]}, {z -> (I/2)*Sqrt[3]}} *)

1

Specifying Complexes for Solveor Reduce suffices as does just doing it yourself (as alluded to by Daniel:Lichtblau): x + I y /.Solve[{4 (x^2 - y^2) + 8 (x^2 + y^2) - 3 == 0, 8 x y == 0}, {x, y}] yield: {-((I Sqrt[3])/2), (I Sqrt[3])/2, -(1/2), 1/2}

1

Just to show analytic and plot solutions: Reduce[{Exp[x] Sin[y] == 2, Cos[y] == 0}, {x, y}, Reals] lp = ListPlot[tb = Table[{Log[2], Pi/2 + 2 Pi j}, {j, -2, 2, 1}], PlotMarkers -> {Automatic, 10}, PlotStyle -> Red]; cplot = ContourPlot[ Through[{Re, Im@# - 2 &}[Exp[x + I y]]], {x, 0, Pi}, {y, -3 Pi, 3 Pi}, Contours -> {0}, ...

3

I tend to use ContourPlot[] instead. ContourPlot[With[{z = x + I y}, {Re[Exp[z] - 2 I], Im[Exp[z] - 2 I]}] // Evaluate, {x, 0, π}, {y, -3 π, 3 π}, AspectRatio -> Automatic, Contours -> {0}, ContourShading -> False] (See this related thread as well.)

4

Actually, Reduce did it : Reduce[4 z^2 + 8 Abs[z]^2 - 3 == 0,z, Complexes] z == -(1/2) || z == 1/2 || z == -((I Sqrt[3])/2) || z == (I Sqrt[3])/2 Or using the option Method-> Reduce in Solve : Solve[ 4 z^2 + 8 Abs[z]^2 - 3 == 0, z, Complexes, Method -> Reduce] {{z -> -(1/2)}, {z -> 1/2}, {z -> -((I Sqrt[3])/2)}, {z -> ( I Sqrt[3])/2}} Or ...

2

A pedestrian approach, overkill in this case, is to separate into explicit real and imaginary parts both for the expression(s) and variable(s). expr = 4 z^2 + 8 Abs[z]^2 - 3; {re, im} = ComplexExpand[{Re[expr], Im[expr]}, z] /. {Re[z] -> rez, Im[z] -> imz} solns = Solve[{re, im} == 0]; rez + I*imz /. solns (* Out[380]= {-3 + 4 imz^2 + 12 rez^2, 8 ...

5

Solve[4 z^2 + 8 Abs[z]^2 - 3 == 0 && z \[Element] Complexes, z] {{z -> -(1/2)}, {z -> 1/2}, {z -> -((I Sqrt[3])/2)}, {z -> ( I Sqrt[3])/2}}

6

Here is a compiled implementation of the Voigt profile function, based on an approximation derived by Chiarella and Reichel and improved by Abrarov, Quine and Jagpal: voigt = With[{n = 24, τ = 12}, With[{d = N[Range[n] π/τ], b = N[Exp[-(Range[n] π/τ)^2]], s = N[PadRight[{}, n, {-1, 1}]], sq = N[Sqrt[2]], sp ...

1

Let me test several versions of the redefined arg: x = RandomComplex[{-1 - I, 1 + I}, 1000000]; arg1[x_] := Mod[Arg@x, 2 π]; arg2[x_] := Arg[-x] + π; arg3[z_] := π + ArcTan[-Re[z], -Im[z]]; Max[Abs[arg1[x] - arg2[x]], Abs[arg1[x] - arg3[x]]] (* 8.88178*10^-16 *) arg1[x]; // AbsoluteTiming (* {0.16715, Null} *) arg2[x]; // AbsoluteTiming (* {0.154602, ...

0

From a comment by Artes, this seemed to solve the problem for the OP: arg[z_] /; Im[z] < 0 := Arg[z] + 2 Pi; arg[z_] /; Im[z] >= 0 := Arg[z]

18

I. $\sqrt{z}$ Quick, what's the square root of $4$? If you said $2$, you're right! If you said $-2$, you're right! Wait, what? Solve[x^2 == 4, x] {{x -> -2}, {x -> 2}} A lot of functions have the problem of not having a unique inverse. That is, if you ask what are the possible values an inverse can take, you might end up with two, three, ...

2

According to the docs, Sometimes Re can stay unevaluated for numeric arguments, for example Simplify @ Re[Sqrt[1 + I]] (* yields Re[Sqrt[1 + I]] *) So you may need to add FunctionalExpand to simplify it: FunctionExpand @ % (* yields Sqrt[2 + Sqrt[2]]/2^(3/4) *) So for your example, it would be: ComplexExpand[Re[(\[Pi]^2 - (\[Pi]^2 - 2 k^2) ...

7

{x,y} > 0 is not doing what you think it does. In contrast to Element which, as its documentation states, accepts arbitrary patterns and in which first argument, being a List of more than one elements, evaluates to Alternatives: $Assumptions = {x, y} ∈ Reals (* (x | y) ∈ Reals *) x ∈ Reals // Refine (* True *) y ∈ Reals // Refine (* True *) {x,y} > ... 3$Assumptions = And @@ Thread[Greater[{x, y, d, e}, 0]] && Element[{x, y, d, e}, Reals] x > 0 && y > 0 && d > 0 && e > 0 && (x | y | d | e) ∈ Reals ComplexExpand[Im[1/(y^2)^(9/2)]] 0

3

I would prefer to have consistency within the framework of Mathematica and hence start off with the original definition of your function as an integral taken here between 1 and z: f = Integrate[1/Sqrt[x (x^2 - 1)], {x, 1, z}, Assumptions -> z > 1] (* Out[35]= -2 EllipticF[ArcSin[1/Sqrt[z]], -1] + 2 EllipticK[-1] *) This is obviously different ...

11

(I just knew someone would ask this someday...) I had talked (ranted?) about this issue at some length here, so I'd like you to read that first. I'll just give an executive summary here: Mathematica uses the parameter convention, while the formula you found on Wikipedia is based on the modulus convention (quickly betrayed by the comma separating the two ...

5

Elegant this may not be, but it does not rely on uniquely generate symbols / numbers. Using the OP's definitions: Join[ GatherBy[Cases[roots, n_ /; Im[n] != 0], {Re[#], Abs@Im[#]} &], DeleteCases[roots, n_ /; Im[n] != 0] ] /. n_ /; Im[n] == 0 -> {n} (* Out: {{-1 - I, -1 + I}, {1}, {1}} *)

3

Until someone comes out with an elegant one: ClearAll[f]; f[0] := RandomReal[{0, 1}] GatherBy[roots, {Re@#, f@Abs@Im@#} &] (* {{-1 - I, -1 + I}, {1}, {1}} *)

Top 50 recent answers are included