def variance
            expected = self.expectation
            @map.reduce(0) {|sum, (value,p)| 
                tmp = (value.to_f - expectation)
                sum + tmp * tmp * p 
            }
        end
def variance
            expected = self.expectation
            @map.reduce(0) {|sum, (value,p)| 
                tmp = (value.to_f - expectation)
                sum + tmp * tmp * p 
            }
        end
def variance expected = self . expectation @map . reduce ( 0 ) { | sum , ( value , p ) | tmp = ( value . to_f - expectation ) sum + tmp * tmp * p } end
computes variance given that keys in distribution
 are numeric
computes variance given that keys in distribution are numeric