Floating in C++ - part 3 - Integration

The introduction to this article series can be found here, whereas here you can find all posts. A common task in numerical analysis is to approximate the value of an integral. In general, integrals are difficult to calculate, unless the function is a polynomial, therefore there are a lot of different techniques. Most of those rely on the concept we already used when interpolating functions: Replace a complex function with a polynomial of lower grade.

Read more →

Floating in C++ - part 2 - Interpolation

The introduction to this article series can be found here, whereas here you can find all posts. How To Represent Polynomials Polynomials are mathematical functions with a lot of nice properties. They are easy to calculate, easy to derive, interpolate, multiplicate together, and more. Therefore it shouldn’t surprise anyone that there are algorithms to approximate more complex functions with polynomials. While those algorithms are not complicated, the first problem to solve is the following: how can we represent polynomials in C++?

Read more →

Floating in C++ - part 1 - Root problem

In this article, I’m going to implement the Bisection method and Newton’s method, both used for finding the root of a generic function.

Read more →

Floating in C++

One part of C++ that I almost never use is the whole floating point environment. During my studies at University I’ve done some numerical approximation in C, but mostly in MATLAB (Octave at home), which offers a lot of tools ready to use. Some professors did prefer to write the code in C, and for some machines, we did not have the appropriate license for running MATLAB. Therefore for some courses, we simply could not use a more advanced environment.

Read more →

C++ Comparison operators

During the last days, I tried to clean up various side projects I had at home. I quickly noticed that a common source of boilerplate code is the implementation of the comparison operators, like operator<, operator> and operator==. The complete list of comparison operators can be found here. Normally we do not pay a lot of attention to those operators, but when we use them, there are a lot of hidden expectations.

Read more →

undo in git

Git is one of the most known, and controversially, most complicated tools for managing source code. There are a lot of tutorials showing how to use git to add, commit, and pull your code, view the history, change between branches, and so on. So far all good, since git is complicated: every file has multiple possible states, like committed, modified, and staged. Moreover, you may have to consider submodules, branches, merges, the stash, etc.

Read more →