Tag Info

Hot answers tagged

57

Building on Heike's ColorFunction, I came up with this: z = Transpose@Reverse@Sin@ Outer[Complex, Range[-Pi, Pi, 0.01], Range[-Pi, Pi, 0.01]]; hsbdata = Transpose[{ Rescale[Arg[z], {-Pi, Pi}], 1 - 0.05/Abs[Sin[2 Pi Abs[z]]], 0.02/Abs[Sin[2 Pi Abs[z]]] + Abs[Sin[2 Pi Im@z] Sin[2 Pi Re@z]]^0.25} , {3, 1, 2}]; Image[hsbdata, ColorSpace -> "HSB"] ...


42

In general, a typical root of a negative number is complex, so you need to get rid of most roots. A nice approach would be Root, e.g. Root[ x^3 + 8, #] & /@ Range[3] {-2, 1 - I Sqrt[3], 1 + I Sqrt[3]} To get only real roots you can do : Select[Root[ x^3 + 8, #] & /@ Range[3], Re[#] == # &] {-2} This is a handy approach when you ...


23

Well, you have to treat the real and imaginary parts separately. You can't really have a complex $z$ value in these plots. Here's one way to visualize complex sine: Table[Plot3D[f[Sin[x + I y]], {x, -1, 1}, {y, -1, 1}, PlotLabel -> TraditionalForm[f[Sin[z]]], RegionFunction -> Function[{x, y, z}, x^2 + y^2 < 1]], {f, {Re, Im, Abs}}] // ...


22

Not as pretty as the one in the original post, but it's getting in the right direction I think: RegionPlot[True, {x, -Pi, Pi}, {y, -Pi, Pi}, ColorFunction -> (Hue[Rescale[Arg[Sin[#1 + I #2]], {-Pi, Pi}], Sin[2 Pi Abs[Sin[#1 + I #2]]]^2, Abs@(Sin[Pi Re[Sin[#1 + I #2]]] Sin[Pi Im[Sin[#1 + I #2]]])^(1/ 4), 1] &), ...


21

You can plot in 3 dimensions only real and/or imaginary parts of a function. One can make use of Plot3D, but since there was a question how the sine function looks like on the unit circle, first I demonstrate usage of ParametricPlot3D and later I'll show a few of many possible uses of Plot3D. When we'd like to use ParametricPlot3D, then instead of ...


19

The integrand has two singular points: Solve[ 4z^2 + 4z + 3 == 0, z] {{z -> 1/2 (-1 - I Sqrt[2])}, {z -> 1/2 (-1 + I Sqrt[2])}} At infinity it becomes zero: Limit[ 1/Sqrt[ 4 z^2 + 4 z + 2], z -> ComplexInfinity] 0 All these points are the branch points, thus we should define appropriately integration contours in order to avoid possible ...


18

You may use a function, which gives you the "real Power": rprule=(b_?Negative)^Rational[m_,n_?OddQ]:>(-(-b)^(1/n))^m; Attributes[realPower]={Listable, NumericFunction,OneIdentity} (* same as Power *) realPower[b_?Negative, Rational[m_, n_?OddQ]] := (-(-b)^(1/n))^m; realPower[x_,y_]:=Power[x,y]; realPower[x_]:=x//.rprule; Then you'll get: ...


18

Here's a view that shows how the graph starts to spiral for negative $x$ values, if we take the complex values into account. ParametricPlot3D[{x, Re[Exp[x*Log[x]]], Im[Exp[x*Log[x]]]}, {x, -4, 2}, PlotRange -> All, ViewVertical -> {0, 1, 0}, BoxRatios -> {2, 1, 1}, ViewPoint -> {2, 2, 12}] In fact, if we write $x^x = e^{x\log(x)}$, this ...


18

Defining the function F and a subset of its domain : pts : F[z_] := (5 - I z)/(5^2 + z^2) pts = {-7, -2, 0, 2, 7}; the most straightforward way fulfilling the task is based on ParametricPlot and Epilog. We can also make a diagram with the basic graphics primitives like e.g. : Line, Circle, Point. Here are the both ways enclosed in GraphicsRow : ...


18

The standard built-in logarithm function is defined for complex variables as follows: Log[z] = Log[Abs[z]] + I Arg[z] The location of the branch cut is simply caused by the convention that polar angles of z are assumed to be in the range $-\pi$ to $\pi$. This same branch cut is also part of the definition of the built-in Arg function. Here is a different ...


17

This explicitly converts any numeric quantities in the expression to the desired form: polarForm = Expand[# /. z_?NumericQ :> Abs[z] Exp[I Arg[z]]] &; e.g. (1/4 + I/4) ((1 - 2 I) x + Sqrt[3] y) // polarForm $\frac{1}{2} \sqrt{\frac{5}{2}} e^{\frac{i \pi }{4}-i \text{ArcTan}[2]} x+\frac{1}{2} \sqrt{\frac{3}{2}} e^{\frac{i \pi }{4}} y$ ...


15

This is a good way : DensityPlot[ Rescale[ Arg[Sin[-x - I y]], {-Pi, Pi}], {x, -Pi, Pi}, {y, -Pi, Pi}, MeshFunctions -> Function @@@ {{{x, y, z}, Re[Sin[x + I y]]}, {{x, y, z}, Im[Sin[x + I y]]}, {{x, y, z}, Abs[Sin[x + I y]]}}, MeshStyle ...


15

Here are two suggestions for the function f[z_] := 1/z; First, instead of defining a region to omit from your plot, you should base the omission criterion on the length of the vectors (so that you don't have to adjust the criterion manually when switching to a function with different pole locations). That can be achieved like this: With[{maximumModulus = ...


15

The functions Re and Im (just as Conjugate) don't satisfy the Cauchy-Riemann differential equations and are therefore not analytic. That means their derivative is not uniquely defined in the complex plane. That's the reason why Re' and Im' can't be simplified. Therefore, we have to be more specific about how we want the limit to be done that corresponds to ...


15

What is wrong: a) you're using exact arithmetic. b) You keep iterating even if the point seems to be escaping. Try this ClearAll@prodOrb; prodOrb[c_, maxIters_: 100, escapeRadius_: 1] := NestWhileList[#^2 + c &, 0., Abs[#] < escapeRadius &, 1, maxIters ] prodOrb[0. + 10. I] prodOrb[0. + .1 I] (if you don't need the entire list but ...


14

The following function gives the complete information for a function $f:\mathbb{C}\mapsto\mathbb{C}$, by giving the absolute value as $z$-coordinate, and the argument as colour: ComplexFnPlot[f_, range_, options___] := Block[{rangerealvar, rangeimagvar,g}, g[r_,i_]:=(f/.range[[1]]:>r+I i); Plot3D[Abs[g[rangerealvar,rangeimagvar]], ...


14

The way you could use ContourPlot here, assuming your variable f is complex (f == x + I y) : eqn[x_, y_] := (25 Pi ( x + I y) I)/(1 + 10 Pi ( x + I y) I) {ContourPlot[Re@eqn[x, y], {x, -1, 1}, {y, -1, 1}, PlotPoints -> 50], ContourPlot[Im@eqn[x, y], {x, -1, 1}, {y, -1, 1}, PlotRange -> {-0.5, 0.5}, PlotPoints -> 50]} These are respectively ...


14

For this function: f[z_] := (1 - E^z + z)/(z^3 (z - 1)^2) there are no branch cuts in the complex plane therefore we simply use Cauchy integral theorem and the related formula of the complex residue, i.e. we sum up residues of the function $f$ in the circle $\mid z \mid =2$. Let's denote $$int = \oint_{\mid z \mid =2}\frac{1-e^z+z}{z^3 (z-1)^2}dz$$ Now ...


13

You can modify the global system variable $Assumptions, to get the effect you want: $Assumptions = aa[t] > 0 Then Integrate[D[yy[x, t], t]^2, {x, 0, 18}] 10.1601 Derivative[1][aa][t]^2 This may, however, be somewhat error-prone. Here is how I'd do this with local environments. This is a generator for a local environment: ...


13

In general, to get a list of all the cube roots of -8 (or the $m$ roots of any number $n$), you can use either the the Roots or Solve or Reduce functions. Roots[x^3 == -8, x] (* Out[1]= x == 2 || x == 2 (-1)^(2/3) || x == -2 (-1)^(1/3) *) Reduce and Solve are perhaps more flexible because you can specify the domain that you want or leave it out for all ...


13

For Integrate as well as for Simplify, Refine FunctionExpand, Limit etc. there is an option Assumptions: Integrate[ 1/Sqrt[ z^2 + u^2], {z, -l, l}, Assumptions -> (u | l) ∈ Reals] ConditionalExpression[ 2 ArcSinh[ l/Abs[ u]], u != 0 && l >= 0] or one can use Assuming[ (u | l) ∈ Reals, Integrate[ 1/Sqrt[ z^2 + u^2], {z, -l, l}]] the ...


13

I already mentioned Bernd Thaller's package Graphics`ComplexPlot` in the comments; if one blends the ideas from Artes's and Heike's answers, and then use the function $ComplexToColorMap[] from Thaller's package (I won't include it here; again, see the package for that), we get this: Needs["Graphics`ComplexPlot`"] (* Thaller's package; get it yourself *) ...


13

The plot is correct: the dashed line lies outside the domain of definition of the function. Let's first clean up the syntax. Capitalized names are reserved and you ought to delay evaluation using := instead of =. It's also a good idea to make a, b, and c local: g[x_, y_] := With[{a = Sqrt[x^2 - (1 - 1/y^2) y^2], b = Sqrt[x^2 - 2 y^2], c = Sqrt[x^2 - ...


12

As yulinyu has pointed out, something like the following will give you the desired plot. Plot[Through[{Re, Im}[x^x]], {x, -2, 2}, Evaluated -> True] You might also be interested in this excellent answer by Simon Woods to create a graph of the plot over the complex domain. Using his function and evaluating the following gives you a pretty picture ...


12

Let's find out. Here is a function to compare the results of evaluating f on a machine approximation of an exact argument z to its exact value: test[f_] := Function[{z}, f[N[z]] - f[z]]; We expect to find problems around the 52nd significant binary digit or so. Let's magnify these differences, then, by about $2^{60}$ and use logarithmic axes to study ...


12

Specify the display format of something using MakeBoxes, like so: MakeBoxes[polarForm[z_Complex], form_] := With[{r = Abs[z], ϕ = Arg[z]}, RowBox[{If[r == 1, Sequence @@ {}, MakeBoxes[r, form]], If[ϕ == 0, Sequence @@ {}, SuperscriptBox[MakeBoxes[E, form], RowBox[{MakeBoxes["\[ImaginaryI]", form], If[ϕ == 1, Sequence @@ {}, ...


12

If you want to calculate this integral with Mathematica use beautiful (and very powerful!)$\;$ Cauchy Integral Formula implying an adequate theorem of Complex Residue. Thus we have $$\int_{\left | z \right |=1}\frac{dz}{z}= 2\pi i\; Res_{z_{0}=0} f$$ where $f(z)=\frac{1}{z}$. We can find the residue at $z_0=0$ of $f(z)$ in Mathematica with Residue: ...


11

First, I have a few general comments. The simplest bifurcation diagrams for differential equations involve a single parameter in a single equation and there are several illustrations of these on the Wolfram Demonstrations site. More generally, of course, a bifurcation occurs when we see a qualitative change in the behavior of a system as some parameter ...


11

ImageForwardTransformation[] is the function you want here. To give a concrete example, here's how an image might be transformed by the complex mapping $w=z^3$: img = ExampleData[{"TestImage", "Mandrill"}]; imgc = ImageForwardTransformation[img, Through[{Re, Im}[(#[[1]] + I #[[2]])^3]] &, Background -> 1, ...


11

Since we can consider $f$ as a $4-$th order polynomial (with respect to $y$) we can always factorize it as you claim in terms of radicals, but for the sake of simplicity let's start writing it symbolically in terms of the Root objects defining $f$ to be p[x,y]: p[x_, y_] := x^9 - x^6 + 4 x^5 y + 2 x^3 y^2 - y^4 pf[x_, y_] = -Times @@ (y - (y /. {ToRules @ ...



Only top voted, non community-wiki answers of a minimum length are eligible