library(tidyverse)
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ dplyr 1.1.4 ✔ readr 2.1.5
## ✔ forcats 1.0.0 ✔ stringr 1.5.1
## ✔ ggplot2 3.4.4 ✔ tibble 3.2.1
## ✔ lubridate 1.9.3 ✔ tidyr 1.3.1
## ✔ purrr 1.0.2
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag() masks stats::lag()
## ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
library(combinat)
##
## Attaching package: 'combinat'
##
## The following object is masked from 'package:utils':
##
## combn
?choose
## starting httpd help server ... done
#Combination
green <- 5
red <- 7
n <- green + red
r <- 5
choose(5,1) * choose(7,4) + choose(7,5)
## [1] 196
choose(14,1) * choose(13,4) + choose(13,5)
## [1] 11297
2^5 * 6^2* choose(52,3)
## [1] 25459200
card <- (48/52) * (47/51) * (46/50)
round(1-card, digits = 4)
## [1] 0.2174
choose(31,5)
## [1] 169911
Step 2. How many different combinations of 5 movies can he rent if he wants at least one mystery?
choose(14,1)* choose(17,4) +
choose(14,2)* choose(17,3) +
choose(14,3)* choose(17,2) +
choose(14,2)* choose(17,1) +
choose(14,5)* choose(17,0)
## [1] 148253
format((choose(4,3)*choose(104,3)*choose(17,3)), scientific = TRUE, digits=3)
## [1] "4.95e+08"
Step 1. If he wants to include no more than 4 nonfiction books, how many different reading schedules are possible? Express your answer in scientific notation rounding to the hundredths place. Answer:
book <- choose(24,13) +
choose(25,12) * choose(5,1) +
choose(24,11) * choose(5,2) +
choose(24,10) * choose(5,3) +
choose(25,9) * choose(5,4)
signif(book * factorial(13), digits = 4)
## [1] 5.186e+17
Step 2. If he wants to include all 6 plays, how many different reading schedules are possible? Express your answer in scientific notation rounding to the hundredths place.
signif(choose(6,6) * choose((24 - 6),7) * factorial(13), digits = 4)
## [1] 1.982e+14
tree <- 2/(factorial(10)/(factorial(5)*factorial(5)))
round(tree, digits = 4)
## [1] 0.0079
Step 1. Find the expected value of the proposition. Round your answer to two decimal places. Losses must be expressed as negative values.
exp_val <- ((44/52) * 4) + ((8/52) * -16)
round(exp_val, digits = 2)
## [1] 0.92
Step 2. If you played this game 833 times how much would you expect to win or lose? Round your answer to two decimal places. Losses must be expressed as negative values.
round(exp_val * 833, digits = 2)
## [1] 768.92