Hillsoft Blog

Exploring Maths and Computing

Blog

Surprises in C++: When References Aren't References

C++ has a reputation for being one of the fastest languages out there but this is only the case when it’s written reasonably well. One of the biggest offenders from a performance point of view is unnecessary copies and they can quickly lead to C++ code being extremely slow. One of the main solutions to this problem is to use references and pointers in the parameter and return types.

Read more...


C++ Lifetime Quiz Part 2

Copies and moves may seem to have obvious lifetime implications but the reality is unfortunately not quite so simple.

Read more...


C++ Lifetime Quiz Part 1

Many object-oriented languages have constructors, a special type of method for creating objects. These have a wide variety of uses including custom type conversion logic, calculating derived data the object needs to store, validating inputs, and resource acquisition.

Read more...


Lambda Calculus Part 2: Numbers and Arithmetic

Having now seen the building blocks of the Lambda Calculus, we must ask ourselves whether this is actually a useful system or if, as it may first appear, it is capable of nothing more than shuffling symbols around on a page. To begin to construct any useful algorithm using this system, we first need a way to represent the data that the algorithm requires. While it is certainly debatable, I would suggest the natural numbers are a sensible place to start. To achieve this, we will use the scheme of Church numerals.

Read more...


Lambda Calculus Part 1: The Rules of the Calculus

Algorithms have been an essential part of mathematics since it’s earliest days. Arithmetic algorithms such as long multiplication and long division are likely to be familiar to you, and some of these have been around for millennia, as early as 2500 BC. In the 3rd century BC, the algorithm called the ‘sieve of Eratosthenes’ was developed by the Greeks to find prime numbers. With the development of computers, which are essentially just machines that can carry out algorithms, the world has been transformed.

Read more...


What is Maths Part 6: The Prime Numbers

Up until this point, it has looked like addition and multiplication are really very similar. Both addition and multiplication are commutative. Both addition and multiplication are associative. There is also a cancellation lemma for multiplication, although with a small difference; it states that if \( a \times b = a \times c \) and \( a \neq 0 \), then \( b = c \).

Read more...


What is Maths Part 5: Multiplication and Beyond

Now that we have introduced addition into the world of number theory, we can introduce multiplication as well.

Read more...


What is Maths Part 4: Addition

Now that we are armed with induction, recursion, and our fundamental axioms, we are finally ready to tackle something more complicated: addition! As I’m sure you’re already familiar with the concept of addition, let’s start by defining it in the context of our number theory.

Read more...


What is Maths Part 3: Induction

I think it’s now time that we discuss the fifth axiom. It is special, subtle, and much less obvious than the first four axioms. It is, in fact, special enough to get a proper name—the inductive axiom—and the process of using it also has a name—induction.

Read more...


What is Maths Part 2: Number Theory

In the late 19th century Peano proposed a set of axioms for Number Theory, which is the study of non-negative whole numbers (i.e. 0, 1, 2, 3, …). His axiomatisation of this field of maths was not only one of the earliest efforts at axiomatisation, but was also so successful that is still used today with only minor modifications. As a side note, the earliest known axiomatisation effort was Euclid's geometry, over 2000 years earlier. I still, however, feel justified in saying that Peano’s is one of the earliest because there weren’t really any attempts between Euclid and the 19th century. It would be fair to say that Euclid was well ahead of his time.

Read more...


What is Maths Part 1: Why we Need Formal Maths

I'm sure that asking what maths is would seem strange to most people. We have studied maths at school, we know what numbers are, and we know our times tables. On top of these fundamentals, maths education in England includes many sophisticated topics such as calculus, simultaneous equations, and more.

Read more...