Fourier Transform Differential Equations

Exercise 3.2, pp 30

What are some appropriate choices for state variables in the follow- ing systems?

population growth

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

swinging pendulum

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\)

motions of celestial bodies

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

behavior of “rational” individuals playing a negotiation game

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.

Exercise 4.3, pp 37

Decide whether each of the following examples is (1) linear (l) or non-linear (!l), (2) first-order (1o) or higher-order (1+o), and (3) autonomous (a) or non-autonomous (!a).
\[x_t = ax_{t−1} + b\]
l, 1o, a
\[ x_t = ax_{t−1} + bx_{t−2} + cx_{t−3}\]
l, 1+o, a
\[x_t = ax_{t−1} (1 − x_{t−1} )\]
l, 1o, a
\[x_t = ax_{t−1} + bxt − 2^2 + c\sqrt{x_{t−1}x_{t−3}}\]
!l, 1+o, !a
\[ x_t = ax_{t−1} x_{t−2} + bx_{t−3} + \sin{t}\]
!l, 1+o, !a
\[x_t = ax_{t−1} + by_{t−1} , y_t = cx_{t−1} + dy_{t−1}\]
l, 1o, a

Exercise 4.5, pp 44

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]]

Simulate the model described in the lecture 3 slides 46 and 47.

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")