Prime numbers have been understood at least since the Ancient Greeks, and possibly since the Ancient Egyptians. In modern times their study has intensified greatly due to their usefulness, notably in encryption, and because computers enable them to be calculated to a massively higher level than could be done by hand.
It doesn't take much thought to realise that the whole area of phonetic algorithms is a minefield, and Soundex itself is rather restricted in its usefulness. In fact, after writing this implementation I came to the conclusion that it is rather mediocre but at least coding it up does give a better understanding of how it works and therefore its usefulness and limitations.
Wikipedia has a surprisingly brief article on the topic Soundex on Wikipedia which you might like to read.
You could reasonably argue that data structures and algorithms are at the heart of computer science. This leads to the widespread belief that they are also at the heart of software development and that a detailed or even profound knowledge of them is necessary to be a decent programmer. I believe that while it doesn't do any harm to learn them in depth it is not the best use of your time.
I recently wrote a post on RGB/HSL Conversions in Python and as a follow-up I decided to put together a simple Tkinter application which enables users to display a colour by selecting any combination of hue, saturation and lightness.
This application is only a toy but playing with it for a few minutes does give an intuitive understanding of the HSL system, and reinforces my conviction that it is easier to comprehend than RGB. And if you have never used Tkinter this project also provides a simple introduction to the topic.
The most common ways of encoding colour values are RGB (red, green and blue) and HSL (hue, saturation and lightness). I will show how you can convert between the two in Python.
A while ago I wrote a post called Colour Converter in C about converting RGB (red/green/blue) values to HSL (hue/saturation/lightness) and back again. As part of a project which I am planning I need to be able to do the same in Python and was intending to re-write the C in Python, or probably Cython. However, I then found a module called colorsys in an obscure corner of the Python Standard Library. This module includes functions to do the conversions I will need, and in this post I will demonstrate using them to create an array of HSL values from a Pillow image, and then convert these back to RGB to create a new identical image.
Graph Theory is a vast area of study based around the simple idea of individual points - known as vertices - connected by lines known as edges, each of which may have an associated numeric values called a weight and perhaps also a direction.
These simple sets of vertices, edges, weights and directions are known as graphs (not to be confused with the more familiar graph of data or a mathematical function) and can be used to represent many real-world situations or abstract concepts. Once you have a graph stored in some kind of data structure there are many algorithms which can be applied to solve problems, especially those of optimisation.
This post is the first of potentially many, and in it I will develop a data structure to store a graph. In future posts I will implement some of the algorithms which operate on graphs.