12

In mathematical scientific papers, which section would I detail pseudo code or sample source code? Would that be included in an Appendices section or above under Methods?

  • 3
    personally, i think pseudo code should go in an Appendix. but the math and the description of the alg should be in the body, and then i dunno why you even need pseudo code. – robert bristow-johnson Nov 24 '15 at 6:46
  • 4
    @robertbristow-johnson Because "math and descriptions" of algorithms are usually unclear and not definite (from the perspective of "I want to implement this"). In short, it's not even an algorithm, arguably, but a more or less rough sketch of an idea of how to get one. Which is not necessarily a problem, depending on your message, but it certainly is if you start analysing the algorithm you have in mind. – Raphael Nov 24 '15 at 15:31
  • What kind of code are we talking about? What's the reason why you need to include it? – Jakub Konieczny Nov 24 '15 at 15:49
  • 1
    i would invite Sean to post a segment of pseudo-code that is short enough to be appropriate for publication, and i will show Sean how to express it with words, mathematical assignment statements, and case statements. (which, of course, is pseudo-code, but of a format and language recognized by all.) – robert bristow-johnson Nov 24 '15 at 19:47
  • 1
    doesn't look like code to me. it looks like data. put it in a matrix. – robert bristow-johnson Nov 25 '15 at 21:14
19
  • How long is it?
    • If short put it in the paper
    • If long put it in the appendix
  • Can your paper stand with-out it?
    • If so, then it is supplementary, so goes with the supplementary materials, i.e. in the appendix
    • If not, then it needs to be in the paper.

If it is both Long and Required, then perhaps you are writing overly detailed pseudocode. I know the formal pseudocode I learnt in high school was detailed to the point of being executable -- which defeats the purpose of pseudo-code -- if it can be written clearly in a language that is in common use in your area (E.g. R for statisticians, Matlab for signals engineers) you can just write it in that language and avoid any ambiguity.

If on the other hand it is short and not required, it can go anywhere (Possibly even in a footnote). Though its still not required.

A common pattern, I've seen a few times is to have pseudocode, or just textual descriptions of the algorithm in the main text. Then an implementation in a real programming language in an appendix; And/Or a footnote linking to the authors website/github where it can be downloaded

  • I want to avoid any current programming languages (such as C++, PHP or Python) and allow the reader to produce an array of graph points relevant to the discussion of the paper without being language specific. I was thinking the appendix would be a good place, even if the pseudo code is short. – John Edward Law Nov 24 '15 at 16:14
4

The most important deciding factor is your reason for wanting to include the pseudo code.

If the code is meant to make understanding the paper easier, then by all means include it in the main body of the paper. For instance, if you described a method for solving a certain problem, but then you want to give a more precise and succinct description in the form of the pseudo code, then the reader will want to see it as soon as he reads about your method. As a special case, if the code is essential to your argument, you should definitely include it in the main body. Depending on the level of complication, you might either want to put it in the introduction (if it's very short) or later on.

On the other hand, if the code is meant to just make precise things that the reader already knows, then it's best deferred to the appendix. For instance, suppose that you are writing a pure mathematics paper, and you employed the computer to check some standard (but tedious) estimates for you. Then you might want to include the code so that the inquisitive reader can check that you got all the technicalities right, but most people will be more than happy to never have to look at them.

As a rule of thumb, put things in the appendix if (and only if) you expect an average reader will not want to see them. This could be for a variety of reasons, the most important of which are a) the material is standard, and included for the sake of completeness, b) the material is technical, and reading though it actually makes it harder to understand what's going on (unless one already has a good grasp of the main ideas).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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