Recursive randomness of reals: summing a random decreasing sequence

In a comment to Recursive randomness of integers Rahul pointed out a continuous version of the same problem: pick {x_0} uniformly in {[0,1]}, then {x_1} uniformly in {[0,x_0]}, then {x_2} uniformly in {[0, x_1]}, etc. What is the distribution of the sum {S=\sum_{n=0}^\infty x_n}?

The continuous version turns out to be easier to analyse. To begin with, it’s equivalent to picking uniformly distributed, independent {y_n\in [0,1]} and letting {x_n = y_0y_1\cdots y_n}. Then the sum is

{\displaystyle y_0+y_0y_1 + y_0y_1y_2 + \cdots }

which can be written as

{\displaystyle y_0(1+y_1(1+y_2(1+\cdots )))}

So, {S} is a stationary point of the random process {X\mapsto (X+1)U} where {U} is uniformly distributed in {[0,1]}. Simply put, {S} and {(S+1)U} have the same distribution. This yields the value of {E[S]} in a much simpler way than in the previous post:

{E[S]=E[(S+1)U] = (E[S] + 1) E[U] = (E[S] + 1)/2}

hence {E[S]=1}.

We also get an equation for the cumulative distribution function {C(t) = P[S\le t]}. Indeed,

{\displaystyle P[S\le t] = P[(S+1)U \le t] = P[S \le t/U-1]}

The latter probability is {\int_0^1 P[S\le t/u-1]\,du = \int_0^1 C(t/u-1)\,du}. Conclusion: {C(t) = \int_0^1 C(t/u-1)\,du}. Differentiate to get an equation for the probability density function {p(t)}, namely {p(t) = \int_0^1 p(t/u-1)\,du/u}. It’s convenient to change the variable of integration to {v = t/u-1}, which leads to

{\displaystyle p(t) = \int_{t-1}^\infty p(v)\,\frac{dv}{v+1}}

Another differentiation turns the integral equation into a delay differential equation,

{\displaystyle p'(t) = - \frac{p(t-1)}{t}}

Looks pretty simple, doesn’t it? Since the density is zero for negative arguments, it is constant on {[0,1]}. This constant, which I’ll denote {\gamma}, is {\int_{0}^\infty p(v)\,\frac{dv}{v+1}}, or simply {E[1/(S+1)]}. I couldn’t get an analytic formula for {\gamma}. My attempt was {E[1/(S+1)] = \sum_{n=0}^\infty (-1)^n M_n} where {M_n=E[S^n]} are the moments of {S}. The moments can be computed recursively using {E[S^n] = E[(S+1)^n]E[U^n]}, which yields

{\displaystyle M_n=\frac{1}{n} \sum_{k=0}^{n-1} \binom{n}{k}M_k}

The first few moments, starting with {M_0}, are 1, 1, 3/2, 17/6, 19/3, 81/5, 8351/80… Unfortunately the series {\sum_{n=0}^\infty (-1)^n M_n} diverges, so this approach seems doomed. Numerically {\gamma \approx 0.5614} which is not far from the Euler-Mascheroni constant, hence the choice of notation.

On the interval (1,2) we have {p'(t) = -\gamma/t}, hence

{p(t) = \gamma(1-\log t)} for {1 \le t \le 2}.

The DDE gets harder to integrate after that… on the interval {[2,3]} the solution already involves the dilogarithm (Spence’s function):

{\displaystyle p(t) = \gamma(1+\pi^2/12 - \log t + \log(t-1)\log t + \mathrm{Spence}\,(t))}

following SciPy’s convention for Spence. This is as far as I went… but here is an experimental confirmation of the formulas obtained so far (link to full size image).

Histogram of 10 million samples and the pdf (red) plotted on [0,3]

To generate a sample from distribution S, I begin with a bunch of zeros and repeat “add 1, multiply by U[0,1]” many times. That’s it.

import numpy as np
import matplotlib.pyplot as plt
trials = 10000000
terms = 10000
x = np.zeros(shape=(trials,))
for _ in range(terms):
    np.multiply(x+1, np.random.uniform(size=(trials,)), out=x)
_ = plt.hist(x, bins=1000, normed=True)

I still want to know the exact value of {\gamma}… after all, it’s also the probability that the sum of our random decreasing sequence is less than 1.


The constant I called “{\gamma}” is in fact {\exp(-\gamma)} where {\gamma} is indeed Euler’s constant… This is what I learned from the Inverse Symbolic Calculator after solving the DDE (with initial value 1) numerically, and calculating the integral of the solution. From there, it did not take long to find that

Oh well. At least I practiced solving delay differential equations in Python. There is no built-in method in SciPy for that, and although there are some modules for DDE out there, I decided to roll my own. The logic is straightforward: solve the ODE on an interval of length 1, then build an interpolating spline out of the numeric solution and use it as the right hand side in the ODE, repeat. I used Romberg’s method for integrating the solution; the integration is done separately on each interval [k, k+1] because of the lack of smoothness at the integers.

import numpy as np
from scipy.integrate import odeint, romb
from scipy.interpolate import interp1d
numpoints = 2**12 + 1
solution = [lambda x: 1]
integrals = [1]
for k in range(1, 15):
    y0 = solution[k-1](k)
    t = np.linspace(k, k+1, numpoints)
    rhs = lambda y, x: -solution[k-1](np.clip(x-1, k-1, k))/x
    y = odeint(rhs, y0, t, atol=1e-15, rtol=1e-13).squeeze()
    solution.append(interp1d(t, y, kind='cubic', assume_sorted=True))
    integrals.append(romb(y, dx=1/(numpoints-1)))
total_integral = sum(integrals)

As a byproduct, the program found the probabilities of the random sum being in each integer interval:

  • 56.15% in [0,1]
  • 34.46% in [1,2]
  • 8.19% in [2,3]
  • 1.1% in [3,4]
  • 0.1% in [4,5]
  • less than 0.01% chance of being greater than 5

Recursive randomness of integers

Entering a string such as “random number 0 to 7” into Google search brings up a neat random number generator. For now, it supports only uniform probability distributions over integers. That’s still enough to play a little game.

Pick a positive number, such as 7. Then pick a number at random between 0 and 7 (integers, with equal probability); for example, 5. Then pick a number between 0 and 5, perhaps 2… repeat indefinitely. When we reach 0, the game becomes really boring, so that is a good place to stop. Ignoring the initial non-random number, we got a random non-increasing sequence such as 5, 2, 1, 1, 0. The sum of this one is 9… how are these sums distributed?

Let’s call the initial number A and the sum S. The simplest case is A=1, when S is the number of returns to 1 until the process hits 0. Since each return to 1 has probability 1/2, we get the following geometric distribution


Sum Probability
0 1/2
1 1/4
2 1/8
3 1/16
k 1/2k+1

When starting with A=2, things are already more complicated: for one thing, the probability mass function is no longer decreasing, with P[S=2] being greater than P[S=1]. The histogram shows the counts obtained after 2,000,000 trials with A=2.


The probability mass function is still not too hard to compute: let’s say b is the number of times the process arrives at 2, then the sum is 2b + the result with A=1. So we end up convolving two geometric distributions, one of which is supported on even integers: hence the bias toward even sums.

Sum Probability
0 1/3
1 1/6
2 5/36
3 7/72
k ((4/3)[k/2]+1-1)/2k

For large k, the ratio P[S=k+2]/P[s=k] is asymptotic to (4/3)/4 = 1/3, which means that the tail of the distribution is approximately geometric with the ratio of {1/\sqrt{3}}.

I did not feel like computing exact distribution for larger A, resorting to simulations. Here is A=10 (ignore the little bump at the end, an artifact of truncation): n10t2m

There are three distinct features: P[S=0] is much higher than the rest; the distribution is flat (with a bias toward even, which is diminishing) until about S=n, and after that it looks geometric. Let’s see what we can say for a general starting value A.

Perhaps surprisingly, the expected value E[S] is exactly A. To see this, consider that we are dealing with a Markov chain with states 0,1,…,A. The transition probabilities from n to any number 0,…,n are 1/(n+1). Ignoring the terminal state 0, which does not contribute to the sum, we get the following kind of transition matrix (the case A=4 shown):

{\displaystyle M = \begin{pmatrix}1/2 & 0 & 0 & 0 \\ 1/3 & 1/3 & 0 & 0 \\ 1/4 & 1/4 & 1/4 & 0 \\ 1/5 & 1/5 & 1/5 & 1/5\end{pmatrix} }

The initial state is a vector such as {v = (0,0,0,1)}. So {vM^j} is the state after j steps. The expected value contributed by the j-th step is {vM^jw} where {w = (1,2,3,4)^T} is the weight vector. So, the expected value of the sum is

{\displaystyle \sum_{j=1}^\infty vM^jw = v\left(\sum_{j=1}^\infty M^j\right)w = vM(I-M)^{-1}w}

It turns out that the matrix {M(I-M)^{-1}} has a simple form, strongly resembling M itself.

{\displaystyle M(I-M)^{-1} = \begin{pmatrix} 1 & 0 & 0 & 0 \\ 1 & 1/2 & 0 & 0 \\ 1 & 1/2 & 1/3 & 0 \\ 1 & 1/2 & 1/3 & 1/4 \end{pmatrix} }

Left multiplication by v extracts the bottom row of this matrix, and we are left with a dot product of the form {(1,1/2,1/3,1/4)\cdot (1,2,3,4) = 1 + 1 + 1 + 1 = 4 }. Neat.

What else can we say? The median is less than A, which is no surprise given the long tail on the right. Also, P[S=0] = 1/(A+1) since the only way to have zero sum is to hit 0 at once. A more interesting question is: what is the limit of the distribution of T = S/A as A tends to infinity? Here is the histogram of 2,000,000 trials with A=50.


It looks like the distribution of T tends to a limit, which has constant density until 1 (so, until A before rescaling) and decays exponentially after that. Writing the supposed probability density function as {f(t) = c} for {0\le t\le 1}, {f(t) = c\exp(k(1-t))} for {t > 1}, and using the fact that the expected value of T is 1, we arrive at {c = 2-\sqrt{2} \approx 0.586} and {k=\sqrt{2}}. This is a pretty good approximation in some aspects: the median of this distribution is {1/(2c)}, suggesting that the median of S is around {n/(4-2\sqrt{2})} which is in reasonable agreement with experiment. But the histogram for A=1000 still has a significant deviation from the exponential curve, indicating that the supposedly geometric part of T isn’t really geometric:

The distribution of S with A=1000 versus the constant-geometric approximation

One can express S as a sum of several independent geometric random variables, but the number of summands grows quadratically in A, and I didn’t get any useful asymptotics from this. What is the true limiting distribution of S/A, if it’s not the red curve above?

Very fractional geometric progressions with an integer ratio

The geometric progression 1/3, 2/3, 4/3, 8/3, 16/3,… is notable for being dyadic (ratio 2) and staying away from integers as much as possible (distance 1/3 between this progression and the set of integers; no other dyadic progression stays further away from integers). This property is occasionally useful: by taking the union of the dyadic partition of an interval with its shift by 1/3, one gets a system of intervals that comfortably covers every point: for every point x and every (small) radius r there is an interval of size r, in which x is near the middle.

Endpoints of the intervals in one group are away from the endpoints of the other

It’s easy to see that for any real number x, the distance between the progression {x, 2x, 4x, 8x, …} and the set of integers cannot be greater than 1/3. Indeed, since the integer part of x does not matter, it suffices to consider x between 0 and 1. The values between 0 and 1/3 lose immediately; the values between 1/3 and 1/2 lose after being multiplied by 2. And since x and 1-x yield the same distance, we are done.

Let’s find the most fractional progressions with other integer ratios r. When r is odd, the solution is obvious: starting with 1/2 keeps all the terms at half-integers, so the distance 1/2 is achieved. When r is even, say r = 2k, the best starting value is x = k/(2k+1), which achieves the distance x since rx = k-x. The values between 0 and k/(2k+1) are obviously worse, and those between k/(2k+1) and 1/2 become worse after being multiplied by r: they are mapped to the interval between k-x and k.

The problem is solved! But what if… x is irrational?

Returning to ratio r=2, it is clear that 1/3 is no longer attainable. The base-2 expansion of x cannot be 010101… as that would be periodic. So it must contain either 00 or 11 somewhere. Either of those will bring a dyadic multiple of x within distance less than 0.001111… (base 2) of an integer, that is distance 1/4.

The goal is to construct x so that its binary expansion is as balanced between 0 and 1 as possible, but without being periodic. The Thue-Morse constant does exactly this. It’s constructed by starting with 0 and then adding the complement of the sequence constructed so far: x = .0 1 10 1001 10010110 … which is approximately 0.412. The closest the dyadic geometric progression starting with x comes to an integer is 2x, which has distance about 0.175. The Wikipedia article links to the survey The ubiquitous Prouhet-Thue-Morse sequence by Allouche and Shallit, in which Corollary 2 implies that no other irrational number has a dyadic progression with a greater distance from integers, provided that this distance is attained. I have not been able to sort out the case in which the distance from a progression to the integers is not attained, but it seems very likely that Thue-Morse remains on top.

What about other ratios? When the ratio r is even, the situation is essentially the same as for r=2, for the following reason. In base r there are two digits nearest (r-1)/2, for example 4 and 5 in base 10. Using these digits in the Thue-Morse sequence, we get a strong candidate for the most fractional progression with ratio r: for example, 0.455454455445… in base 10, with the distance of about 0.445. Using any other digit loses the game at once: for example, having 3 in the decimal expansion implies that some multiple of 10 is within less than 0.39999… =  0.4 of an integer.

When the ratio is odd, there are three digits that could conceivably be used in the extremal x: namely, (r-1)/2 and its two neighbors. If the central digit (r-1)/2 is never used, we are back to the Thue-Morse pattern, such as  x = 0.0220200220020220… in base 3 (an element of the standard Cantor set, by the way). But this is an unspectacular achievement, with the distance of about 0.0852. One can do better by starting with 1/2 = 0.1111111… and sprinkling this ternary expansions with 0s or 2s in some aperiodic way, doing so very infrequently. By making the runs of 1s extremely long, we get the distance arbitrarily close to 1 – 0.2111111… base 3, which is simply 1/2 – 1/3 = 1/6.

So it seems that for irrational geometric progressions with an odd ratio r, the distance to integers can be arbitrarily close to the number 1/2 – 1/r, but there is no progression achieving this value.

The Kolakoski-Cantor set

A 0-1 sequence can be interpreted as a point in the interval [0,1]. But this makes the long-term behavior of the sequence practically invisible due to limited resolution of our screens (and eyes). To make it visible, we can also plot the points obtained by shifting the binary sequence to the left (Bernoulli shift, which also goes by many other names). The resulting orbit  is often dense in the interval, which doesn’t really help us visualize any patterns. But sometimes we get an interesting complex structure.

The Kolakoski-Cantor set, KC

The vertical axis here is the time parameter, the number of dyadic shifts. The 0-1 sequence being visualized is the Kolakoski sequence in its binary form, with 0 and 1 instead of 1 and 2. By definition, the n-th run of equal digits in this sequence has length {x_n+1}. In particular, 000 and 111 never occur, which contributes to the blank spots near 0 and 1.

Although the sequence is not periodic, the set is quite stable in time; it does not make a visible difference whether one plots the first 10,000 shifts, or 10,000,000. The apparent symmetry about 1/2 is related to the open problem of whether the Kolakoski sequence is mirror invariant, meaning that together with any finite word (such as 0010) it also contains its complement (that would be 1101).

There are infinitely many forbidden words apart from 000 and 111 (and the words containing those). For example, 01010 cannot occur because it has 3 consecutive runs of length 1, which implies having 000 elsewhere in the sequence. For the same reason, 001100 is forbidden. This goes on forever: 00100100 is forbidden because it implies having 10101, etc.

The number of distinct words of length n in the Kolakoski sequence is bounded by a power of n (see F. M. Dekking, What is the long range order in the Kolakoski sequence?). Hence, the set pictured above is covered by {O(n^p)} intervals of length {2^{-n}}, which implies it (and even its closure) is zero-dimensional in any fractal sense (has Minkowski dimension 0).

The set KC apparently does not have any isolated points; this is also an open problem, of recurrence (whether every word that appears in the sequence has to appear infinitely many times). Assuming this is so, the closure of the orbit is a totally disconnected compact set without isolated points, i.e., a Cantor set. It is not self-similar (not surprising, given it’s zero-dimensional), but its relation to the Bernoulli shift implies a structure resembling self-similarity:

KC is covered by two copies scaled by 1/2

Applying the transformations {x\mapsto x/2} and {x\mapsto (1+x)/2} yields two disjoint smaller copies that cover the original set, but with some spare parts left. The leftover bits exist because not every word in the sequence can be preceded by both 0 and 1.

KC covered by two copies scaled by 2

Applying the transformations {x\mapsto 2x} and {x\mapsto 2x-1} yields two larger copies that cover the original set. There are no extra parts within the interval [0,1] but there is an overlap between the two copies.

The number {c = \inf KC\approx 0.146778684766479} appears several times in the structure of the set: for instance, the central gap is {((1-c)/2, (1+c)/2)}, the second-largest gap on the left has the left endpoint {(1-c)/4}, etc. The Inverse Symbolic Calculator has not found anything about this number. Its binary expansion begins with 0.001 001 011 001 001 101 001 001 101 100… which one can recognize as the smallest binary number that can be written without doing anything three times in a row. (Can’t have 000; also can’t have 001 three times in a row; and 001 010 is not allowed because it contains 01010, three runs of length 1. Hence, the number begins with 001 001 011.) This number is obviously irrational, but other than that…

In conclusion, the Python code used to plot KC.

import numpy as np
import matplotlib.pyplot as plt
n = 1000000
a = np.zeros(n, dtype=int)
j = 0                  
same = False  
for i in range(1, n):
    if same:
        a[i] = a[i-1]    
        same = False
        a[i] = 1 - a[i-1]
        j += 1            
        same = bool(a[j])
v = np.array([1/2**k for k in range(60, 0, -1)])
b = np.convolve(a, v, mode='valid')
plt.plot(b, np.arange(np.size(b)), '.', ms=2)

Pisot constant beyond 0.843

In a 1946 paper Charles Pisot proved a theorem involving a curious constant {\gamma_0= 0.843\dots}. It can be defined as follows:

{\gamma_0= \sup\{r \colon \exists } monic polynomial {p} such that {|p(e^z)| \le 1} whenever {|z|\le r \}}

Equivalently, {\gamma_0} is determined by the requirement that the set {\{e^z\colon |z|\le \gamma_0\}} have logarithmic capacity 1; this won’t be used here. The theorem is stated below, although this post is really about the constant.

Theorem: If an entire function takes integer values at nonnegative integers and is {O(e^{\gamma |z|})} for some {\gamma < \gamma_0}, then it is a finite linear combination of terms of the form {z^n \alpha^z}, where each {\alpha } is an algebraic integer.

The value of {\gamma_0} is best possible; thus, in some sense Pisot’s theorem completed a line of investigation that began with a 1915 theorem by Pólya which had {\log 2} in place of {\gamma_0}, and where the conclusion was that {f} is a polynomial. (Informally speaking, Pólya proved that {2^z} is the “smallest” entire-function that is integer-valued on nonnegative integers.)

Although the constant {\gamma_0} was mentioned in later literature (here, here, and here), no further digits of it have been stated anywhere, as far as I know. So, let it be known that the decimal expansion of {\gamma_0} begins with 0.84383.

A lower bound on {\gamma_0} can be obtained by constructing a monic polynomial that is bounded by 1 on the set {E(r) = \{e^z \colon |z|\le r \}}. Here is E(0.843):


It looks pretty round, except for that flat part on the left. In fact, E(0.82) is covered by a disk of unit radius centered at 1.3, which means that the choice {p(z) = z-1.3} shows {\gamma_0 > 0.82}.

p(z) = z-1.3 gives lower bound 0.82

How to get an upper bound on {\gamma_0}? Turns out, it suffices to exhibit a monic polynomial {q} that has all zeros in {E(r)} and satisfies {|q|>1} on the boundary of {E(r)}. The existence of such {q} shows {\gamma_0 < r}. Indeed, suppose that {p} is monic and {|p|\le 1} on {E(r)}. Consider the function {\displaystyle u(z) = \frac{\log|p(z)|}{\deg p} - \frac{\log|q(z)|}{\deg q}}. By construction {u<0} on the boundary of {E(r)}. Also, {u} is subharmonic in its complement, including {\infty}, where the singularities of both logarithms cancel out, leaving {u(\infty)=0}. This contradicts the maximum principle for subharmonic functions, according to which {u(\infty)} cannot exceed the maximum of {u} on the boundary.

The choice of {q(z) = z-1.42} works for {r=0.89}.


So we have {\gamma_0} boxed between 0.82 and 0.89; how to get more precise bounds? I don’t know how Pisot achieved the precision of 0.843… it’s possible that he strategically picked some linear and quadratic factors, raised them to variable integer powers and optimized the latter. Today it is too tempting to throw some optimization routine on the problem and let it run for a while.

But what to optimize? The straightforward approach is to minimize the maximum of {|p(e^z)|} on the circle {|z|=r}, approximated by sampling the function at a sufficiently fine uniform grid {\{z_k\}} and picking the maximal value. This works… unspectacularly. One problem is that the objective function is non-differentiable. Another is that taking maximum throws out a lot of information: we are not using the values at other sample points to better direct the search. After running optimization for days, trying different optimization methods, tolerance options, degrees of the polynomial, and starting values, I was not happy with the results…

Turns out, the optimization is much more effective if one minimizes the variance of the set {\{|p(\exp(z_k))|^2\}}. Now we are minimizing a polynomial function of {p(\exp(z_k)}, which pushes them toward having the same absolute value — the behavior that we want the polynomial to have. It took from seconds to minutes to produce the polynomials shown below, using BFGS method as implemented in SciPy.

As the arguments for optimization function I took the real and imaginary parts of the zeros of the polynomial. The symmetry about the real axis was enforced automatically: the polynomial was the product of quadratic terms {(z-x_k-iy_k) (z-x_k+iy_k)}. This eliminated the potentially useful option of having real zeros of odd order, but I did not feel like special-casing those.

Three digits

Degree 8, lower bound 0.843

Real part: 0.916, 1.186, 1.54, 1.783
Imaginary part: 0.399, 0.572, 0.502, 0.199

Here and below, only the zeros with positive imaginary part are listed (in the left-to-right order), the others being their conjugates.

Degree 10, upper bound 0.844

Real part: 0.878, 1.0673, 1.3626, 1.6514, 1.8277
Imaginary part: 0.3661, 0.5602, 0.6005, 0.4584, 0.171

Four digits

Degree 14, lower bound 0.8438

Real part: 0.8398, 0.9358, 1.1231, 1.357, 1.5899, 1.776, 1.8788
Imaginary part: 0.3135, 0.4999 ,0.6163, 0.637, 0.553, 0.3751, 0.1326

Degree 14, upper bound 0.8439

Real part: 0.8397, 0.9358, 1.1231, 1.3571, 1.5901, 1.7762, 1.879
Imaginary part: 0.3136, 0.5, 0.6164, 0.6372, 0.5531, 0.3751, 0.1326

No, I didn’t post the same picture twice. The polynomials are just that similar. But as the list of zeros shows, there are tiny differences…

Five digits

Degree 20, lower bound 0.84383

Real part: 0.81527, 0.8553, 0.96028, 1.1082, 1.28274, 1.46689, 1.63723, 1.76302, 1.82066, 1.86273
Imaginary part: 0.2686, 0.42952, 0.556, 0.63835, 0.66857, 0.63906, 0.54572, 0.39701, 0.23637, 0.08842

Degree 20, upper bound 0.84384

Real part: 0.81798, 0.85803, 0.95788, 1.09239, 1.25897, 1.44255, 1.61962, 1.76883, 1.86547, 1.89069
Imaginary part: 0.26631, 0.4234, 0.54324, 0.62676, 0.66903, 0.65366, 0.57719, 0.44358, 0.26486, 0.07896

Again, nearly the same polynomial works for upper and lower bounds. The fact that the absolute value of each of these polynomials is below 1 (for lower bounds) or greater than 1 (for upper bounds) can be ascertained by sampling them and using an upper estimate on the derivative; there is enough margin to trust computations with double precision.

Finally, the Python script I used. The function “obj” is getting minimized while function “values” returns the actual values of interest: the minimum and maximum of polynomial. The degree of polynomial is 2n, and the radius under consideration is r. The sample points are collected in array s. To begin with, the roots are chosen randomly. After minimization runs (inevitably, ending in a local minimum of which there are myriads), the new starting point is obtained by randomly perturbing the local minimum found. (The perturbation is smaller if minimization was particularly successful.)

import numpy as np
from scipy.optimize import minimize

def obj(r):
    rc = np.concatenate((r[:n]+1j*r[n:], r[:n]-1j*r[n:])).reshape(-1,1)
    p =**2, axis=0)
    return np.var(p)

def values(r):
    rc = np.concatenate((r[:n]+1j*r[n:], r[:n]-1j*r[n:])).reshape(-1,1)
    p =, axis=0)
    return [np.min(p), np.max(p)]

r = 0.84384
n = 10
record = 2 
s = np.exp(r * np.exp(1j*np.arange(0, np.pi, 0.01)))
xr = np.random.uniform(0.8, 1.8, size=(n,))
xi = np.random.uniform(0, 0.7, size=(n,))
x0 = np.concatenate((xr, xi))

while True:
    res = minimize(obj, x0, method = 'BFGS')
    if res['fun'] < record:
        record = res['fun']
        x0 = res['x'] + np.random.uniform(-0.001, 0.001, size=x0.shape)
        x0 = res['x'] + np.random.uniform(-0.05, 0.05, size=x0.shape)


Most popular topics on Stack Exchange sites

This is an attempt to create a bird’s eye-view picture of Stack Exchange network by picking the most-used tag on every site. The sites are ordered by their size, measured by the number of questions they have so far — so, newer sites are toward the bottom of the list. For each site, I included the description of its audience, as seen on the site list, and the description of the top tag. The tag name is linked to the page with more information, such as tag wiki, and the revision history with the list of contributors.

Stack Overflow

For professional and enthusiast programmers.

Top tag javascript: JavaScript (not to be confused with Java) is a dynamic, weakly-typed language used for both client-side and server-side scripting. Use this tag for questions regarding ECMAScript and its various dialects/implementations (excluding ActionScript and Google-Apps-Script). Unless another tag for a framework/library is also included, a pure JavaScript answer is expected.


For people studying math at any level and professionals in related fields.

Top tag calculus: For basic questions about limits, derivatives, integrals, and applications, mainly of one-variable functions.

Super User

For computer enthusiasts and power users.

Top tag windows-7: For questions specific to Windows 7. Use [windows] instead for questions involving Windows in general.

Ask Ubuntu

For Ubuntu users and developers.

Top tag 14.04: Fifth LTS (Long Term Support) release of Ubuntu, code-named “Trusty Tahr”. Released on 17th April, 2014. Will go End Of Life (EOL) April 2019. Only use this tag if your question is version-specific.

Server Fault

For system and network administrators.

Top tag linux: Linux is the generic term for a UNIX-like open source operating system based on the Linux kernel.

Stack Overflow на русском

For программистов.

Top tag php: PHP — скриптовый язык программирования общего назначения, активно применяемый для разработки веб-приложений. Используйте эту метку, если у Вас возникли вопросы по применению данного языка или о самом языке.

TeX – LaTeX

For users of TeX, LaTeX, ConTeXt, and related typesetting systems.

Top tag tikz-pgf: TikZ is a higher-level drawing language built on top of the PGF graphics framework. For questions specifically about the PGF layer use {pgf-core} instead. Both tags are possible on the same question. The tag {diagrams} is also compatible with this tag.

Unix & Linux

For users of Linux, FreeBSD and other Un*x-like operating systems.

Top tag linux: These questions are about Linux in general — NOT specific to a particular distribution. If the question just happens to be in a Linux environment, please specify your Linux distribution in the body of your question, but do NOT use the /linux tag.

Cross Validated

For people interested in statistics, machine learning, data analysis, data mining, and data visualization.

Top tag r: Use this tag for any *on-topic* question that (a) involves `R` either as a critical part of the question or expected answer, & (b) is not *just* about how to use `R`.


For active researchers, academics and students of physics.

Top tag quantum-mechanics: Quantum mechanics describes the microscopic properties of nature in a regime where classical mechanics no longer applies. It explains phenomena such as the wave-particle duality, quantization of energy and the uncertainty principle and is generally used in single body systems. Use the quantum-field-theory tag for the theory of many-body quantum-mechanical systems.

English Language & Usage

For linguists, etymologists, and serious English language enthusiasts.

Top tag single-word-requests: This tag is for questions seeking a single word that fits a meaning. To ensure your question is not closed as off-topic, please be specific about the intended use of the word. YOU MUST INCLUDE A SAMPLE SENTENCE demonstrating how the word would be used. Please use the “phrase-requests” tag instead if you seek more than just a single word.

Geographic Information Systems

For cartographers, geographers and GIS professionals.

Top tag qgis: QGIS is a cross-platform GIS application licensed under the GNU General Public License.

Ask Different

For power users of Apple hardware and software.

Top tag macos: macOS is the current marketing name for Apple’s Macintosh Operating System. This OS was previously known as OS X, and Mac OS X before that (which itself succeeded the ‘classic’ Mac OS).

Electrical Engineering

For electronics and electrical engineering professionals, students, and enthusiasts.

Top tag arduino: Be sure to use the Arduino Stack Exchange for questions that are more Arduino and less electronics.


For professional mathematicians.

Top tag ag.algebraic-geometry: for questions on algebraic geometry, including algebraic varieties, stacks, sheaves, schemes, moduli spaces, complex geometry, quantum cohomology.

WordPress Development

For WordPress developers and administrators.

Top tag custom-post-types: Custom Post Types extend the WordPress back-end to support additional, non-Post content.


For passionate videogamers on all platforms.

Top tag minecraft: Mojang’s exploration and survival based sandbox game in almost endless, procedurally generated worlds. This tag is for (vanilla) Minecraft on the PC. See the tag wiki for related tags. Please note that questions requesting technical support for modded Minecraft crash issues are off-topic.


For SharePoint enthusiasts.

Top tag 2013: For questions completely specific to all editions of SharePoint 2013 and **not past or future versions**

Stack Overflow em Português

For programadores profissionais e entusiastas.

Top tag php: PHP é uma linguagem de script interpretada do lado do servidor de código aberto, amplamente utilizada no desenvolvimento web. Use esta tag para perguntas sobre classes, métodos, funções, sintaxe e uso geral desta linguagem. Não use esta tag se o PHP é usado circunstancialmente mas não tem relação com o problema da pergunta.

Drupal Answers

For Drupal developers and administrators.

Top tag 7: Version tags should be used only when strictly necessary, for questions that apply to a version only, and not to merely say “I am using Drupal 7 in my site.”


For Salesforce administrators, implementation experts, developers and anybody in-between.

Top tag apex: Questions relating to Apex, the native programming language for the platform. Use it for general questions on syntax, errors, constructs, and rules of use. Most questions should include a code *excerpt* to help answerers understand specifically what has gone wrong or why you need help.


For users of the Magento e-Commerce platform.

Top tag magento-1.9: Magento Community version 1.9

Database Administrators

For database professionals who wish to improve their database skills and learn from others in the community.

Top tag sql-server: All versions of Microsoft SQL Server (not MySQL). Please also add a version-specific tag like sql-server-2016 if that is relevant to the question.

Software Engineering

For professionals, academics, and students working within the systems development life cycle.

Top tag java: Java is a high-level, platform-independent, object-oriented programming language originally developed by Sun Microsystems. Java is currently owned by Oracle, which purchased Sun in 2010.

Code Review

For peer programmer code reviews.

Top tag java: Java (not to be confused with JavaScript) is a class-based, object-oriented, strongly typed, reflective language and run-time environment (JRE). Java programs are compiled to bytecode and run in a virtual machine (JVM) enabling a “write once, run anywhere” (WORA) methodology.

Android Enthusiasts

For enthusiasts and power users of the Android operating system.

Top tag applications: For questions about Android apps in general. (If possible, use a specific application’s tag instead.) Note that Development is off-topic here.)


For users of Wolfram Mathematica.

Top tag plotting: Questions on creating visualizations from functions or data using high-level constructors such as Plot, ListPlot, Histogram, etc.

Science Fiction & Fantasy

For science fiction and fantasy enthusiasts.

Top tag story-identification: Use for help identifying a story and/or its creator(s), including novels, movies, comic books, entire TV series, etc. Use with another tag to specify which type of media, eg. [short-stories]. For identifying a single episode of a known series, whether TV, film, book, or comic, use [episode-identification].

Information Security

For information security professionals.

Top tag encryption: Encryption is the process of transforming plaintext using a cipher to make it unreadable to anyone except those possessing the key.

English Language Learners

For speakers of other languages learning English.

Top tag meaning: This tag is for questions which a dictionary cannot answer about what a word means. If the question is about the meaning of a word that can’t be understood outside its phrase or sentence, the “meaning-in-context” tag should be also used; for the meaning of a phrase, use the “phrase-meaning” tag instead.

Game Development

For professional and independent game developers.

Top tag unity: Unity is a cross-platform game creation system that focuses on easy art pipeline process. It consists of a game engine and an integrated development environment. The game engine’s scripting is built on Mono.

Home Improvement

For contractors and serious DIYers.

Top tag electrical: Distribution and use of electricity throughout the home. Electrical standards vary greatly worldwide, so providing your location in your question or your profile helps ensure you get answers that are relevant to you. Posting photographs of wiring junctions or drawing a wiring diagram and posting it is also highly recommended.


