In this post I will write code in C to convert colour values between decimal red, green and blue, hexadecimal RGB, and hue, saturation and lightness or HSL.
Continue reading
In this post I will write code in C to convert colour values between decimal red, green and blue, hexadecimal RGB, and hue, saturation and lightness or HSL.
Continue reading
In this post I will develop an SVG-based JavaScript multi-segment display widget for embedding in a web page to emulate the kind of displays commonly used on electronic equipment.
The widget will be able to display numbers, letters and various other symbols as well as having customizable colours.
Continue reading
This is a relatively short and simple project which will calculate a few simple statistics from an array of numbers. It covers the most basic areas of classical statistics which might seem a bit old-fashioned in an era of big data and machine learning algorithms, but even the most complex of data science investigations are likely to start out with a few simple statistics.
Continue reading
I recently posted articles on memoization of factorials and calculating sines and cosines with Taylor polynomials. It seems logical to combine the two principles and write a library to memoize the trigonometric values sine, cosine and tangent.
If you just need a few values then this approach is overkill, but some applications require very heavy use of trigonometry and so need all the optimization they can get. In particular 3D graphics consist of large numbers of triangles, the positioning and rendering of which requires some serious use of trigonometry.
Continue reading
In this post I will write a C library to calculate sines and cosines using Taylor polynomials. It is impossible to calculate these directly but they can be approximated to any accuracy using this method, and I will show how a Taylor series converges to ever-increasing accuracy.
Continue reading
All the posts on this blog contain code which has been reformatted as HTML. This would be incredibly tedious to do by hand so I put together this little web application to do the job for me.
Continue reading
I am currently working on an article about calculating sines and cosines using Taylor Polynomials. These make heavy use of factorials so I started thinking about ways to streamline the process.
This post consists of a simple project using memoization with a lookup table to pre-calculate factorials and store them for future use.
Continue reading
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.
The best know (and according to Wikipedia still the most widely used) method for identifying them is the Sieve of Eratosthenes, which I will implement here in C.
Continue reading
You can calculate the Fibonacci Sequence by starting with 0 and 1 and adding the previous two numbers, but Binet's Formula can be used to calculate directly any term of the sequence. This short project is an implementation of the formula in C.
Continue reading
This is a simple little C project demonstrating a useful application of logarithms, with the bonus of a few lines demonstrating localization.
Continue reading