Created
November 13, 2014 03:52
-
-
Save mikebirdgeneau/5713ab6e53c60b2e7d70 to your computer and use it in GitHub Desktop.
Harmonographs
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(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