2022-05-10 09:07:50 +0200 received badge ● Popular Question (source) 2015-11-27 10:03:06 +0200 received badge ● Student (source) 2015-03-30 10:39:53 +0200 received badge ● Editor (source) 2015-03-30 10:39:01 +0200 asked a question How to use DiscreteRandomVariable covariance method? 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}