This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# See gif at https://twitter.com/_Axeman_/status/1223037685704474624 | |
library(tidyverse) | |
library(gganimate) | |
logistic_map <- function(r, steps = 500, init = .5) { | |
x <- vector('numeric', steps) | |
x[1] <- init | |
for (n in 2:steps) x[n] <- r * x[n-1] * (1 - x[n-1]) | |
return(unique(round(tail(x, -100), 4))) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# See gif at https://twitter.com/_Axeman_/status/1041286690357354496 | |
library(tidyverse) | |
library(gganimate) | |
# This function does the basic clculations for a data.frame of circular coordinates | |
find_circular_coords <- function(speed, row, column) { | |
steps <- 300 | |
data_frame( | |
time = 1:steps, | |
angle = rep(seq(0, 2*pi, length.out = steps / speed), times = speed), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(tidyverse) | |
n <- 200 | |
step <- 0.02 | |
sm_step <- 0.02 | |
v <- 10 | |
tmp <- data_frame(x = 1:200, | |
a = x * 0 + rnorm(n, 0, v), | |
b = x * (0 - step - 1 * sm_step) + rnorm(n, 0, v) + (step + 1 * sm_step) * 100, |