03/07/2012
In the last four installments of this series, we have seen linear interpolation, cubic interpolation, Hermite splines, and lastly cardinal splines.

In this installment (which should be the last of the series; at least for a while), let us have a look at how we can implement these interpolation efficient.
Read the rest of this entry »
Leave a Comment » |
algorithms, Mathematics, programming | Tagged: ATLAS, Cubic Interpolation, Matrix, OpenBlas, Vector |
Permalink
Posted by Steven Pigeon
26/06/2012
In the last installment of this series, we left off Hermite splines asking how we should choose the derivatives at end points so that patches line up nicely, in a visually (or any other context-specific criterion) pleasing way.

Cardinal splines solve part of this problem quite elegantly. I say part of the problem because they address only the problem of the first derivative, ensuring that the curve resulting from neighboring patches are
-continuous, that is, the patches line up at the same point, and are
-continuous, that is, the first derivatives line up as well. We can imagine splines what are (up to)
-continuous, that is, patches lining up, and up to the
-th derivatives lining up as well.
Read the rest of this entry »
6 Comments |
algorithms, Mathematics, programming | Tagged: C-Continuous, Cardinal Spline, Hermite Spline, interpolation, Spline |
Permalink
Posted by Steven Pigeon
12/06/2012
In previous posts, we discussed linear and cubic interpolation. So let us continue where we left the last entry: Cubic interpolation does not guaranty that neighboring patches join with the same derivative and that may introduce unwanted artifacts.

Well, the importance of those artifacts may vary; but we seem to be rather sensitive to curves that change too abruptly, or in unexpected ways. One way to ensure that cubic patches meet gracefully is to add the constraints that the derivative should be equal on both side of a joint. Hermite splines do just that.
Read the rest of this entry »
3 Comments |
algorithms, Mathematics, programming | Tagged: Bernard l'Hermite, Cubic, Cubic Interpolation, Hermite, Hermite Splines, interpolation, Spline |
Permalink
Posted by Steven Pigeon
29/05/2012
In a previous entry, we had a look at linear interpolation and concluded that we should prefer some kind of smooth interpolation, maybe a polynomial.

However, we must use a polynomial of sufficient degree so that neighboring patches do not exhibit very different slopes on either side of known points. This pretty much rules out quadratic polynomials, because polynomials of the form
are only capable of expressing (strictly) convex (or concave) patches. A quadratic piece-wise function would look something like:
Read the rest of this entry »
3 Comments |
algorithms, Mathematics, programming | Tagged: Cubic, Cubic Interpolation, interpolation, Quadratic, Quadratic Interpolation |
Permalink
Posted by Steven Pigeon
22/05/2012
The Fibonacci numbers are very interesting for many reasons, from seed heads to universal coding (such as Taboo Codes). Just figuring how to compute them efficiently is plenty of fun.

The classical formulation of the Fibonacci numbers is given by the following recurrence:
Read the rest of this entry »
1 Comment |
algorithms, Mathematics, programming | Tagged: Fibonacci, Fibonacci Numbers, pinecone, Rabbits |
Permalink
Posted by Steven Pigeon
15/05/2012
In a couple of different occasions I discussed the topic of interpolation, without really going into the details. Lately, I had to interpolate data and that got me interested (again) in interpolation; and I think I should share some of the things I learned.

In this first post (of a series), let us begin by the simplest interpolation of all (after constant interpolation): linear interpolation.
Read the rest of this entry »
3 Comments |
algorithms, Mathematics, programming, Science | Tagged: algebra, interpolation, Linear Interpolation |
Permalink
Posted by Steven Pigeon
08/05/2012
Two weeks ago I attended the Hackreduce Hackathon at Notman House to learn about Hadoop. I joined a few people I knew (and some I just met) to work on a project where the goal was to extract images from the Wikipedia and see if we could correlate the popularity, as the number of references to the image, to some of the intrinsic images characteristics.

But two other guys I know (David and Ian) worked on a rather amusing problem: finding domain names that can be parsed in multiple, hilarious ways. I decided to redo their experiment, just for fun.
Read the rest of this entry »
Leave a Comment » |
algorithms, C-plus-plus | Tagged: domain names, double entendre, Hackathon, Hackreduce, Hadoop, Notman House |
Permalink
Posted by Steven Pigeon
01/05/2012
Quite a while ago, I presented the Collatz conjecture and I was then interested in the graphical representation of the problem—and not really going anywhere with it.

In this entry, let us have a look at the implementation of the Collatz function.
Read the rest of this entry »
1 Comment |
algorithms, assembly language, C, C-plus-plus, Mathematics, programming | Tagged: assembly language, Collatz, Conjecture |
Permalink
Posted by Steven Pigeon
24/04/2012
In a previous post, I presented (generalized) linear regression from a linear algebra point of view (namely, the “normal equations”) and in this post, I discuss yet another take on the problem, this time using gradient descent.

Gradient descent isn’t particularly fascinating for this particular task (as we know closed, analytical expressions for obtaining the parameters), but linear regression is the simplest example of gradient descent I could come up with without being completely trivial.
Read the rest of this entry »
22 Comments |
algorithms, machine learning, Mathematics | Tagged: Gradient, gradient descent, linear regression, Machine Learning, Neural Networks |
Permalink
Posted by Steven Pigeon
17/04/2012
I sometimes have quite nerdy readings. As of late, I’ve been reading Le fabuleux destin de
(The Fabulous Destiny of
, one might translate) by Benoît Rittaud. This book is a treasure trove of
facts, and one caught my eye more than the others so far: an iterative method to compute square roots of any (positive) number.

When the method is first presented, he leaves to the reader to find a demonstration (though he gives one much later on, several chapters later), but let’s see what we can find.
Read the rest of this entry »
5 Comments |
algorithms, hacks, Mathematics, Science | Tagged: √2, Iterative, Newton, Newton's Method, Square root |
Permalink
Posted by Steven Pigeon