my.dice.sum <- function (n.side){
dice <- sample(1:n.sides, size=n.dice, replace = TRUE)
return(sum(dice))
}
s <- 6
n <- 3
probability <- (1/s)^n
print(probability)
## [1] 0.00462963
The probability of rolling a dice three times and get a sum of 12 is 0.00463
maleother <- 200
femaleother <- 100
total <- 1700
prob <- (maleother/total) + (femaleother/total)
print(prob)
## [1] 0.1764706
The probability of having a male live in other or a female living in other is 0.176
remaining <- 52-1
probdiamond <- 12/remaining
print(probdiamond)
## [1] 0.2352941
The probability of drawing a diamond on the second attempt without replacing the first diamond card drawn is 0.235
ft1 <- factorial(20)
ft2 <- factorial(10)
print(ft1/ft2)
## [1] 670442572800
There are 670442572800 different lineups possible.
tv <- 20
sss <- 20
dvd <- 18
theatersystems <- tv*sss*dvd
print(theatersystems)
## [1] 7200
There are 7200 ways of creating the theater systems
Q6 <- factorial(10)
print(Q6)
## [1] 3628800
There are 3628800 ways of seeing the patients.
coin <- 2^7
dice <- 6^3
card <- 52*51*50*49
coin*dice*card
## [1] 179640115200
There are 179640115200 possible outcomes.
male <- factorial (3)
female <- factorial (4)
print( male*female )
## [1] 144
When arranging 4 male and 4 female in a round table, there are 144 ways of arranging.
a <- 0.03 # The Given probability of true users
aNonUser <- 0.97 # Probability of a non user
bGivena <- 0.95 # Probability of a true positive
bGivenNota <- 0.05 # Probability of a false positive
aGivenb <- (bGivena*a)/((bGivena*a)+(bGivenNota*aNonUser))
print(aGivenb)
## [1] 0.3701299
The possibility of testing a person that is actually a user is 37%
BothB <- 1/3
BothG <- 1/3
GoldenBrown <- 1/3
ProbofOneBrown <- BothB + GoldenBrown
print(ProbofOneBrown)
## [1] 0.6666667
The possibility of having the other side to be brown is 2/3, which is 66.66%.