Questions tagged [complex]

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

Filter by
Sorted by
Tagged with
9
votes
6answers
4k 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
3answers
554 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: ...
9
votes
2answers
8k 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?
9
votes
3answers
792 views

How to use Mathematica to do a complex integrate with poles in real axis?

I want to use Mathematica to compute the following complex integral: Integrate[Exp[I z ] 1/z, {z, -Infinity, Infinity}] Mathematica reports that it does not ...
9
votes
2answers
4k views

Laurent series expansion

Can someone share how to find the Laurent series expansion of $$f(z)=\frac{1}{(z^2-1)(z^2-4)}$$ centered at $0$ on the annulus $1<|z|<2$?
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
2answers
552 views

Complex continuation of an interpolated function

Context I have a complicated real function defined implicitly by a series of imbricated numerical integration. I need to make a continuation of this function for a complex variable which is easily ...
9
votes
3answers
225 views

Multiplying two complex SparseArray objects, yielding empty SparseArray crashes kernel

Problem: When I multiply together two sparse matrices that should give back the 0 matrix, where at least one element among the two is complex and at least one is not an exact number, the kernel ...
9
votes
2answers
507 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]]` <...
9
votes
1answer
2k 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 ...
9
votes
2answers
705 views

Visualizing the primes with the Riemann Zeta function

I am trying to plot the identity seen here, namely that if we define: $$\psi _{0}(x)={\frac 12}\left(\sum _{{n\leq x}}\Lambda (n)+\sum _{{n<x}}\Lambda (n)\right)$$ Then, it equal to the following,...
9
votes
2answers
174 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
1answer
441 views

NDSolve for complex BVPs and FindRoot

NDSolve works for complex valued ODE initial value problems (IVP). However, for a simple boundary value problem (BVP) with complex coefficients it fails: ...
9
votes
3answers
175 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
1answer
319 views

Why ArcTan[1, 0. I ] yields -1.5708+0. I?

Bug introduced in 5.2 or earlier and persisting through 12.0.0 Why ArcTan[1, 0. I ] yields -1.5708+0. I ? The result should ...
9
votes
1answer
373 views

Contour integration, residues and precision of the poles

Task I am trying to evaluate the contour integral of some functions. To have a concrete example, let's use $$ f(z,s) = \frac{1+(4+2s)\, z}{z - \left( 9 + 35s + 24s^2 + 4s^3 \right) z^2 + 8z^3} $$ <...
9
votes
2answers
374 views

Integrate and NIntegrate disagreeing over branch cut of Sqrt?

Bug introduced after 8.0.4 and before 9.0.1, and fixed in 11.1.0. In Mathematica 10.2 I'm trying to integrate this piecewise continuous function, but Integrate and ...
9
votes
2answers
2k 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: ...
9
votes
2answers
2k 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 \...
8
votes
5answers
13k views

How can I plot the complex graph of $x^x$ in Mathematica?

For example, this Wolfram Alpha query shows this graph: But it does not show the code for plotting it in Mathematica. Plot[x^x, {x, -1, 1}] only plots the real ...
8
votes
3answers
887 views

Modify real part and leaves imaginary part unchanged

How can I flip the sign of the real part but not affect the imaginary part of a complex number: a+bi => -a + bi Example list: ...
8
votes
4answers
345 views

Why does Mathematica not seem to know that $i^x$ cannot be equal to $0$?

I am experiencing a curious behaviour of Simplify when handling expressions involving powers of $\mathbf{i}$, such as $\mathbf{i}^x$ where $x$ is unknown. For ...
8
votes
4answers
2k views

Visualizing the Riemann zeta function

How to visualize in a nice geometric way (e.g., like in this YT video) the Riemann zeta function, $\zeta (z)$?
8
votes
4answers
777 views

How to recover Pauli matrices properties in Mathematica?

I want to do a cross or dot product involving a vector of Pauli matrices $ \vec\sigma=(\sigma^1, \sigma^2, \sigma^3) $; for example, $ \vec\sigma\times\vec\sigma=2\mathrm i\vec\sigma $ and $ \vec\...
8
votes
3answers
2k views

How to make denominator of a complex expression real?

I searched around, but couldn't find any, please help. For example, I got this: $$ -\frac{i}{2 \pi (-i \gamma +\text{V0}+\Omega )} $$ Which command will yield this result: $$ -\frac{i \gamma +\text{...
8
votes
2answers
368 views

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

Consider this code: ...
8
votes
2answers
545 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},\...
8
votes
2answers
193 views

Replace Complex Head with List

I would like to apply ListPlot to a set of complex numbers. This is what comes to mind to convert a complex number to a pair: ...
8
votes
1answer
299 views

Symbolic and numeric limit disagreeing on branch cut of ArcTan

Bug introduced after 8.0.4 and before 9.0.1 and fixed in 11.1.0. Investigating comments to my previous question lead me to the following problem: ...
8
votes
1answer
256 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
1k views

How to eliminate the zero real part of a purely imaginary number?

In Mathematica 9, a purely imaginary number, e.g. 0.9 I, will display as 0. + 0.9i in the output form. How can I eliminate the ...
8
votes
0answers
464 views

Expansion for Modified Bessel Function Around Infinity

I'm somewhat new to Mathematica, and I don't understand why I'm getting inconsistent series expansions for the modified Bessel Function of first kind near $x=\infty$. First problem: I get different ...
7
votes
3answers
255 views

Obtaining a matrix of complex values from associations giving the real and imaginary parts of each element?

I have a list of associations keyed by real and imaginary numbers, like so: ...
7
votes
3answers
2k views

Complex conjugate

How do I complex conjugate a vector? ...
7
votes
2answers
2k views

Draw the image of a complex region

I'm working on a complex question that asks that I determine a function that maps the complement of the region $D=\{z:|z+1|\le 1\}\cup\{z: |z-1|\le 1\}$ onto the upper half plane. That is, $f$ must ...
7
votes
3answers
300 views

Wrapper for inexact numeric complex numbers that maintains polar form

Related question: How can I convert a complex number into an exponent form Mathematica insists on displaying complex number in form a+I b when ...
7
votes
4answers
668 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
1k 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
3answers
417 views

Integrating a real function I get a complex value, while after variable transformation the result is real. Bug?

I have the following integral: Integrate[1/Sqrt[0.7 + 0.3*(1 + z)^3], {z, 0, ∞}, Assumptions -> z ∈ Reals] >> -3.36354 - 3.85013 I The output is complex, ...
7
votes
3answers
2k views

ComplexExpand absolute squared

ComplexExpand[Abs[a + b I]] Gives $\sqrt{a^2 + b^2 }$ ComplexExpand[Abs[a + b I]^2] On the other hand gives Abs[a + ...
7
votes
2answers
385 views

Exception with GatherBy: gathering complex conjugates

I want to gather the complex-conjugates that are in a list, but with an exception: only if the imaginary part isn't zero. For example: ...
7
votes
3answers
474 views

Riemann-Spherical Projection of Network onto the $\mathbb{R}^2$-Plane

I'm trying to find a way to plot the graph ...
7
votes
2answers
375 views

Possible bug with contour integration

I wanted to confirm the value of the integral $$\frac12\int_{\partial\Bbb D}\frac{\sin z}{\cosh z-1}\, dz$$ where $\partial\Bbb D$ is the boundary of the disk of radius $1$. Thus I had written the ...
7
votes
1answer
3k views

How to get rid of all complex numbers and functions?

For almost esthetical reasons, I always have been fascinated by infinite sums of series and I always wonder if theyhave a closed form. A couple of days ago, I found on MSE a question related to the ...
7
votes
1answer
315 views

Simplify doesn't work properly

I have function and its output. But output isn't simplified. I have tried Simplify[%, x < 0], but result was been the same. ...
7
votes
2answers
196 views

Portion of Curve Omitted by Plot

In the course of addressing question 104559, I encountered the following problem with Plot. Begin with ...
7
votes
1answer
367 views

How to calculate residues using different branches of the logarithm

My goal is to be able to compute the residues of something like $z^{\alpha} R(z)$ where $0 < \alpha < 1$, $R(z)$ is rational, and the exponential can be chosen with any branch. I found a way to ...
7
votes
1answer
313 views

Confirming conservation laws for complex valued functions

Consider the nonlinear Schrödinger equation (I would like to do this for a more complicated set of equations, but to gain understanding I'll consider this simplified case) $$A_t+iA_{xx}+i|A|^2A =0,$$ ...
7
votes
1answer
129 views

Why can't I replace I with HoldPattern@I?

Just try this sample: I /. HoldPattern@I -> a (* I *) Why does it fail to replace I with ...
7
votes
3answers
729 views

Getting Arg[z] to go from $0$ to $2\pi$

I'm defining branch cut functions, and I'm using $\arg(z)$ as a building block. So I just spent an hour at the whiteboard assuming that $\arg(z)$ goes from $0$ to $2\pi$, and then I implement the code,...

1
2
3 4 5
19