Does this work for you?
sage: S = ['h','t']
sage: P = dict(zip(S,[1/2,1/2]))
sage: P
{'h': 1/2, 't': 1/2}
sage: O = DiscreteProbabilitySpace(S,P)
sage: dict( [ ((s1,s2),P[s1]*P[s2]) for s1 in S for s2 in S] )
{('h', 't'): 1/4, ('t', 't'): 1/4, ('h', 'h'): 1/4, ('t', 'h'): 1/4}
It doesn't really use Sage, just a Python trick.
David
--
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org