SA3: Exponents

Exponential growth can be visualized so many different ways. This SA activity will play with the pow function and explore exponents in p5.js.

This activity assumes that the skills from SA2 were introduced (if-else, logical operators, random(), text(), rect(), variables, loop, etc.). Make sure that the pow function is introduced (2^x will not work). This week may be a good time to introduce for loops as well.

Below are a few ideas for projects to explore powers. Learners may come up with their own ideas, or they may want to modify one of the examples below. Save work often and make sure learners know that looping with exponents can freeze up a machine (know keyboard shortcuts).

Diameter Growth

  • Create an animation that draws circles that sequentially double in diameter.
  • Make something random in the code.
  • Print out the diameter.
  • What is the function for this growth?
  • Example Code at p5.js.

See the Pen 2xdiameter by Sophia (@fractalkitty) on CodePen.

Inquiry with a Tree Fractal

  • Use this Example Code and figure out what does what (also in Codepen below).
  • What exponential growth is shown?
  • What happens if you change the values?

See the Pen QuadTree by Sophia (@fractalkitty) on CodePen.

3^x Squares

  • Create code that animates 3^x.
  • Add a text box that gives the quantity.
  • Randomize something in the code.
  • Create a condition to stop the loop.
  • Example Code at p5.js.

See the Pen 3xrect by Sophia (@fractalkitty) on CodePen.

Example Concepts: Exponents, variables, coordinate planes, ordered pairs, conditions, loops, random numbers, functions, etc..

Other tips:

  • Google has a RGB color picker if searched for on Google.
  • Keep it simple – remind learners to start simple and then build on their ideas if they have time.
  • Modifying example code into something new is a great way to get started.
  • Know the keyboard shortcuts to stop the code.

Leave a Reply

%d bloggers like this: