Python: Drawing a Ring of Circles
The goal: Draw a number
of circles that revolve around the origin (0,0). The center of each
circle is rotated counterclockwise. The angle of the rotation is
determined by:
a = 360° ÷ n = (2 * π
rad) ÷ n
Since the center of each
circle is set at (0, 0), the center of each circle is located at (r *
cos a, r * sin a) where r is the radius.
Python: Using
Turtle (Numworks)
( radius = 50 pixels, n = 8 circles)
The script circring.py
imports the Turtle module. The circle command draws a circle
starting at the bottom of the circle going counter-clockwise. The
bottom of the circle is located at the point (x, y – r) where (x,
y) is the center and r is the radius.
Code:
from math import *
from turtle import *
# 2026-07-19 EWS
# turtle version
r=eval(input("radius? "))
n=int(input("# steps? "))
speed(7)
for i in range(n):
# set angle
a=i*2*pi/n
# turtle circle starts at
# bottom center point
x=r*cos(a)
y=r*(sin(a)-1)
# move to starting point
penup()
goto(x,y)
# draw circle
pendown()
circle(r)
# make turtle invisible
hideturtle()
Python: Using
TI-Draw (TI-84 Evo)
( radius = 50 pixels, n = 8 circles)
The script CIRRNG84.py
uses the TI Draw module. The TI-84 Evo (and I think the TI nSpire,
not 100% sure) lacks the Turtle module and instead employs a
calculator-specific drawing module. The draw_circle command calls
for both the center point and the radius. No adjustments are
necessary.
Code:
from ti_draw import *
from math import *
# 2026-07-19 EWS
# TI version non turtle
set_window(-160,160,-105,105)
print("grid -160,160,-105,105")
r=eval(input("radius? "))
n=int(input("# steps? "))
clear()
for i in range(n):
# set angle
a=i*2*pi/n
# determine center
x=r*cos(a)
y=r*sin(a)
# draw circle
draw_circle(x,y,r)
# show picture
show_draw()
Source
Chartier, Tim and
Langville, Amy. Nonstandard Notebook: Mathematically Rule Pages
for Unruly Thoughts The University of Chicago Press: Chicago
and London. 2024 ISBN-13 978-0-226-83090-2 <pg. 61-63>
If you get a chance,
please get this book. It’s a journal of interesting curves
involving polynomials, circles, lines, and waves. The authors uses
these curves to illustrate what ruled paper would look like when it
doesn’t consist of all straight lines. The concept of music,
earthquakes, and heartbeats are illustrated, including equations for
clovers, mandalas, and hearts. This book is an inspiration for me.
Eddie
All
original content copyright, © 2011-2026. Edward Shore.
Unauthorized use and/or unauthorized distribution for commercial
purposes without express and written permission from the author is
strictly prohibited. This blog entry may be distributed for
noncommercial purposes, provided that full credit is given to the
author.