Questions about using complex numbers in Mathematica. This includes basic arithmetic, functions of complex numbers, plotting complex functions, and dealing with branch cuts.

learn more… | top users | synonyms (1)

68
votes
4answers
6k views

How can I generate this “domain coloring” plot?

I found this plot on Wikipedia: Domain coloring of $\sin(z)$ over $(-\pi,\pi)$ on $x$ and $y$ axes. Brightness indicates absolute magnitude, saturation represents imaginary and real magnitude. ...
39
votes
6answers
7k views

Finding real roots of negative numbers (for example, $\sqrt[3]{-8}$)

Say I want to quickly calculate $\sqrt[3]{-8}$, to which the most obvious solution is $-2$. When I input $\sqrt[3]{-8}$ or Power[-8, 3^-1], Mathematica gives the ...
39
votes
2answers
2k views

Möbius transformations revealed

Möbius Transformations Revealed is a short video that vividly illustrates the simplicity of Möbius transformations when viewed as rigid motions of the Riemann sphere. It was one of the winners in the ...
28
votes
1answer
3k views

How to visualize Riemann surfaces?

In WolframAlpha we can easily visualize Riemann surfaces of arbitrary functions, can we plot the Riemann surface of an arbitrary function using Mathematica and ...
23
votes
2answers
10k views

How to calculate contour integrals with Mathematica?

How to calculate the integral of $\frac{1}{\sqrt{4 z^2 + 4 z + 3}}$ over the unit circle counterclockwise for each branch of the integrand?
22
votes
4answers
18k views

Plotting Complex Quantity Functions

Trying to plot with complex quantities seems not to work properly in what I want to accomplish. I would like to know if there is a general rule/way of plotting when you have complex counterparts in ...
19
votes
3answers
3k views

Visualizing a Complex Vector Field near Poles

I've been playing around with a visualization technique for complex functions where one views the function $f: \mathbb{C} \rightarrow \mathbb{C}$ as the vector field $f: \mathbb{R^2} \rightarrow \...
18
votes
1answer
503 views

Numerical inverse Laplace-Hankel transform

When trying to reproduce the result of this paper about numerical solution of Lamb's problem, I encountered the following double integral (to be more precise, the 0-order inverse Hankel-Laplace ...
17
votes
1answer
2k views

How does Mathematica understand branchcuts of the complex logarithm?

Say I have the function $f(x) = x \tanh(\pi x) \log (x^2 +a^2)$ where $a$ is some positive real number. Then it seems to be me that Mathematica when given such a ...
17
votes
1answer
788 views

Dual complex integral over implicit path using contour plot

Context I am interested in doing double contour integral over paths which are defined implicitly. For the sake of debugging, let's assume its $$\oint_{\cal C}\oint_{\cal C} \frac{1}{u\, x} d u d x$$ ...
15
votes
2answers
366 views

Inconsistent results from equivalent integrals

Why is Mathematica returning different values for these two integrals: I am just being introduced to complex integration, so it's possible that I have a misunderstanding of how this works, but in ...
14
votes
2answers
4k views

Plotting complex Sine

I've got another plotting problem. I want to plot Sin[z] where z is complex. So, I've tried the following: ...
14
votes
5answers
5k views

Plotting complex numbers as an Argand Diagram

I have the function: $F(\omega) = \frac{5\; - \;i\;\omega}{5^2\; +\; \omega^2}$ When $\omega$ has the values : $\{ -7, -2,\; 0,\; 2,\; 7\}$ How would I plot the Argand diagram in Mathematica? Or ...
14
votes
3answers
3k views

How can I convert a complex number into an exponent form

When I have an expression such as (1/4 + I/4) ((1 - 2 I) x + Sqrt[3] y) it is hard to get an intuition of the number. So I want to convert it to the complex ...
14
votes
3answers
4k views

Derivative of real functions including Re and Im

When deriving functions using Re, Im or Arg (and probably some other functions as well), ...
14
votes
0answers
295 views

Why does Mathematica choose branches as it does in this situation?

