Skip to content

Instantly share code, notes, and snippets.

@mikebirdgeneau
Created November 13, 2014 03:52
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 mikebirdgeneau/5713ab6e53c60b2e7d70 to your computer and use it in GitHub Desktop.
Save mikebirdgeneau/5713ab6e53c60b2e7d70 to your computer and use it in GitHub Desktop.
Harmonographs
library(ggplot2)
f1=jitter(sample(c(2,3),1));f2=jitter(sample(c(2,3),1));f3=jitter(sample(c(2,3),1));f4=jitter(sample(c(2,3),1))
d1=runif(1,0,1e-02);d2=runif(1,0,1e-02);d3=runif(1,0,1e-02);d4=runif(1,0,1e-02)
p1=runif(1,0,pi);p2=runif(1,0,pi);p3=runif(1,0,pi);p4=runif(1,0,pi)
xt = function(t) exp(-d1*t)*sin(t*f1+p1)+exp(-d2*t)*sin(t*f2+p2)
yt = function(t) exp(-d3*t)*sin(t*f3+p3)+exp(-d4*t)*sin(t*f4+p4)
t=seq(1, 100, by=.001)
dat=data.frame(t=t, x=xt(t), y=yt(t))
ggplot(dat,aes(x=x,y=y))+geom_point(cex=0.2)+theme_bw()+theme(line = element_blank(),
text = element_blank(),
line = element_blank(),
title = element_blank())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment