#9670: Bring probability/random_variable.py to 100% coverage
-----------------------------+----------------------------------------------
   Reporter:  kcrisman       |          Owner:  mvngu   
       Type:  enhancement    |         Status:  new     
   Priority:  major          |      Milestone:  sage-5.0
  Component:  documentation  |       Keywords:          
Work_issues:                 |       Upstream:  N/A     
   Reviewer:                 |         Author:          
     Merged:                 |   Dependencies:          
-----------------------------+----------------------------------------------

Comment(by was):

 Kohel's examples above are a mess.  Here's something that actually works:
 {{{
 sage: n=6
 sage: S = list('abcdef')
 sage: P = dict([(S[i-1],1/n) for i in [1..n]])
 sage: X = DiscreteProbabilitySpace(S, P)
 sage: X.expectation()
 0.166666666666667
 sage: f = dict([(S[i],i+1) for i in range(n)])
 sage: F = DiscreteRandomVariable(X,f)
 sage: F.expectation()
 3.50000000000000
 }}}

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/9670#comment:8>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica, 
and MATLAB

-- 
You received this message because you are subscribed to the Google Groups 
"sage-trac" group.
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-trac?hl=en.

Reply via email to