Skip to content

Instantly share code, notes, and snippets.

@slaiyer
Created May 7, 2021 00:00
Show Gist options
  • Save slaiyer/298db6daaa546c0e606fef0546c85b4c to your computer and use it in GitHub Desktop.
Save slaiyer/298db6daaa546c0e606fef0546c85b4c to your computer and use it in GitHub Desktop.
Euler's identity, but with tau
#!/usr/bin/env python3
import math
import numpy
from turtle import *
def tauler(unit):
tau = math.pi * 2
d_r_90 = tau / 4
arc_length = tau * unit
unit_inv = 1 / unit
penup()
forward(unit)
left(d_r_90)
pendown()
for _ in numpy.linspace(start=0, stop=arc_length, num=math.floor(arc_length)):
forward(1)
left(unit_inv)
left(d_r_90)
pencolor('green')
for _ in range(unit * 2):
forward(0.5)
if __name__ == '__main__':
bgcolor('black')
hideturtle()
title("Euler's identity")
speed('fastest')
pencolor('white')
width(2)
radians()
tauler(100)
exitonclick()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment