module Rust::Probabilities

Public Instance Methods

E(v) click to toggle source
# File lib/rust-probabilities.rb, line 205
def E(v)
    if v.is_a? RandomVariableSlice
        return v.expected
    else
        raise "Cannot compute the expected value of a #{v.class}"
    end
end
P(v) click to toggle source
# File lib/rust-probabilities.rb, line 196
def P(v)
    if v.is_a? RandomVariableSlice
        raise "Cannot compute the probability of a random variable" if v.is_a? RandomVariable
        return v.probability
    else
        raise "Cannot compute the expected value of a #{v.class}"
    end
end