Highlights
Take a piece of paper and lie it flat on a table. Hold the left half flat and fold the right half on top of the left half (so you fold in a counter-clockwise direction). Now you have a new (double folded) piece of paper. Now fold this piece of paper counter-clockwise again, and continue folding the resulting piece of paper counter-clockwise for a total of n folds (including the first two folds). If you now unfold the piece of paper, pull a little on both sides to flatten it and look at it from the side, you will see a sequence of 'mountains' and `valleys'.
A) Use recursion to generate a sequence of -1's and l's that represent the mountains and valleys, respectively. HINT: You may want to use the number of folds as the input parameter.
Suppose you now take the unfolded piece of paper and hold every fold at a 90-degree angle. After 3 folds it should look like the foldout pictured on the left. After 10 folds it should look like the picture on the right.
B) BONUS QUESTION Create a function that turns a sequence of +1's and -1's into coordinates. Plot the coordinates to recreate the side-view of a piece of paper when every fold is held at a 90-degree angle.
HINT: Notice that if you move along the line, +1 means a turn to the left and -1 a turn to the right. You can model this by moving one unit in the coordinate plane, changing direction, moving one unit in the new direction, etc.
HINT2: If you are familiar with complex numbers, they make this subquestion a lot easier. In particular, notice that turning counter-clockwise is the same as multiplying by i in the complex plane while turning clockwise is the same as multiplying by —i. Complex numbers can be created in R using complex.
This IT Assignment has been solved by our IT Experts at My Uni Paper. Our Assignment Writing Experts are efficient to provide a fresh solution to this question. We are serving more than 10000+ Students in Australia, UK & US by helping them to score HD in their academics. Our experts are well trained to follow all marking rubrics & referencing style.
Be it a used or new solution, the quality of the work submitted by our assignment experts remains unhampered. You may continue to expect the same or even better quality with the used and new assignment solution files respectively. There’s one thing to be noticed that you could choose one between the two and acquire an HD either way. You could choose a new assignment solution file to get yourself an exclusive, plagiarism (with free Turnitin file), expert quality assignment or order an old solution file that was considered worthy of the highest distinction.
© Copyright 2026 My Uni Papers – Student Hustle Made Hassle Free. All rights reserved.