For people who use Blender to create 3D graphics, animations, or games.

Top tag python: Python is an object-oriented programming language. In Blender, it is used as a general purpose scripting language and to create add-ons to extend Blender’s functionality.


For pro webmasters.

Top tag seo: Search Engine Optimization (SEO) is the process of improving the visibility of web content in search engines using an understanding of search engines’ processes and algorithms. Also known as “natural” or “organic” search, it is distinct from paid web advertising.

Stack Overflow en español

For programadores y profesionales de la informática.

Top tag java: Java (no se debe confundir con JavaScript) es un lenguaje de programación de propósito general que soporta programación orientada a objetos. Para correr depende de una Máquina Virtual de Java (JVM). La Plataforma de Java es el nombre de un conjunto de herramientas para desarrollar y ejecutar programas de Java. Use esta etiqueta para preguntas referentes al lenguaje de programación Java o las herramientas de la plataforma de Java.


For road warriors and seasoned travelers.

Top tag visas: Token showing authorization to apply to enter the territory for which it was issued. Don’t forget to include your citizenship when asking!

User Experience

For user experience researchers and experts.

Top tag usability: The extent to which a product can be used by specified users to achieve specified goals with effectiveness, efficiency, and satisfaction in a specified context of use.

Mi Yodeya

For those who base their lives on Jewish law and tradition and anyone interested in learning more.

