I'd like to take advantage of covariance() method of DiscreteRandomVariable class, yet, I can't find any example on the internet how to properly use it.

My understanding is that this should work:

text1 = AlphabeticStrings().encoding("AB") text2 = AlphabeticStrings().encoding("BA") text1freq = frequency_distribution(text1) text2freq = frequency_distribution(text2) text1freq.covariance(text2freq)

However, I receive unexpected ValueError:

/usr/lib/python2.7/site-packages/sage/probability/random_variable.pyc in covariance(self, other) 187 Omega = self.probability_space() 188 if Omega != other.probability_space(): --> 189 raise ValueError("Argument other (= %s) must be defined on the same probability space." % other) 190 muX = self.expectation() 191 muY = other.expectation()

ValueError: Argument other (= Discrete probability space defined by {A: 0.500000000000000, B: 0.500000000000000}) must be defined on the same probability space.

But... Logically (not technically) both text1freq and text2freq are the same probability space:

sage: text1freq Discrete probability space defined by {A: 0.500000000000000, B: 0.500000000000000}

sage: text2freq Discrete probability space defined by {A: 0.500000000000000, B: 0.500000000000000}