Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

I have a basic notation/convention question. I'm writing a program in Pascal programming language which does computations in the rational number field (ℚ). For that i defined a data type, which represents a vulgar fraction:

type Rational = record
  Numerator: Integer;
  Denominator: Natural;
end;

I hope this declaration is pretty obvious for anyone who know about fractions regardless Pascal knowledge. However, while working with this data type i figured out what what Denominator identifier is unconveniently long. Eg, simple notation, which is usualy compact on the paper (on in MathCAD) becomes quite large when expressed in Pascal:

C.Numerator := A.Numerator * B.Denominator + A.Denominator * B.Numerator;

So, my question is: What is common and widely recognized abbreviations for Numerator and Denominator terms for Anglophone mathematicians? As we have Re(C) and Im(C) brief and common notation when referring to the components of complex number.

share|improve this question

closed as too localized by Arthur Fischer, MJD, William, Noah Snyder, Nate Eldredge Oct 6 '12 at 16:04

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question.

1  
Mathematicians rarely have a need to abbreviate these words. You would probably be better off asking computer programmers, such as on stackoverflow.com. That said, I think the labels num and denom are pretty common. –  Nate Eldredge Oct 6 '12 at 16:04

3 Answers 3

up vote 3 down vote accepted

I don't know enough Pascal to know if this is feasible, but I'd try and abstract as many common operations on fractions into their own functions and operators, so that accessing the numerator and denominator explicitly becomes the exception rather than the norm.

IIRC, Pascal doesn't feature operator overloading (some other languages do, e.g. C++, Haskell), so you can't do things like these (inventing the // operator to construct a fraction):

a := 2 // 3;
b := 3 // 4;
c := a * b;

...but I'm sure you can make it so that you can do:

a := frac(2, 3);
b := frac(3, 4);
c := fracMul(a, b);

This approach completely removes the words 'numerator' and 'denominator' from the code, just like they don't typically appear in Mathematical formulae. The downside is that the syntax becomes more like nested function calls and less like formulae.

If you have to give them names, I'd go with either:

  • both names spelled out in full
  • num and den (as long as it's clear you're in a fraction context, there should be no confusion)
  • n and d (less descriptive, but shorter and still easy to remember)
  • p and q (even less descriptive, but a common choice in Mathematics)

Which one you choose depends on your audience and how far you can take the above approach; e.g. if you need a lot of direct access to numerator and denominator, shorter names make more sense; if the fraction context isn't always obvious, more descriptive names are better; when the audience is mathematicians, p and q are more viable than when you write for casual programmers.

share|improve this answer

$p$ and $q$? Usually, rational numbers are defined as numbers of the form $p/q$.

share|improve this answer
    
...and then, within the code, just add a preliminary comment that $p$ and $q$ denote such-and-such in what follows... –  J. M. Aug 24 '12 at 8:49

I would lean towards "num" and "den", except that "num" might be confused with shorthand for "number". Realistically, I would recommend gritting your teeth and simply typing (or copy/pasting) the entire word - it'll minimize the potential for confusion if you should have to come back to your code later when it's not fresh in your memory.

share|improve this answer
    
In context, num should not be easy to mistake for number. –  Johannes Kloos Aug 24 '12 at 8:56

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