Advertisement
Guest User

Untitled

a guest
Oct 23rd, 2019
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. #Задача 6
  2. n1<-3; m1<-4
  3. Box<- c (rep("White",n1), rep("Black",m1))
  4. k1<-100000
  5. s1<-0
  6. for (i in 1:k) { Balls<- sample(Box,2, replace=FALSE)
  7. if ((Balls[1]=="White") & (Balls[2]=="Black")) {
  8. s1<-s1+1
  9. }
  10. }
  11. Pobs.1<-s1/k1
  12. Po<-n*m/((n+m)*(n+m-1))+m*n/((n+m)*(n+m-1))
  13. Pobs.1
  14. Po
  15.  
  16. n2<-3; m2<-4
  17. Box<- c (rep("White",n2), rep("Black",m2))
  18. k2<-100000
  19. s2<-0
  20. for (i in 1:k) { Balls<-sample(Урна,2, replace=FALSE)
  21. if ((Balls[1]=="White") & (Balls[2]=="Black")) {
  22. s2<-s2+1
  23. }
  24. }
  25. Pobs.2<-s2/k2
  26. Pobs.2
  27. X<- Pobs.1 + Pobs.2
  28. X
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement