Skip to content

Instantly share code, notes, and snippets.

@wdkrnls
Last active January 17, 2017 03:50
Show Gist options
  • Save wdkrnls/0e4967bbd3c4c73fba67641f9cef76f3 to your computer and use it in GitHub Desktop.
Save wdkrnls/0e4967bbd3c4c73fba67641f9cef76f3 to your computer and use it in GitHub Desktop.
on_circle_iter <- function(theta) {
if(theta < 2*pi) theta else on_circle(theta - 2*pi)
}
on_circle <- function(theta) Vectorize(on_circle_iter, SIMPLIFY = FALSE)
all(on_circle(pi*seq(0, 8, by = 2) == 0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment