# Is Constrain.Equal(double d, Variable<double> v) the same as setting v.Observed = d

### Domanda

• I'm confused about what Constrain.Equal(double d, Variable<double> v) really does.  The documentation says that this sets the random variable to a constant.  If the random variable had been previously set to a distribution, does this put any constraint on that distribution or does it simply redefine the random variable?

I've read 101 & the user manual cover to cover but am pretty new to this so any help is greatly appreciated.

Oopsnut
giovedì 5 gennaio 2012 16:31

### Tutte le risposte

• Hi Ed

Constrain.Equal is more commonly used for two random variables in which case it constrains the the two (previously defined) random variables to be equal.

Using it with a constant is equivalent to observing v, and there are many examples in the documentation where we observe random variables.

So, for example, if v is defined by a fixed distribution, there is nothing more to infer. Whereas if v is defined in terms of other random variables (for example it's defined in terms of a Gaussian with a random mean) then we can make inferences about those other random variables by observing v.

John

venerdì 6 gennaio 2012 09:16