code: public static MutableDoubleTuple variance(
          Collection<? extends DoubleTuple> tuples, DoubleTuple mean,
          MutableDoubleTuple result)
      {
          if (tuples.isEmpty())
          {
              return null;
          }
          DoubleTuple first = tuples.iterator().next();
          result = DoubleTuples.validate(first, result);
          DoubleTuples.set(result, 0.0);
          int d = result.getSize();
          for (DoubleTuple tuple : tuples)
          {
              for (int i=0; i<d; i++)
              {
                  double difference = tuple.get(i) - mean.get(i);
                  double v = result.get(i);
                  result.set(i, v + difference * difference);
              }
          }
          return DoubleTuples.multiply(result, 1.0 / tuples.size(), result);
      }
docs: Computes the component-wise variance of the given collection
  of {@link DoubleTuple} objects.
  
  @param tuples The input tuples
  @param mean The mean, which may have been computed before with
  {@link #arithmeticMean}
  @param result The result tuple
  @return The result, or <code>null</code> if the given collection is empty
  @throws IllegalArgumentException If the given result is not
  <code>null</code>, and has a {@link Tuple#getSize() size}
  that is different from that of the input tuples.