Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I often have to create new computer science algorithm. The problem come when I have to describe them in a scientific way. I don't know where I should look for to learn how to describe my algorithms with a mathematical notation. I can do some basic stuff such as describing the different set I use and their relations... but that's all.

So I want to know if there are good book about mathematical description of algorithms. Also, what part of math should a study for that (first order logic, propositionnal logic,?)

Thank you.

share|cite|improve this question
Sometimes words are better than mathematical notation... – J. M. Aug 4 '11 at 21:35
You are right, but sometime we don't have much choice. – Zonata Aug 4 '11 at 21:38
It may help that you talk about what your algorithms are. More often than not notation is clutter free as opposed to words, but as J.M mentioned, sometimes words are just better. – picakhu Aug 5 '11 at 0:01
up vote 2 down vote accepted

If it's truly important to describe the algorithm in mathematical notation, look to Haskell for inspiration. Many Haskell statements can be translated directly into mathematical notation. For example, the definition

fac 0 = 1
fac n = n * fac (n - 1)

is equivalent to the mathematical statements

$$\begin{align*}fac(0) &= 1\\fac(n) &= n\ fac(n - 1)\ (\operatorname{if} n \ne 0).\end{align*}$$

In practice, however, what you really want is usually to write algorithms precisely, with mathematical terminology. In order to accomplish this, it is essential to practice doing so, and to ask other people for feedback. You can't learn to play the piano by reading books about it, nor can you learn piano while wearing earmuffs. Look at examples, too; every time you look at an example and think "oh, what a good idea!", you've learned something.

Really, I don't know of any better ways to learn this. Think of an algorithm, and try to write it down in a way that a mathematician would understand. Ask a mathematician if they understand. If not, figure out why. Repeat.

share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.