Skip to content

Instantly share code, notes, and snippets.

@rexarski
Created March 12, 2021 02:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rexarski/dfc0e8ce5feb2edc6c53a17cb3735c12 to your computer and use it in GitHub Desktop.
Save rexarski/dfc0e8ce5feb2edc6c53a17cb3735c12 to your computer and use it in GitHub Desktop.
i^i^i
pacman::p_load(tidyverse, extrafont)
i <- complex(real = 0, imaginary = 1)
count <- 1
point <- complex(real = 0.5, imaginary = 0.5)
x <- c(0.5)
y <- c(0.5)
while (count <= 25) {
z <- i^point
x <- c(x, Re(z))
y <- c(y, Im(z))
count <- count + 1
point <- complex(real = Re(z), imaginary = Im(z))
}
dat <- as_tibble(bind_cols(x=x, y=y))
p <- ggplot(dat, aes(x=x, y=y)) +
geom_point(aes(alpha=0.8)) +
geom_path(alpha = 0.75, color = "#112987") +
labs(title = "i^i^i ...",
caption = "Inspired by John Cook's blog post
https://www.johndcook.com/blog/2021/03/10/iii/
By: @rexarski",
x = "Real part of z",
y = "Imaginary part of z") +
theme_bw() +
theme(text = element_text(family = "Roboto Condensed"),
title = element_text(size = 18),
plot.caption = element_text(size = 10),
axis.title = element_text(size = 14),
axis.text = element_text(size = 10),
axis.title.y = element_text(angle = 0, vjust = 0.5),
panel.grid.minor.x = element_blank(),
legend.position = "none")
ggsave(plot = p, "i^i^i.png", height = 9, width = 12)
@rexarski
Copy link
Author

i^i^i

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment