Created
November 8, 2017 13:14
-
-
Save DavisVaughan/549334145e3f38bf31c205295f59e788 to your computer and use it in GitHub Desktop.
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
a=-1.24458046630025 | |
b=-1.25191834103316 | |
c=-1.81590817030519 | |
d=-1.90866735205054 | |
n <- 10000000 | |
x <- vector("numeric", n) | |
y <- vector("numeric", n) | |
x[1] <- 0 | |
y[1] <- 0 | |
t1 <- proc.time() | |
for(i in 2:n) { | |
x[i] <- sin(a * y[i-1] + c * cos(a * x[i-1])) | |
y[i] <- sin(b * x[i-1] + d * cos(b * y[i-1])) | |
} | |
df <- data.frame(x = x, y = y) | |
proc.time() - t1 | |
# user system elapsed | |
# 4.483 0.065 4.876 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi, harnagpal.
Currently I'm developing a tool to produce those a, b, c, d values automatically.
I found this gist looking for a more efficient way of drawing them.
It is a WIP, it has not a very good UI so far, but you can use it: https://davidomarf.github.io/attractor-seeder/
Just click on the "Generate" button. To generate new values, press space bar one time.
To avoid a certain attractor from being re-drawn, click the lock button that appears when you hover the attractor.
To copy the a, b, c, d values, click the clipboard icon.
To draw the attractor in a higher-quality image, click the "external link" icon.