Teaching Algebraic Expressions with Tracking Arithmetic

An 8 x 6 rectangle with rounded corners of radius 1

Step 1: Solve an easy instance.

  • 4 line segments — one from (-3, 3) to (3, 3) for the top; one from (-3, -3) to (3, -3) for the bottom, one from (-4, 2) to (-4, -2) for the left side, and one from (4, 2) to (4, -2) for the right side.
  • Four arcs for the corners — one from 0° to 90° centered at (3, 2); one from 90° to 180° centered at (-3, 2); one from 180° to 270° centered at (-3, -2); and one from 270° to 360° centered at (3, -2). Each arc has a radius of 1 unit.
pic = polyline([(-3,  3), ( 3,  3)])
& polyline([(-3, -3), ( 3, -3)])
& polyline([(-4, -2), (-4, 2)])
& polyline([( 4, -2), ( 4, 2)])
& translated(arc( 0, 90, 1), 3, 2)
& translated(arc( 90, 180, 1), -3, 2)
& translated(arc(180, 270, 1), -3, -2)
& translated(arc(270, 360, 1), 3, -2)

Step 2: Solve an instance with “weird” numbers.

pic = polyline([(-5.5,  4), ( 5.5,  4)])
& polyline([(-5.5, -4), ( 5.5, -4)])
& polyline([(-6.5, -3), (-6.5, 3)])
& polyline([( 6.5, -3), ( 6.5, 3)])
& translated(arc( 0, 90, 1), 5.5, 3)
& translated(arc( 90, 180, 1), -5.5, 3)
& translated(arc(180, 270, 1), -5.5, -3)
& translated(arc(270, 360, 1), 5.5, -3)

Step 3: Solve the same problem without doing arithmetic.

pic = polyline([(-13/2 + 1,  8/2    ), ( 13/2 - 1,  8/2    )])
& polyline([(-13/2 + 1, -8/2 ), ( 13/2 - 1, -8/2 )])
& polyline([(-13/2, -8/2 + 1), (-13/2, 8/2 - 1)])
& polyline([( 13/2, -8/2 + 1), ( 13/2, 8/2 - 1)])
& translated(arc( 0, 90, 1), 13/2 - 1, 8/2 - 1)
& translated(arc( 90, 180, 1), -13/2 + 1, 8/2 - 1)
& translated(arc(180, 270, 1), -13/2 + 1, -8/2 + 1)
& translated(arc(270, 360, 1), 13/2 - 1, -8/2 + 1)

Step 4: Replace the special numbers with variables.

roundedRect(w, h, r)
= polyline([(-w/2 + r, h/2 ), ( w/2 - r, h/2 )])
& polyline([(-w/2 + r, -h/2 ), ( w/2 - r, -h/2 )])
& polyline([(-w/2, -h/2 + r), (-w/2, h/2 - r)])
& polyline([( w/2, -h/2 + r), ( w/2, h/2 - r)])
& translated(arc( 0, 90, r), w/2 - r, h/2 - r)
& translated(arc( 90, 180, r), -w/2 + r, h/2 - r)
& translated(arc(180, 270, r), -w/2 + r, -h/2 + r)
& translated(arc(270, 360, r), w/2 - r, -h/2 + r)
A smorgasbord of rounded rectangles using a general formula.

--

--

--

Software engineer, volunteer K-12 math and computer science teacher, author of the CodeWorld platform, amateur ring theorist, and Haskell enthusiast.

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

FileMaker Server & Zabbix: Setting Up a Server Part 1

Data Types in Python with Code

Dockerizing LAMP Stack Application

File naming convention when working with financial models

How I Go About Learning a New Idea

Image by mohammed_hassan (https://pixabay.com/users/mohamed_hassan-5229782/) on pixabay.

Java RegEx: Part 6 — Group and Subgroup

Learnings from “no failure”

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Chris Smith

Chris Smith

Software engineer, volunteer K-12 math and computer science teacher, author of the CodeWorld platform, amateur ring theorist, and Haskell enthusiast.

More from Medium

Basics of Git Flow (featuring Emacs and Magit!)

What is TriMet bus operator training like?

A Selection of 19th-Century Slang