New answers tagged

2

I'm posting this to put Rahul's answer, given in a comment to the question, on record. ContourPlot[Im[x + I y - Log[x + I y]], {x, -6, 8}, {y, -6, 6}, Contours -> {0}, RegionFunction -> Function[{x, y}, Re[x + I y - Log[x + I y]] > 0]] The yellow regions are positive and the blue regions are negative. The plot can be much cleaner if a ...


3

A compact approach is ParametricPlot[ReIm[Log[θ] Exp[I θ]], {θ, 0, 2 Pi}] producing the same curve that appears in the answer by thedude. It works for any complex function of a single real variable. Appropriate to the season, a cartiod can be plotted by ParametricPlot[ReIm[I(Exp[I θ] + 1)^2], {θ, -Pi, Pi}]


1

Upon MarcoB's suggestion: complex[θ_] = Exp[I θ]; ListPlot[Table[ReIm@complex@θ, {θ, 0, 2 Pi, 0.01}], AspectRatio -> Automatic, Joined -> True] Example complex[θ_] = Log@θ Exp[I θ]; ListPlot[Table[ReIm@complex@θ, {θ, 0, 2 Pi, 0.01}], AspectRatio -> Automatic, Joined -> True]


3

Reduce[expr, x, Reals] will be your friend here, but it can take a bit of work to parse its result. Here's a solution that should work for any expression, not just polynomials (at least for the small set of examples I tried). RealInverse[a_. x_^q_Integer?Positive + b_., x_] /; FreeQ[{a, b}, x] := Surd[(x-b)/a, q] RealInverse[expr_, x_] := Module[{y, ...


0

What about this? inverseFunc[x_] = x /. Solve[x^3 == y, x, Reals][[1]] /. y -> x; N@inverseFunc[3] N@inverseFunc[-1] (*1.44225*) (*-1.*)


0

One way to find and plot the real root of x^3 == y is x /. Solve[x^3 == y, x, Reals] (* {Root[-y + #1^3 &, 1]} *) Plot[%, {y, -10, 10}, AxesLabel -> {y, x}] This works for any polynomial f[x] == y that has a real root, as requested in the question. Is this what you had in mind? Addendum In response to the OP's comment below, a do-it-yourself ...


4

The original formulation was close, and the level spec of Infinity "almost" worked. As was noted in comments, it does work if Rule is replaced by RuleDelayed. The reason it otherwise causes trouble is from a "variable capture" in scoping. The pattern variables, a_ and b_, have the same names as expressions under consideration. With Rule the rhs is evaluated ...


2

Assuming this is what you are going for, You can get there two ways, Replace[a, {I x_ :> H x, -I x_ :> - H x}, Infinity] or a /. {I x_ :> H x, -I x_ :> - H x}


3

a = Power[ Plus[Subscript[u, x], Times[Complex[0, -1], Subscript[u, y]], Times[Complex[0, 1], Subscript[v, x]], Subscript[v, y]], 2] b = ComplexExpand@a /. I -> H


1

func[z_] := ((-2 + 4 I) Cos[0.0628319 z] + (2 - I) Sin[ 0.0628319 z])/((1 + 2 I) Cos[0.0628319 z] + (4 + 2 I) Sin[ 0.0628319 z]) ComplexExpand@func[0] Show[ Plot[ Im@func[z], {z, 0, 100}, PlotStyle -> Blue ], Plot[ Re@func[z], {z, 0, 100}, PlotStyle -> Red ], PlotRange -> All ] (*1.2 + 1.6 I*)


1

You're not tryng to get the imaginary part of a number. You are trying to get the imaginary part of an expression. Let's say we define your expression to be equivalent to eq: eq==(2 + 4 I) Cos[0.0628319 z] + (2 - I) Sin[0.0628319 z])/ ((1 + 2 I) Cos[0.0628319 z] + (4 + 2 I) Sin[0.0628319 z]) Solving the above for z gives 4 solutions. Lets say we take one ...


1

NOTE: the answer below refers to a somewhat different version of the OP's question. Refine seems to be your friend here: bop = Sqrt[x - 2]; Refine[Conjugate@bop, x < 2] (* Out: -I Sqrt[2 - x] *) Notice that, by implicating $x$ in an inequality, the system automatically includes the assumption that it must therefore be real, so only the inequality ...


3

One can get a truly ridiculous solution by ComplexExpand[]ing the real and imaginary parts: Reduce[ComplexExpand[{Re /@ #, Im /@ #}] &[ (1 + I)^n == (1 + Sqrt[3] I)^m], {m, n}, Integers] (* ... an astonishing mess involving 14 integer parameters ... *) However, pulling out the magnitude and argument is much nicer. Reduce[ComplexExpand[{Abs ...


6

As stated in the question and also the comment above by Szabolcs, Mathematica does not seem to be able to solve the equation directly. For instance, neither Solve nor Reduce produces the desired result. However, as I suggested in a comment above, the equation can be decomposed into expressions for its amplitude and phase, and each solved to obtain the ...


0

eq1 = (1 + I)^n; eq2 = (1 + Sqrt[3] I)^m; Reduce[ComplexExpand@Thread[AbsArg@eq1 == AbsArg@eq2], {n, m}, Integers] (* C[1] \[Element] Integers && n == 24 C[1] && m == 12 C[1] *) ContourPlot[{Re@eq1 == Re@eq2, Im@eq1 == Im@eq2}, {n, 20, 50}, {m, 10, 30}, Epilog -> {Red, PointSize@Large, Point@{{24, 12}, {48, 24}}}] The solutions ...


3

Last@Reap@Do[ If[ ReIm[(1 + I)^n] == ReIm[(1 + Sqrt[3] I)^m] , Sow[{n, m}] ] , {n, 100} , {m, 100} ] {{{24, 12}, {48, 24}, {72, 36}, {96, 48}}}



Top 50 recent answers are included