MaxMSP Trigonometric Function Visualization
The [Coding Druid] series is my cross-platform programming practice notes. Each episode focuses on a theme (math, physics, electronics, graphics, sound...), implemented in several programming languages. Leveling up warrior, mage, healer, and rogue simultaneously — tanking, DPSing, healing, and escaping all at once.
Coding Druid - Math Chapter - Trigonometric Function Visualization: MaxMSP Implementation

Following the principle of not digging holes for myself, let's start with something that (looks) simple — middle school math trigonometric functions.

Trigonometric Function Definition
Trigonometric functions are a class of functions commonly encountered in mathematics that relate to angles. They associate the interior angles of a right triangle with the ratios of its sides, and can equivalently be defined using various line segments related to the unit circle. Trigonometric functions play an important role in studying the properties of geometric shapes such as triangles and circles, and are also fundamental mathematical tools for studying periodic phenomena.
Common trigonometric functions include sine (sin), cosine (cos), and tangent (tan).
— Wikipedia
Note the bolded periodicity — most sound and visual programming is related to this.
Defining trigonometric functions using the unit circle:

Graphs of sin(x) and cos(x) in Cartesian coordinates:
Putting it all together:

Not much more to say here — after all, these notes aren't a textbook.
MaxMSP Implementation of Trigonometric Functions
There are many features related to trigonometric functions in Max — you could say the entire MSP is built on them. But this exercise uses Max Jitter to visualize trigonometric functions, without using MSP.
Max has many functional subsets. The most famous is MSP for audio, and Jitter for graphics and images. The official name is just Max now, but MaxMSP as the early name is so iconic that I use it in article titles for better SEO.
At first it seemed like a simple task, but after stumbling around for a few hours... Max really is a "learn like a drip, forget like a fountain" kind of tool.
The resulting patch looks roughly like this:

Some common Max snippets were referenced from the excellent video tutorial series: Amazing Max/Msp Tutorial https://www.youtube.com/watch?v=HN8nQ_KtG6k
The general approach is to use jit.gen to manipulate jit.matrix, with all the trig function logic written in jit.gen, then render the final transformed matrix using jit.mesh.
In short — to put an elephant in a fridge takes three steps: open the door, stuff it in, close the door.
Result:

Talk is cheap. Show me the code!
The code for this and most of the [Coding Druid] series is open-sourced here: https://github.com/avantcontra/coding-druid
Follow us on social media: code2art
Community resources & courses: https://ghc.h5.xeknow.com/s/hzkMX
code2art Intelligence Center (membership): https://ghc.h5.xeknow.com/s/2BCFuJ
Cheers🍻
Contra