Probability – mutual independence lacking pairwise independence?

Suppose P(A∩B∩C) = P(A)P(B)P(C) and A,B are independent, B,C are independent but nothing was given about A and C.

Can you still assume A,B,C are independent?

I looked up mutual independence, and it told me that A and C being independent must also hold in order to claim that all three events are independent. So I was trying to come up with a simple coin toss or rolling a die type of counterexample, but couldn’t form one up. Can someone help formulate one, or am I missing something here?

permutation – How to get the complete list of subsets the pairwise intersections of which are empty

Given the list Range(6). I want to get the sublists of length 2 where each element has length 2 and the pairwise intersections are empty. So I am looking for:

  {{{1, 2}, {3, 4}}, {{1, 3}, {2, 4}}, {{1, 4}, {2, 3}}}

Switched elements like {{1,2},{4,3}} should not appear. My code works well but when Range and lengths get bigger it consumes a lot of space and time. For sublists of length 3 with two elements the result
would look like:

    {{{1, 2}, {3, 4}, {5, 6}}, {{1, 2}, {3, 5}, {4, 6}}, {{1, 2}, {3, 
   6}, {4, 5}}, {{1, 3}, {2, 4}, {5, 6}}, {{1, 3}, {2, 5}, {4, 
   6}}, {{1, 3}, {2, 6}, {4, 5}}, {{1, 4}, {2, 3}, {5, 6}}, {{1, 
   4}, {2, 5}, {3, 6}}, {{1, 4}, {2, 6}, {3, 5}}, {{1, 5}, {2, 3}, {4,
    6}}, {{1, 5}, {2, 4}, {3, 6}}, {{1, 5}, {2, 6}, {3, 4}}, {{1, 
   6}, {2, 3}, {4, 5}}, {{1, 6}, {2, 4}, {3, 5}}, {{1, 6}, {2, 5}, {3,
    4}}}

Is there a function (maybe in Combinatorica) for this problem or a smarter way to do it? I am sure this is a standard problem and there must be a name for this kind of sublist. I would be grateful for further hints.

Here is my code:

k = 3;
t1 = Partition(#, {2}) & /@ Permutations(Range(2 k))
t2 = Map(Sort, t1, {2})
t3 = Map(Sort, t2, {1})
t4 = DeleteDuplicates(t3)

real analysis – What unary operation on sequences produces the sequence of pairwise sums?

Given a sequence $(a, b, c,…)$:

  • The partial difference operator produces the sequence $(b-a, c-b, …)$, and
  • The partial summation operator produces the sequence $(a, a+b, a+b+c, … )$

According to a section in the Wikipedia page on series.

What about the sequence $(a+b, b+c, c+d, …)$?

Is there a formal name for the operator that produces this one?

beginner – Pairwise summation in Haskell, take two

Here’s my second try at pairwise summation in Haskell:

pairwiseSum :: (Num a) => (a) -> a
pairwiseSum () = 0
pairwiseSum (x) = x
pairwiseSum x = pairwiseSum (sumPairs x)

sumPairs :: (Num a) => (a) -> (a)
sumPairs () = ()
sumPairs (x) = (x)
sumPairs (x:y:xs) = ((x + y) : sumPairs xs)

I ran both versions on pairwiseSum (map exp (1,0.9999..(-56.0))), and this one’s noticeably faster. Is it well written?

ETA: here are some runs comparing pairwiseSum with sum :

*Main> pairwiseSum (map exp (1,0.9999..(-56.0)))
27184.177448160026
*Main> sum (map exp (1,0.9999..(-56.0)))
27184.177448147617
*Main> pairwiseSum (map exp (1,0.99999..(-56.0)))
271829.5419903211
*Main> sum (map exp (1,0.99999..(-56.0)))
271829.54198831413

The previous version of pairwiseSum gave 27184.177448160022 as the sum of the first list. On the second, I counted to 13 while pairwiseSum ran and to 11 while sum ran.

beginner – Pairwise summation in Haskell

I’m new to Haskell, and I figured that pairwise summation is something I could do easily. I wrote this:

pairwiseSum :: (Num a) => (a) -> a
pairwiseSum () = 0
pairwiseSum (x) = x
pairwiseSum (x:xs) = (pairwiseSum (everyOther (x:xs))) + (pairwiseSum (everyOther xs))

everyOther :: (a) -> (a)
everyOther () = ()
everyOther (x) = (x)
everyOther (x:_:xs) = x : everyOther xs

Given (0,1,2,3,4,5,6,7), this computes (((0+4)+(2+6))+((1+5)+(3+7))), whereas my C(++) code computes (((0+1)+(2+3))+((4+5)+(6+7))). How does this affect optimization?

How easy is it to read? Could it be written better?

How can I test it? I have three tests in C++:

  • add the odd numbers (1,3..(2*n-1) and check that the sum is n²;
  • add 100000 copies of 1, 100000 copies of 0.001, … 100000 copies of 10^-18 and check for the correct sum;
  • add 0x36000 terms of a geometric progression with ratio exp(1/4096).

To test execution time, I use 1000000 copies and 16 times as many terms of exp(1/65536).

discrete geometry – Number of regions created by all pairwise bisecting hyperplanes between $n$ points

Let ${P_i}$ be $n$ distinct points in a $d$-dimensional Euclidean space. For every pair $(P_i, P_j)$ with $i ne j$, we can construct a perpendicular bisecting hyperplane equidistant between the two points, which splits the space into two regions. We can construct $n(n-1)/2$ such cuts, splitting the region into $N$ pieces.

Question: What is the maximum number of regions $N(d,n)$ that can be produced in this way?

This is a similar but more restricted version of the lazy caterer/cake number problem (generalized to higher dimensions), because the pairwise, equidistant, perpendicular bisector constraint prevents certain cuts from existing.

  • If $d = 1$, we actually do get the lazy caterer’s sequence: with $n(n-1)/2$ cuts we can construct $N(1,n) = n(n-1)/2 + 1$ regions.

  • If $d = 2$, we have $N(2,1) = 1$ and $N(2,2) = 2$ trivially. For $n = 3$, the three points form a triangle, and by construction the cuts always meet at the triangle’s orthocenter, so we get $N(2,3) = 6$, and not 7 regions as in the lazy caterer sequence. This is an example of how this problem differs from most questions I keep finding along these lines. I am almost sure $N(2,4) = 18$ and $N(2,5) = 46$, but I couldn’t prove it.

  • In general, if I didn’t mess it up, it seems $N(d,d+1) = (d+1)!$, because one can always construct a simplex to generalize the orthocenter idea.

I’ve been working on this on and off for a few weeks now, but I’m haven’t come up with a good argument for the general case. Any pointers? I would have figured this sort of problem would have been solved somewhere at this point, but I my search hasn’t come up with anything.

This problem may have interesting applications in social choice theory, which is how I ended up at it.

performance tuning – Pair-wise equality over large sets of large vectors

I’ve got an interesting performance tuning/algorithmic problem that I’m running into in an optimization context.

I’ve got a set of ~16-50 lists of integers (usually in Range(0, 5) but no restricted to that).
The data might look like this (although obviously not random)

maxQ = 5;
ndim = 16;
nstates = 100000;
braVecs = RandomInteger({0, maxQ}, {ndim, nstates});
ketVecs = braVecs + RandomInteger({0, 1}, {ndim, nstates});

now for every element q ∈ Subsets(ndim, 4) I need to determine where every pair of braVecs and ketVecs are the same, except for the indices in q, i.e. I for every possible q I need to calculate this

qComp = Complement(Range(ndim), q);
diffs = braVecs((qComp)) - ketVecs((qComp));
Pick(Range(nstates), Times @@ (1 - Unitize(diffs)), 1)

Just as an example, this is the kind of thing I expect to get out

q = RandomSample(Range(ndim), 4);
qComp = Complement(Range(ndim), q);
diffs = braVecs((qComp)) - ketVecs((qComp));
{q, Pick(Range(nstates), Times @@ (1 - Unitize(diffs)), 1)}

{{2, 9, 6, 4}, {825, 1993, 5577, 5666, 9690, 9856, 11502, 13515, 15680, 18570, 
  19207, 23131, 26986, 27269, 31889, 39396, 39942, 51688, 52520, 54905, 55360, 
  60180, 61682, 66258, 66458, 68742, 71871, 78489, 80906, 90275, 91520, 93184}}

This can obviously be done just by looping, but I sure there is an algorithmically more efficient way to do this, maybe using a Trie or maybe using some Boolean algebra to reuse prior calculations? This is important because my ndim can get up to ~50 and there are a huge number of elements in Subsets(50, 4)… I just don’t know what the best way to approach this kind of thing is.

c++ – Pairwise summation – Code Review Stack Exchange

This function adds up an array pairwise. It runs fast enough and appears cache-friendly; I’ve tested it for correct output. It’s in C++ (farther down in the file there’s a function that takes a vector), but looks like valid C as well (but I haven’t tried it in C). How easy is it to understand?

double pairwisesum(double *a,unsigned n)
{
  unsigned i,j,b;
  double sums(32),sum=0;
  for (i=0;i+7<n;i+=8)
  {
    b=i^(i+8);
    if (b==8)
      sums(3)=(((a(i)+a(i+1))+(a(i+2)+a(i+3)))+((a(i+4)+a(i+5))+(a(i+6)+a(i+7))));
    else
    {
      sums(3)+=(((a(i)+a(i+1))+(a(i+2)+a(i+3)))+((a(i+4)+a(i+5))+(a(i+6)+a(i+7))));
      for (j=4;b>>(j+1);j++)
        sums(j)+=sums(j-1);
      sums(j)=sums(j-1);
    }
  }
  for (;i<n;i++)
  {
    b=i^(i+1);
    if (b==1)
      sums(0)=a(i);
    else
    {
      sums(0)+=a(i);
      for (j=1;b>>(j+1);j++)
        sums(j)+=sums(j-1);
      sums(j)=sums(j-1);
    }
  }
  for (i=0;i<32;i++)
    if ((n>>i)&1)
      sum+=sums(i);
  return sum;
}

For comparison, here is the previous version, which was slower because it kept making the cache miss, and also clobbered the array:

double pairwisesum(double *a,unsigned n)
// a is clobbered.
{
  unsigned i,j;
  if (n)
  {
    for (i=1;i<n;i*=2)
      for (j=0;j+i<n;j+=2*i)
    a(j)+=a(j+i);
    return a(0);
  }
  else
    return 0;
}

co.combinatorics – Is the smallest packing number of any port in a matroid $M$ equal to the maximum number of pairwise disjoint bases in $M$?

If for any matroid $M=(E,mathcal{I})$ we let $M_e={Ssubseteq Esetminus{e}:Scup{e}text{ is a circuit of }M}$ and for any family of non-empty sets $mathcal{F}neqemptyset$ we let $nu(mathcal{F})$ be the maximum number of pairwise disjoint sets in $mathcal{F}$ then is it true that $min{nu(M_e):ein E}=nu({B:Btext{ is a base of }M})$? I’m fairly sure this is correct though I just want to make sure.

Sorry if this is elementary, I know by NW that if $beta(M)=nu({B:Btext{ is a base of }M})$ then we have $smallbeta(M)=maxleft{frac{|E|-|X|}{r(E)-r(C)}:Xsubseteq Etext{ and }r(X)neq r(E)right}$ and $min{nu(M_e):ein E}$ is equal to either $beta(M)-1$ or $beta(M)$ so basically I want to verify this quantity always evaluates to the latter.

nt.number theory – Waring’s problem with pairwise coprime summands

According to https://www.imo-official.org/problems/IMO2019SL.pdf (p.100, Problem N7, Comment 2) for any $alpha > 0$ there are infinitely many positive integers $n$ such that there are infinitely many positive integers which cannot be written as a sum of $n^{alpha}$ (or fewer) pairwise coprime $n$-th powers.

Has anyone seen more around this – such as whether we can replace $n^{alpha}$ by e.g. $2^n$?