Wednesday, 3 December 2014

Logical Reasoning: Visualizing the Folding Problem

At the end of the problem-solving session on the folding problem, Professor Heap gave us an additional challenge: to find a way to generate a graphical representation of the folded paper viewed side-on (so that all the creases are visible) for any number of folds.  This post is about my attempt at tackling that problem.

I won't show the code for this, but you could code up a program to generate such visualizations in Python (and maybe have some insights into the problem in the process).  It might be helpful to use a module such as turtle which shows the drawing as it progresses so that you can see what's going on.

Warning: my approach uses my solution to the folding problem itself, so don't read further if you want to solve the problem for yourself without seeing a solution.


1: Understanding the Problem

The input is the number of folds, which I'll call n, and the output is a visual representation of the creased paper.  For any given n there is a unique sequence of creases, so any variations in the visual representations should preserve the same sequence for the same n.

2: Devising a Plan

Plan 1: Use my solution to the folding problem as a scaffold to reason out a visual representation.

Plan 2: Manually draw visual representations for small n and look for a pattern.

3: Carrying Out the Plan

I'm going to go with Plan 1 because I expect it to guide me all the way through to a solution.

Let's start with a base case: n = 0, or an uncreased paper.


Then to get the general case for any n, use the steps of the recursive solution:
  1. Place a down crease in the middle of the paper.  All creases should have the same angle between their sides; I'll call this angle theta and pick theta = 90 degrees.
  2. Take the solution for n - 1 folds and rotate it so that its leftmost line segment is parallel to the right side of the middle crease.
  3. Translate the solution for n - 1 folds so that its left endpoint is at the middle crease.  Copy this rotated and translated shape onto the page / screen to get the right side of the solution for n folds.
  4. Rotate the solution for n - 1 folds counterclockwise by theta around the middle crease, after which its formerly-left endpoint should still be at the middle crease.  Copy this rotated shape onto the page / screen again to get the left side of the solution for n folds.
The solutions can be scaled to the same size overall if desired, but that's not technically necessary.

4: Looking Back

I would like to put in more images to go with this, but my tools aren't cooperating.  It's clear to me that the solution works, though.

No comments:

Post a Comment