Advertisement
Guest User

Geometric CDF Plot

a guest
Jan 26th, 2016
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.54 KB | None | 0 0
  1. p = var('p')
  2.  
  3. h(x) = 1-(1-p)**x
  4.  
  5. g = sage.plot.graphics.Graphics()
  6.  
  7. g += plot(h(x).subs(p=0.2), x, 1, 10, color='green', xmin=1, legend_label='$p=0.2$')
  8. g += plot(h(x).subs(p=0.5), x, 1, 10, color='blue', xmin=1, legend_label='$p=0.5$')
  9. g += plot(h(x).subs(p=0.8), x, 1, 10, color='red', xmin=1, legend_label='$p=0.8$')
  10.  
  11. for i in range(1, 10+1):
  12.     g += point2d((i, h(i).subs(p=0.2)), color='green')
  13.     g += point2d((i, h(i).subs(p=0.5)), color='blue')
  14.     g += point2d((i, h(i).subs(p=0.8)), color='red')
  15.  
  16. g.save('geometric.svg')
  17. g.show()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement