Here's how I like to solve my equations: just walk around randomly until I trip over a solution!

Random walks (check my older post here) and Diophantine equations are two simple mathematical beasts. After a college seminar, I tried putting them together to make something neat, and came up with this: just pick a Diophantine equation, simulate a random walk, and try to see if the random walk went over any solutions! In this report I briefly go over how I came up with this, and show the code I wrote/some results. The Matlab code is all in here (I also have some Python code about random walks here, check my post!).

In the image above, the blue line represents a path taken by the random walk and in orange/red the nodes tell us how far we are from a solution (the smaller the node, the closer we are). Note that this notion of proximity isn't given by actually computing the distance to a known solution, but just by looking at how similar the two sides of the equation are. The image below shows the evolution of three independent random walks trying to find an example solution of \(\frac{4}n = \frac1x + \frac1y + \frac1z\) with \(n = 25\) (that expression is the expression of the Erdös-Straus conjecture).

If you enjoyed this blog article, you will love the mathspp insider 🐍🚀 newsletter! Join +16.000 others who are taking their Python 🐍 skills to the next level! 🚀