Consider these integrals: ...
13
votes
2answers
10k views

How to specify assumptions before evaluation?

If I request mathematica evaluate an integral for me, I'll often get a more general ConditionalExpression than I want. Example : ...
12
votes
4answers
9k views

Factoring polynomials to factors involving complex coefficients

I've run into some problems using Factor on polynomials with complex coefficient factors. Reading the documentation it looks like it only factors over the ...
12
votes
4answers
1k views

Moving the location of the branch cut in Mathematica

According to the documentation, Mathematica chooses the branch cut for $\log(z)$ to lie along the negative real axis. It it possible to change this so that it lies along the positive axis or elsewhere ...
10
votes
1answer
3k views

Bifurcation diagrams for multiple equation systems

I am interested in constructing a bifurcation diagram for some of my parameters (especially for β and γ) in the dynamical system given in the code below. I want to see how parameter changes affect the ...
10
votes
1answer
5k views

Complex number operations: telling Mathematica variables are real

I want to do Conjugate[a + b*I], but when I do that, the solution is Conjugate[a] - I*Conjugate[b]; when for me, a and b are ...
10
votes
1answer
119 views

Definition of Mod and Quotient with complex arguments

How are Mod and Quotient defined for three real/complex arguments? I wasn't able to find the definition. My main surprise so ...
10
votes
2answers
558 views

Compiling the VoigtDistribution PDF

According to List of compilable functions, Erf and Erfc are compilable functions. However, I want to make a compiled version ...
10
votes
1answer
483 views

Symbolic Integration along contour: branch cut problem?

Context Following this question on path integrals in the complex plane, having defined again a numerical and symbolic integrator along a path as ...
10
votes
1answer
295 views

Contour Integration along a contour containing two branch points

I need to compute following contour integrations: $$f(u)=\oint_\alpha dz \sqrt{z^3+z+u} \qquad ; \qquad g(u)=\oint_\beta dz \sqrt{z^3+z+u}$$ In which $\alpha$ and $\beta$ are two contours in ...
9
votes
6answers
2k views

Image of first quadrant under $f(z)=(z+i)/(z-i)$

I'm able to plot the region where Im[z] > 0 and Re[z] > 0: ...
9
votes
2answers
3k views

Paths integrals in the complex plane

I can't find how to calculate path integrals of complex functions in the complex plane. For example: $$\oint_{\mid z \mid =2}\frac{1-e^z+z}{z^3 (z-1)^2}dz$$
9
votes
3answers
5k views

Is there a simple way to plot complex numbers satisfying a given criteria

I think this should be straightforward, but I cannot seem to find a good source on how to do it after searching around, so I'm trying to sketch sets of complex numbers that meet a given for criteria. ...
9
votes
2answers
776 views

Does FindFit support complex numbers or doesn't it?

Inspired by this previous question: Findfit doesn't give the good fit; Changing the starting values will not change the results. Consider the following complex-valued dataset. ...
9
votes
1answer
3k views

Is it possible to set a variable as a positive one in the whole notebook?

I'm having issues during integration due to the fact that Mathematica doesn't know if an undefined variable is positive or not (it gives me complexes which bothers me in the end). For example I do ...
9
votes
1answer
2k views

Is Abs[z]^2 a bad way to calculate the square modulus of z?

For a numerical quantity z, Abs[z] returns the square root of the sum of the squares of the real and imaginary parts of ...
9
votes
2answers
150 views

Problem with Identifying Complex Components

I am trying to isolate out the real and complex terms in a fairly large expression. During the process, I have made several assumptions that last throughout the entire process. ...
9
votes
3answers
131 views

Pattern matching with Complex. Feature or a bug?

fixed in 10.1 (windows) I have run into some strange behavior while doing some pattern matching. First, this works as expected: ...
9
votes
2answers
1k views

RootSearch for complex or multiple equations

First the background. I'm trying to solve for the roots of a rather messy complex equation. This is not the exact equation, but it's a decent (simpler) stand in: ...
8
votes
2answers
3k views

How do I find line integrals?

