Desmos

Typically Desmos is used as a graphing calculator to plot functions from \( \mathbb{R}\) to \(\mathbb{R}\). It does, however, have lesser known features like lists, list comprehension, polygons, and the full scope of RGB colors, which allow us to do so much more. How much more?

A common exercise in introductory computer science courses will ask students to implement Conway's Game of Life. While to my knowledge no such course quite exists for Desmos, enthusiasts will take it upon themselves to give it a stab.

This example serves as a demonstration of how Desmos is quietly capable of so much more than it at first appears.

Techniques

Here we describe some resources and techniques which are useful for various applications.

Ray Intersection with Polygon

Examples

Below are examples of ways to use the above tools.

Point-in-polygon Problem

The point-in-polygon problem asks whether a given point lies within some polygon. A simple technique is to shoot a ray from the point and count the number of intersections between the ray and the polygon's edges. If the point is within the polygon, the number of intersections should be odd; otherwise, the number of intersections should be even.

Thomae's Popcorn Function

Thomae's function is a common function presented in introductory analysis courses which challenges students' intuition of what it means to be continuous.

Dynamical Billards

Dynamical billiards generalizes the popular game of billards to a dynamical system modelling the motion of a particle within some boundary.