My Precalculus class is working on solving problems involving special matrices that can find the area of a triangle given its three vertices. To find the area of the triangle using a matrix, input the three vertices into the first three rows. The third column is composed of all 1’s. Take one half of the determinant and the positive answer is the area. This is not that hard to compute if given all integers, but if the vertices are fractional amounts, it could be difficult to calculate by hand. I thought this would be a good opportunity to code this in R for any values. R is ideal for using matrix operations and my students are now familiar working with this programming language.
After we did a few problems in class, I assigned them another task.
I made this into a authentic project for them to complete. Since they now know how to use R and RStudio, I asked them to write code in R that would output the code and area using R and Knitr. I taught them the basics of R Markdown and Knitr so they could submit their report to me via Edmodo.
I want them to be proficient using Knitr as this will ensure that their code, and future statistical experiments, are reproducible.
After everyone submitted their reports, I asked them to go back and redo their code using the as.numeric function. They were able to to input each vertex in two lines of code.
After using R, RStudio and Knitr for these assignments, I feel confident that I’ll be able to use R and RStudio for some enrichment assignments in my AP Statistics class next year. We will be using the TI nspire CX graphing calculator in class and code in R for enrichment. I’ll write more on this in future posts once class starts in September.
Latest posts by Kevin (see all)
- Building Lego Technic Trucks - May 17, 2017
- Simulation in R For AP Statistics - November 28, 2016
- Make A Box Plot with Single Column Data Using Ggplot2 Tutorial - November 7, 2016