None
Photo by Ricardo Gomez Angel on Unsplash

In this series of 70 articles, we will delve into the fascinating realm where mathematical concepts intertwine with the power of Python programming.

Drawing inspiration from my last book "Unveiling 70 Mathematical Concepts with Python", each article is a gateway to unraveling the beauty and applicability of various mathematical ideas. Whether you're an avid mathematician, a curious student, or a coding enthusiast, this series offers a unique opportunity to explore the synergy between mathematics and Python in a practical and engaging manner.

Each concept is carefully dissected, explained, and enriched with code examples written in Python. As you follow along, you'll witness how mathematical concepts come alive through the execution of elegant algorithms and computational techniques. From fundamental principles to advanced topics, we cover a wide range of mathematical areas, including algebra, geometry, calculus, statistics, and more.

Each article in this series provides clear explanations, step-by-step instructions, and Python code snippets that enable you to experiment and deepen your understanding. Whether you're new to programming or a seasoned coder, the content caters to various skill levels, allowing both beginners and experts to benefit from the fusion of mathematics and Python.

In this first article, we are going to start with a very important concept: linearization.

Linearization

Analysis is a field of mathematics that was invented to work on the study of curves. The questions it tries to answer are like:

  • What is the length of this curve?
  • What is the area of the surface under this curve?
  • Where does this curve change sign?
  • Where does this curve become decreasing?
  • Can I approximate my complex function locally as a linear function?
  • How can I find my function maximum iteratively?

To do this, analysis relies on the use of functions to describe curves. The difficulty in manipulating curves and the functions that define them is that they are… curves. Things would be simpler if all curves were straight lines, described simply with only two points or a point and a slope.

Linearization is a simplification

One of the key concepts of analysis is the mechanism of linearization, whose purpose is to consider the curve locally as a straight line. This principle consists of placing oneself at a point of a curve and approximating this curve by a line that is as similar as possible to it. By staying in a sufficiently small neighborhood, the approximation is then sufficiently good to allow one to work with this line rather than the initial curve. Since a line is defined by only two points, linearizing a curve can be done by taking two points on the curve and connecting them.

By choosing two abscissae x_0and x_1, this line passes through the points (x_0 , f (x_0 )) and (x_1 , f (x_1 )).

None
Two linearisations. Figure by the author.

The figure and the listing above show two line segments constructed using this method. It is clear that the segment created for x 0 = 1 and x 1 = 2 is a better approximation of the curve. The mechanism of linearization is based on this approach using two points, but goes further by making the two points infinitely close together. This is the definition of the tangent, whose slope is given by the derivative.

This line passes through the point (x_0 , f (x_0 )) where we are located and has a slope of f 0 (x 0 ) of the curve at that point. It is therefore the tangent to the curve at the point in question. Its equation is given by:

None
Formula for the tangent in one point x_0. Formula by the author.
None
Tangent in a point. Code by the author.

The function f(x) = x**2 , whose curve is given by the second figure, can be approximated by a line, also represented in the second figure, in the neighborhood of x 0 = 1.0.

The plot shows that the approximation is all the better as we are close to the point where the linearization is made.

The listing above details the implementation of the linearization mechanism and applies it to the case of the function f (x) = x**2 in the neighborhood of x 0 = 1.0.

The method used here to linearize the function at x_0 uses the formal definition, that implies the symbolic derivation of the derivative. There are other options, like numerical differentiation or automatic differentiation that we will see in other articles.

Linearization is a very powerful tool when doing applied mathematics. It allows us to reduce complex problems to simpler, linearised ones.

Many methods are based on linearisation: Newton Raphson, Gradient Descent, numerical integration, …

We will dive into all these subjects in the forthcoming articles.