This post covers the "Folding" problem as done in class for one dimension, plus a bit of what I did on my own. If I have time, I will hopefully follow with a post that solves the problem for two dimensions.
The problem asks for the sequence of ups and downs in creases given that one folds a strip of paper in a particular way. Our initial plan was to simply fold it a couple of times and record the pattern. (We had a plan B, which was actually thinking about how/why the folds actually were the way they were mathematically, but it made more sense to start with examples).
This was done with a chart that looked something like this:
This was done with a chart that looked something like this:
fold | pattern |
1 | ∨ |
2 | ∧ ∨ ∨ |
3 | ∧ ∧ ∨ ∨ ∧ ∨ ∨ |
4 | ∧ ∧ ∨ ∧ ∧ ∨ ∨ ∨ ∧ ∧ ∨ ∨ ∧ ∨ ∨ |
There seemed to be a pattern, but we did not quite grasp it until a light bulb suddenly lit up over my head and I re-recorded the folds so they aligned with folds from previous folds, so something like this:
It became apparent that each time we folded the paper, it was inserting an up-down repeating pattern between the old folds. We all understood the pattern pretty well, but we could not figure out a mathematical way to describe it in class.
I later came up with a block of python code that works for the first three folds:
def folding(fold):
'''(int) -> (list of str)
return pattern of folds'''
L = []
i = 0
while i <= (2**fold - 2):
if i % 2 == 0:
if i % 4 == 0:
L.append('up')
elif i % 4 == 2:
L.append('down')
elif i % 2 == 1:
if i % 4 == 1:
if i % 8 == 1:
L.append('up')
elif i % 8 == 5:
L.append('down')
elif i % 4 == 3:
L.append('down')
i += 1
return L
fold | pattern |
1 |
∨
|
2 |
∧∧∧∧∨∧∧∧∨
|
3 |
∧∧∧∧∨∧∨∧∧∧∨∧∨
|
4 |
∧∧∨∧∧∨∨∨∧∧∨∨∧∨∨
|
It became apparent that each time we folded the paper, it was inserting an up-down repeating pattern between the old folds. We all understood the pattern pretty well, but we could not figure out a mathematical way to describe it in class.
I later came up with a block of python code that works for the first three folds:
def folding(fold):
'''(int) -> (list of str)
return pattern of folds'''
L = []
i = 0
while i <= (2**fold - 2):
if i % 2 == 0:
if i % 4 == 0:
L.append('up')
elif i % 4 == 2:
L.append('down')
elif i % 2 == 1:
if i % 4 == 1:
if i % 8 == 1:
L.append('up')
elif i % 8 == 5:
L.append('down')
elif i % 4 == 3:
L.append('down')
i += 1
return L
Unfortunately, this only works up to fold 3. For it to work for more folds, it would be necessary to either write a ridiculous amount of code... or use recursion. Which I simply do not know how to do very well yet. However, at least for the first three folds:
folding(3)
['up', 'up', 'down', 'down', 'up', 'down', 'down']
folding(2)
['up', 'up', 'down']
folding(1)
['up']
If I have time to return to this problem, I will actually write python code that gives an actual solution, as well as tackle the two-dimensional version of this problem in part II.