TITLE: Should computer code be included within publications that present numerical results?
QUESTION [34 upvotes]: Many research papers include numerical results obtained through computation. Most of the time such computations are performed using software that is used by many mathematicians, i.e., Maple, Mathematica, or even C/C++ code. Should such code be included in the body of the published paper?
I've heard arguments from both sides:

Including such code can greatly decrease the time taken by a referee to replicate the results,
The code can be easily modified by further authors who wish to extend the result,
The reader does not need to spend time searching the journal website or the Internet for any "auxilliary files" containing the code.

On the other hand,

Pages of code degrade the aesthetic nature of the publication,
The author might need to spend additional space explaining the coding decisions that were made in the algorithms,
It is likely that there exist (much) better ways to write the same algorithms in the given, or any other, language.

So what is the standard in mathematical research papers that present numerical results, either as a main or as a side result? Should code be included within the body of the publication, as an auxilliary file, or not at all?

REPLY [5 votes]: There are some issues that are not emphasised enough in the previous comments and answers. Having the source code used by an author does not let you check that the author's theorems are correct. It only lets you check that the program does what the author claims. Transcribing the program output to the published paper is the step where an error is least likely to have occurred. Much more likely is an error in the program.
So, can you eyeball the program to check if it is correct? Not unless it is a very short simple program. I publish articles that rely on tens of thousands of lines of code that took me and others months of hard work to write and debug. Your chances of looking at it and checking its correctness in a reasonable amount of time are next to zero.  One day there will be programs that can check correctness for you; the beginnings exist today but generally useful checkers are still a long way off.
So what to do? If you are an author, get a coauthor and aim for separately implemented programs that get the same result, hopefully using different methods. (An axiom of software engineering is that programmers solving the same problem using the same method tend to make the same mistakes.) Intermediate results are very useful for checking, especially when the final answer has low entropy (like "yes" or "empty set").
Another fact is that problems which needed very tricky programming and bulk computer time 20 years ago can now be solved in a reasonable time using simpler programs. Presumably that trend will continue. Any computational result that is important enough will eventually be replicated independently without so much effort.