9

If you load the bc math library you get the trig functions s() and c() and a() which are sine, cosine, and arctangent respectively. Why these three functions?

I know why it's those three from the mathematical perspective: it's because those are the three you need to translate directly between Cartesian and polar coordinates. I'm a math teacher, and this is unfortunately the only place I've seen sine/cosine/arctangent established as the set of primitive trigonometric functions, so I was hoping someone could tell me why in a more historical context. Idk I mostly need ammo when talking with math educators about why it's not a blasphemous idea to introduce arctangent to students before tangent.

10
  • 1
    The answer might well be in Robert Morris’ memorandum titled A Library of Reference Standard Mathematical Subroutines, if you can get a hold of it... Commented Jun 2, 2021 at 16:59
  • 2
    Please use comments for their intended purpose: requesting clarifications from the author. If you want to discuss trigonometry, please take it to chat..
    – terdon
    Commented Jun 2, 2021 at 18:11
  • 1
    So yeah. This question first asks "why these three functions", and then ends with saying that "you need ammo for math educators". Especially that last part leads me to think that you're asking about the choice of those three functions in general, in which case this question would probably be better answered in either math.SE, or matheducators.SE. Then again, you say that you already know the reason, so I'm not sure what the question is all about anyway.
    – ilkkachu
    Commented Jun 2, 2021 at 18:38
  • 2
    @xhienne It's that second bit. Teaching trig I introduce these three functions before any of the others (like tan() or arcsin() or chord() etc) but that's unusual among math teachers. When asked why I do this by other math teachers I want to respond "Well you can build all the other trig functions from these, and it's been a standard in [industry] to define these as the primitive ... blah blah ... since [person] first wrote [book/paper/program] in [year] ..." or something like that, where I fill in those details with what I learn from the answer to this question ;) ... Commented Jun 2, 2021 at 23:44
  • 1
    I don't know if it influenced it, but that a(1)*4 produces pi at whatever scale you are at avoids you having to have a special pi function or var that scales itself. Also, the namespace (single letter) for functions was constrained, so some minimization was necessary. Characters were more expensive in the 70s.
    – mevets
    Commented Jun 3, 2021 at 21:14

1 Answer 1

13

Not a full answer, but perhaps somewhat useful.

More of a list of examples of use of trig functions in early adaptions. Also a look into the UNIX world.


ALGOL

Interesting paper concerning the history:

ALGOL was developed back in 1950's. In a joint meeting between European and American computer scientists in 1958 - where one also got Preliminary Report on the International Algorithmic Language aka The Zurich Report. In the times the work was to unify the notation and how one write algorithms for computers. As an excerpt from the 58' report to show some of the discussion in that regard:

“Identifiers designating functions, just as in the case of variables, may be chosen according to taste. However, certain identifiers should be reserved for the standard functions of analysis.

This reserved list should contain:

abs (E)    for the modulus (absolute value) of the value of the expression E
sign (E)   for the sign of the value of E
entire (E) for the largest integer not greater than the value of E
sqrt (E)   for the square root of the value of E
sin (E)    for the sine of the value of E
and so on according to common mathematical notation.”