Top tag halacha: NOTE: Like Wikipedia, this site makes no guarantee of validity, and does not offer professional (particularly rabbinic) advice. Treat information from this site like it came from a crowd of your friends. // Jewish law. Specifically, the legal process beginning with the written Torah and continuing through the Mishna, Talmud, and the legal codes (e.g., Rambam, Tur, Shulchan Aruch).

Web Applications

For power users of web applications.

Top tag gmail: For questions about the Gmail service as accessed by a desktop or mobile browser. Questions about native smartphone apps are off-topic on Web Apps.


For scientists, academics, teachers and students.

Top tag organic-chemistry: Organic chemistry is the study of the structure and reactivity of organic molecules, typically containing carbon and hydrogen in addition to other elements. This tag should be applied to all questions relating to organic molecules and their properties (structure of organic molecules, spectroscopic properties, reaction mechanisms, stereochemistry etc), along with other suitable tags to help narrow down the scope of the question.

Role-playing Games

For gamemasters and players of tabletop, paper-and-pencil role-playing games.

Top tag dnd-5e: Dungeons & Dragons 5th edition, by Wizards of the Coast. D&D 5e is a heroic fantasy RPG inspired by the mechanics and settings of all previous D&D editions. Previously code-named D&D Next.

Graphic Design

For Graphic Design professionals, students, and enthusiasts.

Top tag adobe-photoshop: Questions about Photoshop, Adobe’s graphics and photo editing program. Ask anything related to designing graphics with Photoshop.

Computer Science

For students, researchers and practitioners of computer science.

Top tag algorithms: Questions related to design and analysis of algorithms


For academics and those enrolled in higher education.

Top tag publications: Questions related to academic publications including online and traditional journals, books, and conference proceedings.


For professional, enthusiast and amateur photographers.

Top tag lens: A photographic lens is used to focus the light onto film or a digital sensor. Many cameras have interchangeable lens systems, allowing the photographer to choose the type of lens to use.

Personal Finance & Money

For people who want to be financially literate.

Top tag united-states: For questions that relate to the laws, practices, and products of the United States.

Raspberry Pi

For users and developers of hardware and software for Raspberry Pi.

Top tag raspbian: Raspbian is a GNU/Linux operating system derived from Debian. Version numbering follows that of Debian and the current stable is 8 (Jessie). Raspbian is the most widely used Pi based distro and the one recommended by the Foundation, who distribute their own images of it.

Seasoned Advice

For professional and amateur chefs.

Top tag baking: Questions about cooking by dry heat without direct exposure to a flame, typically in an oven.

Movies & TV

For movie and tv enthusiasts.

Top tag plot-explanation: Seeking to understand a story plot better, or to clear up confusion about certain aspects or plot points.


For biology researchers, academics, and students.

Top tag human-biology: This tag is for questions about the general biological features of human beings (as opposed to the biology of non-humans).

The Workplace

For members of the workforce navigating the professional setting.

Top tag professionalism: Questions referring to how one presents themselves and interacts with others in a professional environment


For Bitcoin crypto-currency enthusiasts.

Top tag transactions: Transactions are signed messages regarding the transfer or generation of bitcoins. They are broadcasted through the network and, if accepted, integrated in the blockchain.


For software developers, mathematicians and others interested in cryptography.

Top tag encryption: Encryption is the process of transforming plaintext using a cipher into ciphertext to make it unreadable to anyone except those possessing the key. Decryption is the process of transforming that ciphertext back into plaintext, using the key.

Motor Vehicle Maintenance & Repair

For mechanics and DIY enthusiast owners of cars, trucks, and motorcycles.

Top tag engine: Internal Combustion Engine. Most engines in road going vehicles are 4-cycle internal combustion gasoline engines.

Japanese Language

For students, teachers, and linguists wanting to discuss the finer points of the Japanese language.

Top tag grammar: 文法. A collective term for syntax (the way sentences are put together) and morphology (forms of words, including the way new words are put together). Often used to describe function words such as particles, to describe word endings, and to talk about general sentence structure.

Software Recommendations

For people seeking specific software recommendations.

Top tag windows: Software to run on the Microsoft Windows family of operating systems.

Signal Processing

For practitioners of the art and science of signal, image and video processing.

Top tag image-processing: In general, image processing is any form of signal processing for which the input is an image, such as a photograph or video frame.


For writers/artists using science, geography and culture to construct imaginary worlds and settings.

Top tag science-based: For questions that require answers based on hard science, not magic or pseudo-science, but do not require scientific citations. Consider, alternatively, the hard-science and reality-check tags. Avoid using this tag as the only tag on a question.

ExpressionEngine® Answers

For administrators, end users, developers and designers for ExpressionEngine® CMS.

Top tag expresso-store: Exp:resso Store is an e-commerce module. You can find more details about Store at


For プログラマーとプログラミングに熱心の人.

Top tag javascript: JavaScriptとは、プログラミング言語のひとつである。Javaと名前が似ているが、異なるプログラミング言語である。

Русский язык

For лингвистов, этимологов, и энтузиастов русского языка.

Top tag пунктуация: Для вопросов, связанных со знаками препинания, а также пунктуационными правилами.


For developers of open-source hardware and software that is compatible with Arduino.

Top tag arduino-uno: The Arduino Uno is the most common of the Arduino boards. It is based on the ATmega328P microcontroller.


For those using, extending or developing Emacs.

Top tag org-mode: is an Emacs major mode for keeping notes, maintaining TODO lists, planning projects, and authoring documents with a fast and effective plain-text system. Because Org mode is a vast subject area, other tags must accompany the `org-mode` tag.

Music: Practice & Theory

For musicians, students, and enthusiasts.

Top tag guitar: For questions about guitar playing in general. For questions specifically about electric guitars, see “electric-guitar”. For questions specifically about acoustic guitars with or without pickup systems, see “acoustic-guitar”.


For people who build and repair bicycles, people who train cycling, or commute on bicycles.

Top tag road-bike: Bikes designed for road use only. Could be any road-only bike, but typically means bikes optimized for speed / racing / club rides with drop handlebars, narrow tires and a crouched-forward rider position.


For those who create, solve, and study puzzles.

Top tag riddle: A riddle gives indirect clues about an unnamed object or concept to be identified. It is often presented in the form of a poem.

Network Engineering

For network engineers.

Top tag cisco: Cisco is a major provider of networking equipment. Cisco devices often run IOS or NX-OS. This is a generic tag to be used when no more specific tags are available. See the partial list of tags in the full Tag Wiki.


For committed Christians, experts in Christianity and those interested in learning more.

Top tag catholicism: The Catholic Church and its teachings and views on specific subjects.


For aircraft pilots, mechanics, and enthusiasts.

Top tag aircraft-design: Aircraft Design describes the different choices that aircraft designers (typically aerospace engineers) make to create an aircraft.

Quantitative Finance

For finance professionals and academics.

Top tag options: A contract that gives the owner the right, but not the obligation, to buy or sell a security at a fixed price in the future.

Theoretical Computer Science

For theoretical computer scientists and researchers in related fields.

Top tag cc.complexity-theory: P versus NP and other resource-bounded computation.

German Language

For speakers of German wanting to discuss the finer points of the language and translation.

Top tag meaning: Bedeutung – Questions on definitions and nuances of words, phrases or sentences.


For those interested in the study of the fundamental nature of knowledge, reality, and existence.

Top tag logic: Logic is the study of formal systems of reasoning, especially of the deductive variety. It is one of the few fundamental philosophical subdisciplines, along with metaphysics, ontology and aesthetics. Logic has taken on considerable importance in recent mathematical developments, and one of the concerns of [tag:philosophy-of-mathematics] involves the role, extent and conceptual architecture of various kinds of logical or formal axiomatic systems.

Board & Card Games

For people who like playing board games, designing board games or modifying the rules of existing board games.

Top tag magic-the-gathering: Magic: The Gathering is a collectible card game for 2 or more players, set in a variety of fantastical realms. The cards represent the player’s resources and available spells and their interactions lead to an often high paced battle of wits.

Sound Design

For sound engineers, producers, editors, and enthusiasts.

Top tag pro-tools: AVID produced DAW. Use this tag for general questions regarding Pro Tools.

Anime & Manga

For anime and manga fans.

Top tag naruto: Naruto is a shounen manga/anime by Masashi Kishimoto about the young ninja Uzumaki Naruto who strives to become the “Hokage”, the leader of his village.

Programming Puzzles & Code Golf

For programming puzzle enthusiasts and code golfers.

Top tag code-golf: Code-golf is a competition to solve a particular problem in the fewest bytes of source code. If you want to score by characters instead of bytes, please state this explicitly in the challenge. If source code length is not the primary scoring criterion, consider using another tag instead.


For scientific skepticism.

Top tag medical-science: Use this tag for questions about the science of medicine and its practices. Use [medications] for questions about the actual cures that people take, and use [alternative-medicine] for claims about cures and practices which are claimed to be alternative to official medical science

Gardening & Landscaping

For gardeners and landscapers.

Top tag identification: Use this tag for questions that ask “what is this thing?” Pictures are helpful, as are descriptive titles. When you get an answer, consider adding a further tag (for the flower, tree, beetle etc that has been identified) so that your question is cataloged correctly. If the question is about determining the cause of a plant problem (e.g. disease), the diagnosis tag is more appropriate.

Craft CMS

For administrators, end users, developers and designers for Craft CMS.

Top tag plugin-development: Questions having to do with constructing plugins.


For Muslims, experts in Islam, and those interested in learning more about Islam.

Top tag sharia: Sharia (Islamic Law) based on the teachings of the Qur’an and Sunnah.


For historians and history buffs.

Top tag united-states: The United States of America is a nation-state stretching across North America between Canada and Mexico, plus Alaska in the continent’s northwest, the mid-Pacific archipelago of Hawaii and several territories in the Pacific & Caribbean. Founded by European émigrés rebelling from British control in the 1700s, the US spread across the continent by conquest and land-purchase to become the most powerful country on the planet after the Cold War in the 1900s.

Physical Fitness

For physical fitness professionals, athletes, trainers, and those providing health-related needs.

Top tag running: Moving rapidly on foot. Questions are about proper running form, race preparation, measuring the benefits and avoiding the pitfalls of running.

Computational Science

For scientists using computers to solve scientific problems.

Top tag linear-algebra: Questions on the algorithmic/computational aspects of linear algebra, including the solution of linear systems, least squares problems, eigenproblems, and other such matters.


For administrators and users of the CiviCRM Constituent Relationship Management software.

Top tag wordpress: Questions specific to CiviCRM installed on WordPress.


For users of Ethereum, the decentralized application platform and smart contract enabled blockchain.

Top tag go-ethereum: Go Ethereum (short: Geth) is a Golang implementation of the Ethereum protocol.


For legal professionals, students, and others with experience or interest in law.

Top tag united-states: For questions specific to the United States as a whole, or that span multiple state jurisdictions.

Software Quality Assurance & Testing

For software quality control experts, automation engineers, and software testers.

Top tag automated-testing: Use for questions involving problems with automated tests. Relevant for designing test automation, debugging test automation, automation tooling questions, and questions about when it is appropriate to automate. Questions regarding specific tools should tag those tools as well.

French Language

For students, teachers, and linguists wanting to discuss the finer points of the French language.

Top tag grammaire: La grammaire est l’étude systématique des éléments constitutifs d’une langue.

Space Exploration

For spacecraft operators, scientists, engineers, and enthusiasts.

Top tag launch: Questions regarding the takeoff or the liftoff phase of the flight of a rocket and the set of activities required for preparation of the launch vehicle leading to it.

Data Science

For Data science professionals, Machine Learning specialists, and those interested in learning more about the field.

Top tag machine-learning: Methods and principles of building “computer systems that automatically improve with experience.”


For Tridion developers and administrators.

Top tag 2011: This tag is for questions specific to SDL Tridion 2011. Version tags should be used **only** when necessary to provide context to the question, and not to simply state that “you are using SDL Tridion 2011” unless that information is needed. A Service Pack and Hotfix Rollup was issued for this version in mid 2012.


For authors, editors, reviewers, professional writers, and aspiring writers.

Top tag fiction: Fiction is a form of prose writing that deals with at least partly artificial or imagined events and characters. This tag should be used for any questions relating to fiction, including fiction formatting and technique, fiction critiques, and the publishing of fiction.


For professional linguists and others with an interest in linguistic research and theory.

Top tag syntax: The study of the internal structure of expressions, especially between words and phrases, and the principles and processes that determine it. This includes words order, but also the grammatical relations that hold between words, as well as structural ambiguity, binding, reference, and similar issues. Common approaches are numerous phrase structure grammars (GPSG, HPSG, LFG, G&B, X-bar, Minimalism, …) and, on the other hand, dependency grammars.


For followers of the Hindu religion and those interested in learning more about Hinduism.

Top tag mythology: For questions about stories that are part of Hindu religious beliefs. Hindu mythology can be found throughout Hindu scriptures like the Vedas, Puranas, Ramayana, and Mahabharata.


For parents, grandparents, nannies and others with a parenting role.

Top tag toddler: Age specific questions from about 1 year to about 3 years. Younger: infant. Older: pre-schooler.

Video Production

For engineers, producers, editors, and enthusiasts spanning the fields of video, and media creation.

Top tag video: Video is the technology of electronically manipulating still images that represent motion.


For Joomla! administrators, users, developers and designers.

Top tag joomla-3.x: For question regarding Joomla 3.x of the Content Management System. This includes versions 3.0 up to 3.6


For professional and academic economists and analysts.

Top tag macroeconomics: Macroeconomics is a branch of economics dealing with the aggregate economy as a whole, rather than individual markets.


For dedicated home brewers and serious enthusiasts.

Top tag fermentation: The anaerobic process by which yeast convert sugars into alcohol and carbon dioxide.


For astronomers and astrophysicists.

Top tag star: Questions regarding large spheres of plasma undergoing fusion.

Cognitive Sciences

For practitioners, researchers, and students in cognitive science, psychology, neuroscience, and psychiatry.

Top tag cognitive-psychology: For questions focusing on the interaction of many internal mental processes. If your question involves only one of memory, attention, language, decision-making, or perception then use the associated specialized tag instead of cognitive-psychology.

elementary OS

For developers and users of elementary OS and applications.

Top tag release-loki: Questions specific to elementary OS 0.4, codenamed “Loki”. Loki is the current stable version of elementary OS.

Chinese Language

For students, teachers, and linguists wanting to discuss the finer points of the Chinese language.

Top tag translation: Questions on specific points regarding translating Chinese to/from another language. Do your own research first!


For people interested in governments, policies, and political processes.

Top tag united-states: The United States of America is a Constitutional Republic located primarily between the Pacific and Atlantic Oceans in the middle of North America. The United States is a federal representative democracy consisting of 50 individual states, each with their own semi-autonomous government. At the national level, the government consists of a bicameral legislature (the Senate and the House of Representatives), a President, and independent Supreme Court.

Biblical Hermeneutics

For professors, theologians, and those interested in exegetical analysis of biblical texts.

Top tag greek: Koiné (from κοινή, “common”) Greek was the form of post-classical Greek spoken and written in Hellenistic and Roman antiquity. It is the language of the Septuagint (LXX), Christian New Testament, and most early Christian theological writings.

Vi and Vim

For people using the vi and Vim families of text editors.

Top tag vimrc: Vim reads initialization commands from a file called vimrc on startup. This can be used to set settings, define functions, execute autocommands, and more.

Spanish Language

For students, teachers, and linguists wanting to discuss the finer points of the Spanish language.

Top tag traducción: Preguntas sobre traducciones y adaptaciones de frases, palabras, términos y conceptos de otras idiomas al idioma español. Questions about translations or adaptations of sentences, words, terms and concepts from other languages into Spanish.


For professionals and students of engineering.

Top tag mechanical-engineering: Questions within the problem domain of mechanical engineering. Mechanical Engineering can be a broad field; consider choosing more specific tags if they apply.

Reverse Engineering

For researchers and developers who explore the principles of a system through analysis of its structure, function, and operation.

Top tag ida: Interactive Disassembler Professional (IDA Pro), a proprietary multi-platform disassembler by Hex-Rays.


For researchers, developers, and users of Tor.

Top tag tor-browser-bundle: The Tor Browser Bundle lets you use Tor without needing to install any software by pairing Firefox and Vidalia.


For medical specialists, students, dietitians, and anyone with health-related questions.

Top tag nutrition: Questions relating to the intake, safety, effects of nutrients, and their biochemical interactions with our body.


For pet owners, caretakers, breeders, veterinarians, and trainers.

Top tag cats: Small, furry (usually), domesticated members of the feline family.

Project Management

For project managers.

Top tag scrum: For questions about using or implementing the Scrum framework.


For people practicing or interested in Buddhist philosophy, teaching, and practice.

Top tag personal-practice: Questions containing or motivated by some aspect of personal experience. The experience can be during formal Buddhist practice or during everyday activity however the experience will be related to Buddhist practice or doctrine. The questions will necessarily have a subjective quality however the question or answers will contain references to Buddhist scripture, doctrine or an established teacher.

The Great Outdoors

For people who love outdoor activities, excursions, and outdoorsmanship.

Top tag gear: Whenever applicable use a more specific tag like backpack, shoes, stoves, tents, … Only questions that do not fit into such a tag and are related to any physical gear for engaging in those activities discussed in The Great Outdoors should use the equipment tag.

Open Data

For developers and researchers interested in open data.

Top tag data-request: Indicates a request for relevant open data sources. Please read for writing a good request.


For participants in team and individual sport activities.

Top tag rules: Questions about the rules of sports, including regulations for particular competitions or formats. Questions must also be tagged for the specific sport or competition.


For serious players and enthusiasts of chess.

Top tag opening: Questions relating to the first few moves in a game

Windows Phone

For enthusiasts and power users of Windows Phone OS.

Top tag 8.1: Questions relating to features introduced in Windows Phone 8.1


For professional robotic engineers, hobbyists, researchers and students.

Top tag arduino: Arduino is an open-source electronics prototyping platform based on flexible, easy-to-use hardware and software. It’s intended for artists, designers, hobbyists, and anyone interested in creating interactive objects or environments.


For people living abroad on a long-term basis.

Top tag usa: Questions regarding emigrating from, immigrating to and living in the United States of America

Ask Patents

For people interested in improving and participating in the patent system.

Top tag patentability: For questions relating to the legal requirements necessary for applications to be granted a patent.
Please include a tag relating to the relevant type of intellectual property protection you are asking about. There are invention patents, design patents and utility models. For an explanation of the differences, read the full tag description.


For entrepreneurs faced with delivering a new product or service under conditions of significant uncertainty.

Top tag legal: Questions about legality related to the startup.

Earth Science

For those interested in the geology, meteorology, oceanography, and environmental sciences.

Top tag meteorology: Meteorology is the study of how the earth’s atmosphere works, including weather forecasting. Use this tag for questions about the earth’s weather. When asking questions specifically about the atmosphere, also include the [atmosphere] tag.

Russian Language

For students, teachers, and linguists wanting to discuss the finer points of the Russian language.

Top tag перевод: All questions about translation of words, phrases, idioms or collocations from English to Russian. Read the FAQ section about translations.

Personal Productivity

For people wanting to improve their personal productivity.

Top tag time-management: Questions regarding how to handle the use of time in one’s life.

Stack Apps

For apps, scripts, and development with the Stack Exchange API.

Top tag support: You need help with the use of the Stack Exchange API, apps built on the API, or assistance building scripts that work on Stack Exchange websites.


For developers and end users of the Sitecore CMS and multichannel marketing software.

Top tag xdb: For questions relating to the Sitecore Experience Database (xDB). If you’re using Sitecore 7.2 or earlier, use the `dms` tag instead.


For LEGO® and building block enthusiasts.

Top tag ev3: EV3 is the current generation of LEGO MINDSTORMS, released in 2013.

Genealogy & Family History

For expert genealogists and people interested in genealogy or family history.

Top tag united-states: For questions about ancestors and records in the USA. This includes previous political entities within the geographical boundaries of the present-day USA, such as the relevant European colonies. Also tag the state if the question is specific to that state.


For people looking to bypass life’s everyday problems with simple tricks.

Top tag cleaning: Tips and tricks relating to cleaning clothing, objects etc. quickly and easily. Please also use another applicable tag (e.g., [clothing], [kitchen], etc.), as THIS TAG IS AMBIGUOUS.

Mathematics Educators

For those involved in the field of teaching mathematics.

Top tag undergraduate-education: For questions about teaching students at the undergraduate (university) level.

Italian Language

For students, teachers, and linguists wanting to discuss the finer points of the Italian language.

Top tag word-usage: Questions about correctly using a word within a particular phrase or context


For professional and amateur woodworkers.

Top tag finishing: Finishing a woodworking project refers to the final steps to beautify and preserve it.

Amateur Radio

For amateur radio enthusiasts.

Top tag antenna: Questions about the design, selection, building, testing, mounting, or properties of antennas. See also specific tags: [antenna-theory], [antenna-construction], [dipole], etc.

Hardware Recommendations

For people seeking specific hardware recommendations.

Top tag laptop: Use this tag when requesting information about laptops or notebook computers. These devices have an integrated hardware keyboard and screen.


For developers and users of the secure, private and untraceable cryptocurrency Monero.

Top tag monero-wallet-cli: Name of official command line wallet available for Monero on Linux, Window and MacOS

History of Science and Mathematics

For people interested in the history and origins of science and mathematics.

Top tag mathematics: For questions about the quantitative study of topics such as numbers, structure, space, and change, carried out by investigating patterns.

Music Fans

For music historians, critics, and fans.

Top tag identify-this-song: For questions looking to identify a song. Be sure to include enough information (lyric snippets, a good quality sound clip, etc.) for someone to be able to identify it.

Open Source

For people organizing, marketing or licensing open source development projects.

Top tag licensing: Licensing refers to applying a license to an area of software. Only use this tag if your question concerns the application of a license to an area of interest. If your question concerns a specific license, use the tag that corresponds to your license. For more general questions, use this tag.


For self-employed and freelance workers.

Top tag contracts: Questions concerning contracts between a freelancer, agent and a client.

Latin Language

For linguists, teachers, and students wanting to discuss the finer points of the Latin language.

Top tag classical-latin: Questions concerning Latin of the classical era, approximately 75 BC to AD 300

Computer Graphics

For computer graphics researchers and programmers.

Top tag opengl: For questions involving use of the OpenGL graphics library.


For serious players and enthusiasts of poker.

Top tag texas-hold-em: Texas Hold’Em is a poker variant in which each player receives two cards (hole cards) that are dealt face down and then five community cards are dealt face-up by the dealer. All players may use their hole cards and the five community cards to make their best five-card poker high hand.

Martial Arts

For students and teachers of all martial arts.

Top tag training: The practice of martial arts. How, what, where, when, why.

Portuguese Language

For linguists, teachers and learners wanting to discuss the finer points of the Portuguese language.

Top tag significado: Para questões sobre o significado de uma palavra ou expressão, para saber o que quer dizer. For questions about the meaning of a word or expression, to know what things mean.

Sustainable Living

For folks dedicated to a lifestyle that can be maintained indefinitely without depleting available resources.

Top tag recycling: using materials that would otherwise be waste to manufacture new materials. For questions specifically on [upcycling] use that tag, for questions on [reuse] use that tag.


For ebook publishers and readers.

Top tag kindle: A brand of e-book readers and tablet devices produced by Amazon.

Esperanto Language

For teachers and students of the Esperanto language.

Top tag single-word-requests: Use this tag when you are searching for a word in order to express a specific meaning.

3D Printing

For 3D printing enthusiasts.

Top tag filament: For questions related to different filaments used as the print material.


For scholars and enthusiasts of literature.

Top tag symbolism: For questions concerning symbolic features in a work of literature.


For enthusiasts and scholars of mythology.

Top tag greek: For questions about Greek mythology and legends, from ancient Greece to the present day.


For vintage-computer hobbyists interested in restoring, preserving, and using the classic computer and gaming systems of yesteryear.

Top tag hardware: For questions about the components of retro devices (computers, etc.)


For people interested in all aspects of producing and consuming coffee.

Top tag brewing-process: Questions on the process of turning coffee beans into a beverage.

Artificial Intelligence

For people interested in conceptual questions about life and challenges in a world where “cognitive” functions can be mimicked in purely digital environment.

Top tag neural-networks: For questions about an artificial neural network (ANN), a network inspired by biological networks, which are used to estimate or approximate functions.

Beer, Wine & Spirits

For alcoholic beverage aficionados and those interested in beer, wine, or spirits.

Top tag taste: Questions about flavor and how it is influenced by various factors such as temperature and glassware.

Arts & Crafts

For artists and crafters.

Top tag drawing: For questions about the use of pens, pencils, chalk, etc. to create images or patterns on a 2-D surface.

Korean Language

For linguists, teachers and students of the Korean language.

Top tag grammar: Questions about the rules that govern and structure the language, and the composition of clauses, phrases and sentences. Also pertains to the syntax and morphology of the Korean language.

Ukrainian Language

For linguists, teachers and students of the Ukrainian language.

Top tag переклад: Для запитань про українські еквіваленти іншомовних слів // For questions about the Ukrainian equivalents of foreign-language words

Language Learning

For students, teachers, polyglots, and anyone interested in the techniques of second-language acquisition.

Top tag learning-methods: For questions about methods, techniques, and/or practices that assist in learning another language

Community Building

For community managers, administrators, and moderators.

Top tag user-behavior: Questions about user behavior, reactions to moderator decisions and other actions they take within the community.

Internet of Things

For users of everyday objects embedded with electronics to be sensed, monitored, and controlled remotely.

Top tag smart-home: For questions about any smart devices and services that help automate or remote control one’s home. Prominent examples are lights, home appliances, roller shutters and radiators.


For software engineers working on automated testing, continuous delivery, service integration and monitoring, and building SDLC infrastructure.

Top tag jenkins: For questions about Jenkins, an open source automation server, and using Jenkins for topics such as building, testing, and deploying software, etc. For questions specifically about Jenkins Plugins use the jenkins-plugins tag.


For those committed to a vegan or vegetarian lifestyle and anyone interested in learning more.

Top tag veganism: In addition to being vegetarian (do not eat meat, poultry, or fish), vegans do not consume or use any animal products (such as eggs, milk, leather, honey, etc.)

Multipliers preserving series convergence

The Comparison Test shows that if {\sum a_n} is an absolutely convergent series, and {\{b_n\}} is a bounded sequence, then {\sum a_nb_n} converges absolutely. Indeed, {|a_nb_n|\le M|a_n|} where {M} is such that {|b_n|\le M} for all {n}.

With a bit more effort one can prove that this property of preserving absolute convergence is equivalent to being a bounded sequence. Indeed, if {\{b_n\}} is unbounded, then for every {k} there is {n_k} such that {|b_{n_k}|\ge 2^k}. We can ensure {n_k > n_{k-1}} since there are infinitely many candidates for {n_k}. Define {a_n=2^{-k}} if {n = n_k} for some {k}, and {a_n=0} otherwise. Then {\sum a_n} converges but {\sum a_nb_n} diverges because its terms do not approach zero.

What if we drop “absolutely”? Let’s say that a sequence {\{b_n\}} preserves convergence of series if for every convergent series {\sum a_n}, the series {\sum a_n b_n} also converges. Being bounded doesn’t imply this property: for example, {b_n=(-1)^n} does not preserve convergence of the series {\sum (-1)^n/n}.

Theorem. A sequence {\{b_n\}} preserves convergence of series if and only if it has bounded variation, meaning {\sum |b_n-b_{n+1}| } converges.

For brevity, let’s say that {\{b_n\}} is BV. Every bounded monotone sequence is BV because the sum {\sum |b_n-b_{n+1}| } telescopes. On the other hand, {(-1)^n} is not BV, and neither is {(-1)^n/n}. But {(-1)^n/n^p} is for {p>1}. The following lemma describes the structure of BV sequences.

Lemma 1. A sequence {\{b_n\}} is BV if and only if there are two increasing bounded sequences {\{c_n\}} and {\{d_n\}} such that {b_n=c_n-d_n} for all {n}.

Proof. If such {c_n,d_n} exist, then by the triangle inequality \displaystyle \sum_{n=1}^N |b_n-b_{n+1}| = \sum_{n=1}^N (|c_n-c_{n +1}| + |d_{n+1}-d_n|) = \sum_{n=1}^N (c_{n+1}-c_n) + \sum_{n=1}^N (d_{n+1}-d_n) and the latter sums telescope to {c_{N+1}-c_1 + d_{N+1}-d_1} which has a limit as {N\rightarrow\infty} since bounded monotone sequences converge.

Conversely, suppose {\{b_n\}} is BV. Let {c_n = \sum_{k=1}^{n-1}|b_k-b_{k+1}|}, understanding that {c_1=0}. By construction, the sequence {\{c_n\}} is increasing and bounded. Also let {d_n=c_n-b_n}; as a difference of bounded sequences, this is bounded too. Finally,

\displaystyle d_{n+1}-d_n = c_{n+1} -c_n + b_n - b_{n+1} = |b_n-b_{n+1}|+ b_n - b_{n+1} \ge 0

which shows that {\{d_n\}} is increasing.

To construct a suitable example where {\sum a_nb_n} diverges, we need another lemma.

Lemma 2. If a series of nonnegative terms {\sum A_n} diverges, then there is a sequence {c_n\rightarrow 0} such that the series {\sum c_n A_n} still diverges.

Proof. Let {s_n = A_1+\dots+A_n} (partial sums); then {A_n=s_n-s_{n-1}}. The sequence {\sqrt{s_n}} tends to infinity, but slower than {s_n} itself. Let {c_n=1/(\sqrt{s_n}+\sqrt{s_{n-1}})}, so that {c_nA_n = \sqrt{s_n}-\sqrt{s_{n-1}}}, and we are done: the partial sums of {\sum c_nA_n} telescope to {\sqrt{s_n}}.

Proof of the theorem, Sufficiency part. Suppose {\{b_n\}} is BV. Using Lemma 1, write {b_n=c_n-d_n}. Since {a_nb_n = a_nc_n - a_n d_n}, it suffices to prove that {\sum a_nc_n} and {\sum a_nd_n} converge. Consider the first one; the proof for the other is the same. Let {L=\lim c_n} and write {a_nc_n = La_n - a_n(L-c_n)}. Here {\sum La_n} converges as a constant multiple of {\sum a_n}. Also, {\sum a_n(L-c_n)} converges by the Dirichlet test: the partial sums of {\sum a_n} are bounded, and {L-c_n} decreases to zero.

Proof of the theorem, Necessity part. Suppose {\{b_n\}} is not BV. The goal is to find a convergent series {\sum a_n} such that {\sum a_nb_n} diverges. If {\{b_n\}} is not bounded, then we can proceed as in the case of absolute convergence, considered above. So let’s assume {\{b_n\}} is bounded.

Since {\sum_{n=1}^\infty |b_n-b_{n+1}|} diverges, by Lemma 2 there exists {\{c_n\} } such that {c_n\rightarrow 0} and {\sum_{n=1}^\infty c_n|b_n-b_{n+1}|} diverges. Let {d_n} be such that {d_n(b_n-b_{n+1}) = c_n|b_n-b_{n+1}|}; that is, {d_n} differs from {c_n} only by sign. In particular, {d_n\rightarrow 0}. Summation by parts yields

\displaystyle { \sum_{n=1}^N d_n(b_n-b_{n+1}) = \sum_{n=2}^N (d_{n}-d_{n-1})b_n + d_1b_1-d_Nb_{N+1} }

As {N\rightarrow\infty}, the left hand side of does not have a limit since {\sum d_n(b_n-b_{n+1})} diverges. On the other hand, {d_1b_1-d_Nb_{N+1}\rightarrow d_1b_1} since {d_N\rightarrow 0} while {b_{N+1}} stays bounded. Therefore, {\lim_{N\rightarrow\infty} \sum_{n=2}^N (d_{n}-d_{n-1})b_n} does not exist.

Let {a_n= d_n-d_{n-1}}. The series {\sum a_n} converges (by telescoping, since {\lim_{n\rightarrow\infty} d_n} exists) but {\sum a_nb_n} diverges, as shown above.

In terms of functional analysis the preservation of absolute convergence is essentially the statement that {(\ell_1)^* = \ell_\infty}. Notably, the {\ell_\infty} norm of {\{b_n\}}, i.e., {\sup |b_n|}, is the number that controls by how much {\sum |a_nb_n|} can exceed {\sum |a_n|}.

I don’t have a similar quantitative statement for the case of convergence. The BV space has a natural norm too, {\sum |b_n-b_{n-1}|} (interpreting {b_0} as {0}), but it’s not obvious how to relate this norm to the values of the sums {\sum a_n} and {\sum a_nb_n}.