Fourier Transform Differential Equations
pm - avg % of population that is married
P - population
\(pm * P\) - avg # of married couples
p - percent of married couples who have children for the culture in question
\(p * pm * P\) - number of married couples likely to have offspring
o - average number of offspring
\(o * p * pm * P\) - average rate of growth in # of individuals
l - length of the cord
g - acceleration from gravity
\(\theta\) - angle of cord (rest to release)
m - mass of pendulum
h - height of pendulum release
\(h = l - l*cos \theta = l (1-cos \theta)\) v - max velocity of pendulum
\(mgh = \frac{1}{2}mv^2\)
Kepler’s 1st Law of Celestial motion \[r = \frac{p}{1 + \epsilon cos \theta}\] Where: \(r\) - distance from orbital focus (often Sun) to planet
\(p\) - half the length of the chord parallel to the directrix and passing through the focus
\(\epsilon\) - eccentricity of the orbit defined as the ratio of the perpendicular distances between the focus to the major axes of the ellipse.
\(\theta\) - the angle of the planet’s current position to the point of its closest approach to the focus
Define “rational” individual - it doesn’t make sense to model human behavior in this way because it’s highly inaccurate. The only way to do this with some degree of certainty is to monitor the decisions of a given individual in order to derive that individuals values. Each value would then need to be weighted according to the proximity of engaging with that value. Then a maximization function would need to be created to find the best fit decision according the the highest priority values.
ex <- function(a) {
e <- new.env(parent = emptyenv())
e$x <- 1
sapply(seq_along(1:30), function(i) {
e$x <- append(e$x, a * e$x[length(e$x)])
})
return(e$x)
}
sim <- sapply(c(1.1, 2.2, 3, 0.3, -0.5, -1.1, -2.2), ex, simplify = F)
lapply(sim, function(d) {
d <- data.frame(y = d) %>% mutate(x = as.numeric(rownames(.)))
ggplot2::qplot(data = d, geom = "line", main = paste0("a=", d[2, 1]), x = x,
y = y)
})
## [[1]]
##
## [[2]]
##
## [[3]]
##
## [[4]]
##
## [[5]]
##
## [[6]]
##
## [[7]]
SIR <- function(days = 10, N = 100, I = 3) {
e <- environment()
mod <- sapply(seq_along(1:days), function(i, N = e$N, I = e$I) {
I <- e$I
# Add Random Recovery after 7 Days
if (i > 7) {
R <- round(rnorm(1, 3, 4))
I <- I - R
}
S <- N - I
I <- I + round((0.01 * I) * S)
if (I >= 100) {
e$I <- I <- 100
} else {
e$I <- I
}
S <- N - I
return(c(e$I, S, i))
})
return(data.frame(I = mod[1, ], S = mod[2, ], days = mod[3, ]))
}
SIR() %>% ggplot(data = ., aes(x = days, y = I)) + geom_line(stat = "identity")