Skip to content

Instantly share code, notes, and snippets.

@slaiyer
Last active August 8, 2025 23:16
Show Gist options
  • Select an option

  • Save slaiyer/298db6daaa546c0e606fef0546c85b4c to your computer and use it in GitHub Desktop.

Select an option

Save slaiyer/298db6daaa546c0e606fef0546c85b4c to your computer and use it in GitHub Desktop.
Euler's identity, but with tau
#!/usr/bin/env -S uv run --script
# /// script
# requires-python = ">=3.13"
# dependencies = [
# "numpy",
# "PythonTurtle",
# ]
# ///
# `brew install python-tk`
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