# [Edu-sig] properties and geometric shapes

kirby urner kirby.urner at gmail.com
Sat Feb 18 15:14:21 EST 2017

```Ya'll know about @property and some my remember a few months back I was
sharing about a Circle type where you could change the radius, area, or
perimeter, by simply assigning to these attributes, and the other two would
magically co-vary.

Likely many people have thought of that. Great way to teach / learn
geometry.

Like this:

>>> c = Circle()
>>> c.area = 50
3.989422804014327
>>> c.circumference = 5
0.7957747154594768

https://github.com/4dsolutions/Python5/blob/master/circle2.py

I don't think a math teacher needs to painstakingly go through all the code
before using this API. Go ahead and work with finished programs. We'll look
at the source code by and by.

The goal is to interact with the instances as modeling geometric shapes
with co-varying dimensions.

I haven't done a Triangle class that way yet. That'd be fun to do.

Nor a Tetrahedron, in any generic way, though I have some components lying
around. :-D

Having only one dimension change at a time, leaving others free to co-vary,
makes for a good study in ripple effects.

I've recently co-developed, with David Koski, another specimen of geometric
object with co-varying properties.

It's called a TetraBook and visually consists of a triangular book meaning
both front and back covers are equilateral triangles, all edges 2, with a
shared hinge (the book's spine).

Imagine this book flat open on its back, with a single triangular page
wagging back and forth, another equilateral triangle of edges 2.

When it's all the way to one side, flat against either cover, there's no
volume to speak of.

When the page turns, however, the segments from page tip to each cover tip
define two complementary tetrahedrons, the turning page their common face.

What the TetraBook instance is allows is I can assign any of five
attributes and, thanks to property methods behind the scenes, the other
four with co-vary.

The angle of the page, the lengths of the tip-to-tip segments, the volumes
of the complementary tetrahedrons (same), their altitudes (same).

I can even assign volume in two different ways, depending on what I
consider my unit of volume (regular tetrahedron or right tetrahedron, the
latter corresponding to a cube volume of edges 1).

On Github:
https://github.com/4dsolutions/Python5/blob/master/tetrabook.py
(has a couple dependencies, also there: qrays.py and tetravolume.py)

I recommend this approach to other math teachers.

If your school also has a computer science department, so much the better
right?

Kirby

lambda calc track
oregon curriculum network
4dsolutions.net/ocn