Created
March 12, 2021 02:50
-
-
Save rexarski/dfc0e8ce5feb2edc6c53a17cb3735c12 to your computer and use it in GitHub Desktop.
i^i^i
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
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) |
Author
rexarski
commented
Mar 12, 2021
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment