Seriously though, I am honored and humbled by the opportunity to share all the hard work that has gone into creating the materials on this website. I hope to continue growing, learning, and sharing with you all.
This Scripting Algebra (SA) activity uses parabolas again to make generative art in p5.js. In SA6, we used the f(x) = ax2+bx+c form for parabolas. In SA7, we are going to take a look at the directrix and focus by using the form: (x-h)2 = 4p(y-k). This is one of my favorite ways to look at parabolas due to its beauty. The distance between the focus and the parabola is the same as the parabola to the directrix – it’s so cool!
In this activity, learners will not create their own code at first. They will start with the code below and change one value at a time to analyze its effects. Let learners come up with the approach for analyzing code (give hints as needed). Learners can generate their own code for parabolic art after analysis.
Save work often and have fun (or just start over if you break it).
Analyze the code below by changing one value at a time.
What happens when numbers are changed? Why?
Ex: can you make the parabola always face opposite directions?
Ex: What happens if you change how a,b, and c are created?
This Scripting Algebra (SA) activity will play with systems of linear equations in p5.js. In this activity, a system of two random lines will be generated and the intersection (or solution) of those lines will be calculated to make generative art.
Below are a few ideas for projects to explore systems of linear equations. Before starting, it is recommended for learners to sketch out their ideas and think about the math required to find the solution of two lines (given the 4 ordered pairs generated). Learners could also look at the animation of one of the projects below and have discussion groups on how they work. Save work often and have fun.
Translate the canvas so (0,0) is in the center.
Generate 4 ordered pairs for two lines.
Create a function to find the intersection/solution.
This Scripting Algebra (SA) activity will introduce students to perpendicular slopes and points for lines in p5.js. Once students get comfortable with linear functions, it is fun to look at their perpendicular counterparts. Introduce the concept that a perpendicular line has a slope that is a negative reciprocal of the original line’s slope (if y = mx+b, then the perpendicular with have a slope of -1/m).
Below are a couple ideas for projects to explore perpendicular lines, but don’t dive straight into them. If you have time, encourage learners to draft a function that draws a line and then a line that is perpendicular to it and code it from scratch. Learners could also look at the animation of one of the projects below and have discussion groups on how they work (maybe outline code). Sometimes, when time is limited, it is best to just play with the examples below. Save work often and have fun.
Random Pairs of Perpendicular Segments
Create an animation that draws a line and then its perpendicular counterpart.
The lines segments can be L’s, crossed, or not crossed.
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).
Create an animation that draws circles that sequentially double in diameter.
There are infinite possibilities for linear function animations. This SA project will give some ideas to practice using linear equations with p5.js.
Introduce if-else statements (conditions), logical operators, random(), text(), rect(), variables, and using p5.js for animation (loop). Below are a few ideas for projects with linear functions. Learners may come up with their own ideas, or they may want to modify one of the examples below:
Random Line Art
Create code that draws random lines.
Create conditional statements based on the slope of each line (change color or thickness).
Do not plot vertical lines (and discuss what a function is).
Here is my first Scripting Algebra (SA) post! I hope to keep these coming (with about 5 posts for each semester of Algebra).
Often Algebra classes start with the Real Number System. This SA task is to program a graphic for the Real Number system. This can be a Venn diagram, animation, or another project that the learner comes up with.
I plan to use p5.js with my learners because it is fairly easy to learn, play with, and explore. I am not teaching a coding course; I am supplementing math learning with coding tasks and projects. (Codepen is another place to program with p5.js, but has ads.)
Here is the flow of my class:
After the Real Number system and sets have been introduced, show an example of a p5.js code that creates a graphic. Learners can be given a copy of the script to play with and through inquiry figure out how it works. I will cover the coordinate system of the canvas, how to comment, RGB colors, and layers in p5.js.