For example, how can I calculate $$\int_{\left | z \right |=1}\frac{dz}{z}$$ I know that the answer is $2\pi i$ but how do I do it using Mathematica?
8
votes
3answers
203 views

Complex result for Real vectors in VectorAngle

I was expecting a real angle using VectorAngle when passing real valued vectors, but I obtained a complex angle: ...
8
votes
1answer
1k views

Stereographic Projection

Say I want to represent points of the complex plane in the sphere $\Bbb S^2$ using stereographic projection. That is, the Riemann sphere: Specifically, it would be nice to be able to: Given the ...
8
votes
2answers
359 views

What is the value Re[Sqrt[1+I*2*x]]?

When I try to evaluate Re[Sqrt[z]], for some values of Mathematica fails to evaluate it. For example, Re[Sqrt[2 + I*x]]` <...
8
votes
1answer
139 views

Symbolic and numeric limit disagreeing on branch cut of ArcTan

Bug introduced after v8.0.4 and before v9.0.1, and persisting through v10.4.1. Investigating comments to my previous question lead me to the following problem: ...
8
votes
2answers
155 views

Integrate and NIntegrate disagreeing over branch cut of Sqrt?

Bug introduced after v8.0.4 and before v9.0.1, and persisting through v10.4.1. In Mathematica 10.2 I'm trying to integrate this piecewise continuous function, but ...
8
votes
2answers
251 views

Strange behavior of Limit in Mathematica 9 and 10 (bug?)

fixed in 10.1 Consider a complex logarithm where the branch cut is defined along the negative axis. Then for $r$ and $\eta$ real and positive we can write $ \lim_{\eta \to 0} \log(-r+ i \eta) = ...
8
votes
1answer
220 views

Testing for primality in quadratic rings?

Testing for primality in $\mathbb{Z}[\sqrt{-1}]$ in Mathematica is easy: PrimeQ[n, GaussianIntegers -> True] But how can I test for primality in, say, $\...
8
votes
2answers
844 views

Numerical contour integrations in the complex plane - contour deformation gives different answer for analytic kernel

I am trying to do a contour integration in Mathematica numerically. In particular, I'm checking the identity: $$ H_m^{(1)}(z) =\frac{i^{-m}}{\pi}\int_{-\pi/2 + i \infty}^{\pi/2 - i \infty} \exp[i m \...
7
votes
3answers
237 views

Wrapper for inexact numeric complex numbers that maintains polar form

Related question: How can I convert a complex number a+b I to the exponent form A Exp(I phi)? Mathematica insists on displaying complex number in form a+I b when <...
7
votes
4answers
439 views

Speed up Schwarz-Christoffel mapping

I would like to ask your advice how to speed up Contour and Parametric plots in the following example. Let as start by defining a function ...
7
votes
3answers
744 views

How do I plot the images of oriented curves under complex transformation?

I'm working on a complex transformation sketch that I'd like to create via mathematica. I'm working with the function $$w=z^2\tag{0},$$ where its real and imaginary parts are $u=x^2-y^2$ and $v=2xy$, ...
7
votes
2answers
241 views

Why does N[Re@f] give complex result?

Consider this code: ...
7
votes
2answers
235 views

Confusion regarding the incomplete elliptic integral of the first kind

I am trying to manipulate a conformal map from the half-plane to a square $z \rightarrow w(z)$ defined by: $$ w(z) = \int \limits^{z} dx \frac{1}{\sqrt{(1-x^2)x}} = \sqrt{2} \; F\left(\sqrt{z+1},\...
7
votes
1answer
273 views

How to compute the residue of $e^{z-\frac{1}{z}}$ at z=0?

I've tried the following but it didn't work: Residue[Exp[z - 1/z], {z, 0}] not even this: Residue[Exp[1/z], {z, 0}] ...
7
votes
1answer
293 views

Branch cuts of sqrt

I was trying to plot some complex functions with branch cuts on mathematica but I have two problems. 1) The function is with z-Sqrt[z-1]*Sqrt[z+1] with z complex. Now Mathematica says that the ...