## Tangent lines

While getting to know the basics of machine learning, I stumbled on some notions of calculus, something that I’m very unfamiliar with but that I would love to understand. I have been thinking for a while about devising some small experiments that would allow me to familiarize myself with mathematical concepts in an intuitive way. So this sudden need to understand a bit of calculus seemed like a good opportunity to delve into this.

The animation below is one of those experiments. It helped me to familiarize myself with the notions of limits and tangents. A line is tangent to a circle when its slope is identical to the slope of the circle at the point where they meet. This slope is calculated by taking two different points on the circle, and by then diminishing almost infinitely the distance between those two points. This is what I have done while writing the code for this animation. I was interested in what kinds of shapes I would obtain by playing with these notions, and I ended up with a dense mesh of tangent lines evenly distributed around a circle. I then got curious about how the mesh would “react” if I morphed the shape of the circle, and this animation was the result.

The code written to make this animation can be found on GitHub. I also created a few variations of the animation using the p5.js web editor. You can find some variations here, here, and here.

After making this experiment, I watched a video on calculus by 3blue1brown in which I learned that “the derivative of a function is equal to the slope of a line tangent to the graph at a single point”, and is calculated thusly:

Where dt is the difference in time as it approaches 0 (this would typically be the x axis on a graph), ds is the difference is speed (the y axis), and t is time. Also, in this equation, it’s important to notice that a term like s(t+dt) is not a multiplication ; it’s a function and should be read as “s of (t+dt)”.

### Context

This blog post is part of my research project Towards an algorithmic cinema, started in April 2018. I invite you to read the first blog post of the project to learn more about it.