Skip to content

Instantly share code, notes, and snippets.

View Ax3man's full-sized avatar
🐠

Wouter van der Bijl Ax3man

🐠
View GitHub Profile
@Ax3man
Ax3man / logistic_map.R
Last active January 31, 2020 18:49
logistic_map.R
# 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)))
}
# 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),
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,