Blog
- Aristotelis Charalampakis
When a programmer deals with mathematics, one of the most common routines added to his/her math library is matrix inversion.
The following code implements a very efficient in-situ matrix inversion (meaning that no memory is allocated for another matrix to hold the result; the inverse of the matrix is built gradually in the matrix itself!).
The code is based on an algorithm published in Numerical Recipes.
The code can be put in a .vb file (e.g., MatrixInversion.vb).
- Aristotelis Charalampakis
The Monty Hall is a famous problem, which can be stated as follows:
Suppose you're on a game show, and you're given the choice of three doors: Behind one door is a car; behind the others, goats. You pick a door, say No. 1, and the host, who knows what's behind the doors, opens another door, say No. 3, which has a goat. He then says to you, "Do you want to pick door No. 2?" Is it to your advantage to switch your choice?
The answer is counter-intuitive; yes, it is advantageous to switch. In fact, if you switch, you have doubled your chances to win. The theory may be difficult to grasp at first, so a computer simulation should verify the answer.
- Aristotelis Charalampakis
Today I stumbled on an program I had written years ago. During a hot summer I used to spend my time solving Sudoku puzzles at the beach - which is quite fun if you are in a must-not-work mode. Of course, very soon I found myself on my laptop, writing a program for creating and solving Sudoku puzzles. The algorithm for the creation of new puzzles is interesting, although probably not the most efficient, and maybe someone else has thought it before me. In any case, I am sharing: