Loading [MathJax]/jax/output/HTML-CSS/jax.js

Korner, Ex. 2.2.2

Consider a large square of side a containing a small circle of radius r.

  1. If a point is chosen at random in the square, what is the probability that it lies inside the circle? If r is increased by 20%, show that the probability that the point lies within the circle increases by about 40%
  2. If a line is chosen at random parallel to one of the sides of the square, what is the probability that it crosses the circle? If r is increased by 20%, show that the probability that the line crosses the circle increases by 20%.
library(dplyr); library(ggplot2); library(ggsci); library(magrittr); library(reshape2)
a = 1 #for standardization
r = .01 # base radius
incrs = seq(0, 1, len = 10)
rs = r*(1+incrs)

cbase = pi*r^2
lbase = 2*r

circular = vector()
linear = vector()
for(i in 1:length(rs)){
  circular[i] = pi*rs[i]^2 / cbase - 1
  linear[i] = 2*rs[i] / lbase - 1
}
result = data.frame(rs, circular, linear, incrs)

theme_set(theme_minimal())

result %>% select(incrs, circular, linear) %>% melt(id.vars = incrs) %>% 
  ggplot(aes(x = incrs, y = value, color = variable)) + 
  geom_line() + scale_color_startrek() + scale_y_continuous(labels = scales::percent) +
  labs(color = "Search Type") + xlab("Increase in Target Area from Baseline") +
  ylab("Increase in Pd from baseline") +
  scale_x_continuous(labels = scales::percent) +
  ggtitle("Comparison of linear vs. circular search vs convoy size")