From ALGOL 58 one got ALGOL 60 where, one perhaps, can say that the work also is more concrete on what to have as a basic (in regards to trig functions:

http://web.eecs.umich.edu/~bchandra/courses/papers/Naure_Algol60.pdf

Report on the algorithmic language ALGOL 60

In short it recommends that sin, cos and arctan as standard functions.


ALGO

If one look at installations performing math in the digital era one early machine was the Bendix G-15 computer (late 1950's). It uses ALGO which was influenced by ALGOL 58. It has a library which is not part of the Algo system. The routines in the library is as follows, SIN, COS, ARCTN:

ALGO Library Routines

  • Manual for ALGOOperating instructions
  • Programmers reference manual (G15D - Side note: has some interesting sections on explaining various aspects, for example how bits, bytes, words are grouped and the use of the magnetic drum as RAM)
  • Programs and subroutines Has for example routines for calculating arcsine and arccosine by use of arctan. (The routine cards are dated 1957, so not sure if it was part of some preliminary experimenting:?)

To use these routines was loaded by using code words:

SIN    0101000
COS    0168000
ARCTN  0164000

Loaded as for example:

LIBRAry SIN{0101000}

As it states

"Machine language routines may be added to the library.", but these three was the ones included in the library. (It also uses sexadecimal for hex - but that is not on point here, but fun.)


UNIX

Version 1 of UNIX included bas, a dialect of basic (owned by Thompson). It included the following builtin functions: arg, exp, log, sin, cos, atn, rnd, expr and int.

Version 2 also had bas and in addition one find a list of subroutines where it list among others: atan, hypot, log, sin (sine / cosine). It also was bundled with dc.

There is also bc, but that was for compiling B program.

Also worth mentioning: ttt (tick-tack-toe), bj (black-jack), moo (the game of MOO).

Version 5. If one want to look at the source code for sin/cos, atan etc. one can for example look at this code:

  • Subroutines: usr/source/s3/{atan.s,sin.s}
  • BASIC builtins: usr/source/s1/bas4.s

NB! Archives in for example 1972-stuff (s2) has absolute paths!


The mathlib found in V7 was expanded to include tan etc.

Also includes Fortran77.


BC

BC saw the light of day back in 1975, and as noted in question, also includes these three basic methods. Developed by Robert Morris and Lorinda Cherry. From /usr/doc/bc/bc in the V6 release (1975):

3. There is a library of math functions which may be obtained by typing at command level

bc –l

This command will load a set of library functions which, at the time of writing, consists of sine (named `s'), cosine (`c'), arctangent (`a'), natural logarithm (`l'), exponential (`e') and Bessel functions of integer order (`j(n,x)'). Doubtless more functions will be added in time. The library sets the scale to 20. You can reset it to something else if you like. The design of these mathematical library routines is discussed elsewhere [4].

  • [4] Robert Morris, A Library of Reference Standard Mathematical Subroutines,

That paper however looks to be rather hard to find.

So from the listings it looks like the basic trig functions was part of the system as early as V1. bc utilized these in the load routine.


Notes from Unix Heritage Wiki (cc)

Robert Morris

Life with Unix says: Wrote dc and be with Lorinda Cherry.

A Research Unix Reader says: Bob (Robert) Morris stepped in wherever mathematics was involved, whether it was numerical analysis or number theory. Bob invented the distinctively original utilities typo, and dc-bc (with Lorinda Cherry), wrote most of the math library, and wrote primes and factor (with Thompson). His series of crypt programs fostered the Center's continuing interest in cryptography.

Lorinda Cherry

Life with Unix says: Writer of the Writer’s Workbench (diction, style, etc.), be, and dc. Wrote eqn with bwk.

A Research Unix Reader says: Lorinda L. Cherry collaborated with Morris on dc-bc and typo. Always fascinated by text processing, Lorinda initiated eqn and invented parts, an approximate parser that was exploited in the celebrated Writer's Workbench®, ww6(v8).


Elliott 803

There are of course not then that one do not have systems that implemented more functions, or perhaps was not having these as core functions. But that is history ... :P

Elliot 803 Additions

Elliot 803 Additions:

arccos, arcsin, tan - which are additions to sin, cos, arctan.


FORTRAN

FORTRAN 1958


BASIC

BASIC born 1964 has SIN, COS, TAN and ATN.

BASIC TRIG

BASIC Manual (1964)

As per comment by @roaima.

Most dialects of BASIC used on home computers (circa 1975 onward) also had SIN, COS, TAN, ATN (arctan). No other inverses. I assume TAN was included to minimize the error bound when otherwise using SIN/COS because all these trig functions were generated via a rather small lookup table.

APOLLO 11

The source code for the APOLLO 11 command- and lunar module show they had at least a subroutine for ARCTAN

You can argue they managed to land on the moon without a subroutine for TAN ;)

CORDIC

CORDIC (Volder's algorithm) is a noteworthy mention when it comes to trig implementation.


Statistics

An interesting addition by @Stephen Kitt, from comments:

Another interesting paper is Statistics on the use of mathematical subroutines from a computer center library, published in 1973, which indicates that, at Purdue in early 1973, sin / cos / atan were the most commonly used trig functions, quite far ahead of tan / asin / acos / tanh:

sin  / cos    39,462
atan          27,248

tan            4,707
asin / acos    4,139
tanh           2,546

Dive

Not a deep-dive, but at least a little more on the subject. The paper of ALGOL is perhaps the most on the mark.

As for BC it was without finding a direct quote a decision by Morris / Cherry to include these specific basic functions by loading from library by the -l option.


In short, it is not that one do not want for example tan, but the history show which trig functions was chosen to implement as a base - in the light of resources and use.

4
  • 3
    FWIW most dialects of BASIC used on home computers (circa 1975 onwards) also had SIN, COS, TAN, ATN (arctan). No other inverses. I assume TAN was included to minimise the error bound when otherwise using SIN/COS because all these trig functions were generated via a rather small lookup table Commented Jun 3, 2021 at 7:28
  • 1
    @roaima: Quite so. the rounding error introduced by tan() is expected to be less than that of sin()/cos(). It is not enough however to justify it becoming part of the exclusive set of 3 primitives: sin(), cos() and atan(). Thank you ibuprofen for your very interesting answer.
    – Cbhihe
    Commented Jun 3, 2021 at 7:46
  • 3
    Another interesting paper is Statistics on the use of mathematical subroutines from a computer center library, published in 1973, which indicates that, at Purdue in early 1973, sin/cos/atan were the most commonly used trig functions, quite far ahead of tan/asin/acos/tanh (39,462 for sin/cos, 27,248 for atan, 4,707 for tan, 4,139 for asin/acos, 2,546 for tanh). Commented Jun 3, 2021 at 13:58
  • The bit I liked the most was "Doubtless more functions will be added in time." Sure they will.
    – Hakanai
    Commented Dec 12, 2023 at 16:12

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .