How did the apollo computers evaluate transcendental functions like sine, tangent, log?
Clash Royale CLAN TAG#URR8PPP
up vote
1
down vote
favorite
Navigation with a sextant or maneuvers using gimbal angles might be two examples of cases where an apollo computer might need to do trigonometry.
sine, cosine, tangent, etc. are transcendental functions, as are logarithms. You can't evaluate these functions with a simple expression built on multiplication or division for example, without at least an iterative algorithm.
An engineer on the ground would grab a slide rule for two or three digits, and for more go to a book of trig, log and other tables for more digits. Between two lines you could interpolate by hand for even more digits.
But how did the apollo computers evaluate transcendental functions, or how at least were calculations that required the use of transcendental functions implemented in the programs?
apollo-program history mathematics
add a comment |Â
up vote
1
down vote
favorite
Navigation with a sextant or maneuvers using gimbal angles might be two examples of cases where an apollo computer might need to do trigonometry.
sine, cosine, tangent, etc. are transcendental functions, as are logarithms. You can't evaluate these functions with a simple expression built on multiplication or division for example, without at least an iterative algorithm.
An engineer on the ground would grab a slide rule for two or three digits, and for more go to a book of trig, log and other tables for more digits. Between two lines you could interpolate by hand for even more digits.
But how did the apollo computers evaluate transcendental functions, or how at least were calculations that required the use of transcendental functions implemented in the programs?
apollo-program history mathematics
Are you sure about the need to do trigonometry for gimbaling? I'm pretty sure it would be easier to stay within vector math if you use a linear actuator. Anyway trignonometry functions are usually implemented by table lookup or approximated as a taylor expansion. No source directly related to Apollo, sorry.
– Christoph
1 hour ago
...or both, the taylor expansion preparing lookup tables on startup, in case permanent storage is less abundant than RAM.
– SF.
1 hour ago
@Christoph First sentence starts with two instruments that likely produce angular data. Also, what was done in the 1960's in computers in space, is not covered by how things are done now. I'll add thehistory
tag to make that even clearer. You might also consider where tables would have to be stored, there was precious little memory in the Apollo computers.
– uhoh
1 hour ago
@Christoph have a look here: youtu.be/9YA7X5we8ng?t=1283 and also here youtu.be/YIBhPsyYCiM?t=273
– uhoh
1 hour ago
@Christoph: Already in 1956 we had a better algorithm than Taylor, namely CORDIC. I don't know if that was used in Apollo.
– MSalters
53 mins ago
add a comment |Â
up vote
1
down vote
favorite
up vote
1
down vote
favorite
Navigation with a sextant or maneuvers using gimbal angles might be two examples of cases where an apollo computer might need to do trigonometry.
sine, cosine, tangent, etc. are transcendental functions, as are logarithms. You can't evaluate these functions with a simple expression built on multiplication or division for example, without at least an iterative algorithm.
An engineer on the ground would grab a slide rule for two or three digits, and for more go to a book of trig, log and other tables for more digits. Between two lines you could interpolate by hand for even more digits.
But how did the apollo computers evaluate transcendental functions, or how at least were calculations that required the use of transcendental functions implemented in the programs?
apollo-program history mathematics
Navigation with a sextant or maneuvers using gimbal angles might be two examples of cases where an apollo computer might need to do trigonometry.
sine, cosine, tangent, etc. are transcendental functions, as are logarithms. You can't evaluate these functions with a simple expression built on multiplication or division for example, without at least an iterative algorithm.
An engineer on the ground would grab a slide rule for two or three digits, and for more go to a book of trig, log and other tables for more digits. Between two lines you could interpolate by hand for even more digits.
But how did the apollo computers evaluate transcendental functions, or how at least were calculations that required the use of transcendental functions implemented in the programs?
apollo-program history mathematics
apollo-program history mathematics
edited 1 hour ago
asked 2 hours ago


uhoh
28.3k1392350
28.3k1392350
Are you sure about the need to do trigonometry for gimbaling? I'm pretty sure it would be easier to stay within vector math if you use a linear actuator. Anyway trignonometry functions are usually implemented by table lookup or approximated as a taylor expansion. No source directly related to Apollo, sorry.
– Christoph
1 hour ago
...or both, the taylor expansion preparing lookup tables on startup, in case permanent storage is less abundant than RAM.
– SF.
1 hour ago
@Christoph First sentence starts with two instruments that likely produce angular data. Also, what was done in the 1960's in computers in space, is not covered by how things are done now. I'll add thehistory
tag to make that even clearer. You might also consider where tables would have to be stored, there was precious little memory in the Apollo computers.
– uhoh
1 hour ago
@Christoph have a look here: youtu.be/9YA7X5we8ng?t=1283 and also here youtu.be/YIBhPsyYCiM?t=273
– uhoh
1 hour ago
@Christoph: Already in 1956 we had a better algorithm than Taylor, namely CORDIC. I don't know if that was used in Apollo.
– MSalters
53 mins ago
add a comment |Â
Are you sure about the need to do trigonometry for gimbaling? I'm pretty sure it would be easier to stay within vector math if you use a linear actuator. Anyway trignonometry functions are usually implemented by table lookup or approximated as a taylor expansion. No source directly related to Apollo, sorry.
– Christoph
1 hour ago
...or both, the taylor expansion preparing lookup tables on startup, in case permanent storage is less abundant than RAM.
– SF.
1 hour ago
@Christoph First sentence starts with two instruments that likely produce angular data. Also, what was done in the 1960's in computers in space, is not covered by how things are done now. I'll add thehistory
tag to make that even clearer. You might also consider where tables would have to be stored, there was precious little memory in the Apollo computers.
– uhoh
1 hour ago
@Christoph have a look here: youtu.be/9YA7X5we8ng?t=1283 and also here youtu.be/YIBhPsyYCiM?t=273
– uhoh
1 hour ago
@Christoph: Already in 1956 we had a better algorithm than Taylor, namely CORDIC. I don't know if that was used in Apollo.
– MSalters
53 mins ago
Are you sure about the need to do trigonometry for gimbaling? I'm pretty sure it would be easier to stay within vector math if you use a linear actuator. Anyway trignonometry functions are usually implemented by table lookup or approximated as a taylor expansion. No source directly related to Apollo, sorry.
– Christoph
1 hour ago
Are you sure about the need to do trigonometry for gimbaling? I'm pretty sure it would be easier to stay within vector math if you use a linear actuator. Anyway trignonometry functions are usually implemented by table lookup or approximated as a taylor expansion. No source directly related to Apollo, sorry.
– Christoph
1 hour ago
...or both, the taylor expansion preparing lookup tables on startup, in case permanent storage is less abundant than RAM.
– SF.
1 hour ago
...or both, the taylor expansion preparing lookup tables on startup, in case permanent storage is less abundant than RAM.
– SF.
1 hour ago
@Christoph First sentence starts with two instruments that likely produce angular data. Also, what was done in the 1960's in computers in space, is not covered by how things are done now. I'll add the
history
tag to make that even clearer. You might also consider where tables would have to be stored, there was precious little memory in the Apollo computers.– uhoh
1 hour ago
@Christoph First sentence starts with two instruments that likely produce angular data. Also, what was done in the 1960's in computers in space, is not covered by how things are done now. I'll add the
history
tag to make that even clearer. You might also consider where tables would have to be stored, there was precious little memory in the Apollo computers.– uhoh
1 hour ago
@Christoph have a look here: youtu.be/9YA7X5we8ng?t=1283 and also here youtu.be/YIBhPsyYCiM?t=273
– uhoh
1 hour ago
@Christoph have a look here: youtu.be/9YA7X5we8ng?t=1283 and also here youtu.be/YIBhPsyYCiM?t=273
– uhoh
1 hour ago
@Christoph: Already in 1956 we had a better algorithm than Taylor, namely CORDIC. I don't know if that was used in Apollo.
– MSalters
53 mins ago
@Christoph: Already in 1956 we had a better algorithm than Taylor, namely CORDIC. I don't know if that was used in Apollo.
– MSalters
53 mins ago
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
4
down vote
Since the Apollo 11 Code is on Github, i was able to find the code that looks like an implementation of sine and cosine functions: see here for the command module and here for the lunar lander (it looks like it is the same code).
For convenience, here is a copy of the code:
# Page 1102
BLOCK 02
# SINGLE PRECISION SINE AND COSINE
COUNT* $$/INTER
SPCOS AD HALF # ARGUMENTS SCALED AT PI
SPSIN TS TEMK
TCF SPT
CS TEMK
SPT DOUBLE
TS TEMK
TCF POLLEY
XCH TEMK
INDEX TEMK
AD LIMITS
COM
AD TEMK
TS TEMK
TCF POLLEY
TCF ARG90
POLLEY EXTEND
MP TEMK
TS SQ
EXTEND
MP C5/2
AD C3/2
EXTEND
MP SQ
AD C1/2
EXTEND
MP TEMK
DDOUBL
TS TEMK
TC Q
ARG90 INDEX A
CS LIMITS
TC Q # RESULT SCALED AT 1.
The comment
# SINGLE PRECISION SINE AND COSINE
indicates, that the following is indeed an implementation of the sine and cosine functions.
Information about the type of assembler used, can be found on Wikipedia
Partial explanation of the code:
The function SPCOS
first adds one half to the input, and then proceeds to calculate the sine.
This indicates that the function is actually a scaled version of the sine/cosine functions.
The function POLLEY
calculates a polynomial approximation:
First, we store $x^2$ in the register SQ (where $x$ denotes the input).
This is used to calculate the polynomial
$$
((( C_5/2 x^2 ) + C_3/2 ) x^2 + C_1/2) x.
$$
The values for the constants can be found in the same github repository and are
$$
C_5/2= .0363551 approx big(fracpi2big)^5 cdot frac12cdot 5!\
C_3/2= -.3216147 approx -big(fracpi2big)^3 cdot frac12cdot 3!\
C_1/2= .7853134 approx fracpi2 cdot frac12\
$$
which look like taylor coefficients for a scaled version of the sine function.
These values are not exact, but I suspect that the error comes from the low bit resolution.
New contributor
supinf is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
1
I am reading into it, but it is not easy because i am not familiar with the programming language. At first glance it looks like a taylor approximation, but i am not sure. I will edit when i have more.
– supinf
1 hour ago
1
I'm on it... i think it has to do with scaling.
– supinf
46 secs ago
okay have fun I'll be quiet :-)
– uhoh
12 secs ago
add a comment |Â
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
4
down vote
Since the Apollo 11 Code is on Github, i was able to find the code that looks like an implementation of sine and cosine functions: see here for the command module and here for the lunar lander (it looks like it is the same code).
For convenience, here is a copy of the code:
# Page 1102
BLOCK 02
# SINGLE PRECISION SINE AND COSINE
COUNT* $$/INTER
SPCOS AD HALF # ARGUMENTS SCALED AT PI
SPSIN TS TEMK
TCF SPT
CS TEMK
SPT DOUBLE
TS TEMK
TCF POLLEY
XCH TEMK
INDEX TEMK
AD LIMITS
COM
AD TEMK
TS TEMK
TCF POLLEY
TCF ARG90
POLLEY EXTEND
MP TEMK
TS SQ
EXTEND
MP C5/2
AD C3/2
EXTEND
MP SQ
AD C1/2
EXTEND
MP TEMK
DDOUBL
TS TEMK
TC Q
ARG90 INDEX A
CS LIMITS
TC Q # RESULT SCALED AT 1.
The comment
# SINGLE PRECISION SINE AND COSINE
indicates, that the following is indeed an implementation of the sine and cosine functions.
Information about the type of assembler used, can be found on Wikipedia
Partial explanation of the code:
The function SPCOS
first adds one half to the input, and then proceeds to calculate the sine.
This indicates that the function is actually a scaled version of the sine/cosine functions.
The function POLLEY
calculates a polynomial approximation:
First, we store $x^2$ in the register SQ (where $x$ denotes the input).
This is used to calculate the polynomial
$$
((( C_5/2 x^2 ) + C_3/2 ) x^2 + C_1/2) x.
$$
The values for the constants can be found in the same github repository and are
$$
C_5/2= .0363551 approx big(fracpi2big)^5 cdot frac12cdot 5!\
C_3/2= -.3216147 approx -big(fracpi2big)^3 cdot frac12cdot 3!\
C_1/2= .7853134 approx fracpi2 cdot frac12\
$$
which look like taylor coefficients for a scaled version of the sine function.
These values are not exact, but I suspect that the error comes from the low bit resolution.
New contributor
supinf is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
1
I am reading into it, but it is not easy because i am not familiar with the programming language. At first glance it looks like a taylor approximation, but i am not sure. I will edit when i have more.
– supinf
1 hour ago
1
I'm on it... i think it has to do with scaling.
– supinf
46 secs ago
okay have fun I'll be quiet :-)
– uhoh
12 secs ago
add a comment |Â
up vote
4
down vote
Since the Apollo 11 Code is on Github, i was able to find the code that looks like an implementation of sine and cosine functions: see here for the command module and here for the lunar lander (it looks like it is the same code).
For convenience, here is a copy of the code:
# Page 1102
BLOCK 02
# SINGLE PRECISION SINE AND COSINE
COUNT* $$/INTER
SPCOS AD HALF # ARGUMENTS SCALED AT PI
SPSIN TS TEMK
TCF SPT
CS TEMK
SPT DOUBLE
TS TEMK
TCF POLLEY
XCH TEMK
INDEX TEMK
AD LIMITS
COM
AD TEMK
TS TEMK
TCF POLLEY
TCF ARG90
POLLEY EXTEND
MP TEMK
TS SQ
EXTEND
MP C5/2
AD C3/2
EXTEND
MP SQ
AD C1/2
EXTEND
MP TEMK
DDOUBL
TS TEMK
TC Q
ARG90 INDEX A
CS LIMITS
TC Q # RESULT SCALED AT 1.
The comment
# SINGLE PRECISION SINE AND COSINE
indicates, that the following is indeed an implementation of the sine and cosine functions.
Information about the type of assembler used, can be found on Wikipedia
Partial explanation of the code:
The function SPCOS
first adds one half to the input, and then proceeds to calculate the sine.
This indicates that the function is actually a scaled version of the sine/cosine functions.
The function POLLEY
calculates a polynomial approximation:
First, we store $x^2$ in the register SQ (where $x$ denotes the input).
This is used to calculate the polynomial
$$
((( C_5/2 x^2 ) + C_3/2 ) x^2 + C_1/2) x.
$$
The values for the constants can be found in the same github repository and are
$$
C_5/2= .0363551 approx big(fracpi2big)^5 cdot frac12cdot 5!\
C_3/2= -.3216147 approx -big(fracpi2big)^3 cdot frac12cdot 3!\
C_1/2= .7853134 approx fracpi2 cdot frac12\
$$
which look like taylor coefficients for a scaled version of the sine function.
These values are not exact, but I suspect that the error comes from the low bit resolution.
New contributor
supinf is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
1
I am reading into it, but it is not easy because i am not familiar with the programming language. At first glance it looks like a taylor approximation, but i am not sure. I will edit when i have more.
– supinf
1 hour ago
1
I'm on it... i think it has to do with scaling.
– supinf
46 secs ago
okay have fun I'll be quiet :-)
– uhoh
12 secs ago
add a comment |Â
up vote
4
down vote
up vote
4
down vote
Since the Apollo 11 Code is on Github, i was able to find the code that looks like an implementation of sine and cosine functions: see here for the command module and here for the lunar lander (it looks like it is the same code).
For convenience, here is a copy of the code:
# Page 1102
BLOCK 02
# SINGLE PRECISION SINE AND COSINE
COUNT* $$/INTER
SPCOS AD HALF # ARGUMENTS SCALED AT PI
SPSIN TS TEMK
TCF SPT
CS TEMK
SPT DOUBLE
TS TEMK
TCF POLLEY
XCH TEMK
INDEX TEMK
AD LIMITS
COM
AD TEMK
TS TEMK
TCF POLLEY
TCF ARG90
POLLEY EXTEND
MP TEMK
TS SQ
EXTEND
MP C5/2
AD C3/2
EXTEND
MP SQ
AD C1/2
EXTEND
MP TEMK
DDOUBL
TS TEMK
TC Q
ARG90 INDEX A
CS LIMITS
TC Q # RESULT SCALED AT 1.
The comment
# SINGLE PRECISION SINE AND COSINE
indicates, that the following is indeed an implementation of the sine and cosine functions.
Information about the type of assembler used, can be found on Wikipedia
Partial explanation of the code:
The function SPCOS
first adds one half to the input, and then proceeds to calculate the sine.
This indicates that the function is actually a scaled version of the sine/cosine functions.
The function POLLEY
calculates a polynomial approximation:
First, we store $x^2$ in the register SQ (where $x$ denotes the input).
This is used to calculate the polynomial
$$
((( C_5/2 x^2 ) + C_3/2 ) x^2 + C_1/2) x.
$$
The values for the constants can be found in the same github repository and are
$$
C_5/2= .0363551 approx big(fracpi2big)^5 cdot frac12cdot 5!\
C_3/2= -.3216147 approx -big(fracpi2big)^3 cdot frac12cdot 3!\
C_1/2= .7853134 approx fracpi2 cdot frac12\
$$
which look like taylor coefficients for a scaled version of the sine function.
These values are not exact, but I suspect that the error comes from the low bit resolution.
New contributor
supinf is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
Since the Apollo 11 Code is on Github, i was able to find the code that looks like an implementation of sine and cosine functions: see here for the command module and here for the lunar lander (it looks like it is the same code).
For convenience, here is a copy of the code:
# Page 1102
BLOCK 02
# SINGLE PRECISION SINE AND COSINE
COUNT* $$/INTER
SPCOS AD HALF # ARGUMENTS SCALED AT PI
SPSIN TS TEMK
TCF SPT
CS TEMK
SPT DOUBLE
TS TEMK
TCF POLLEY
XCH TEMK
INDEX TEMK
AD LIMITS
COM
AD TEMK
TS TEMK
TCF POLLEY
TCF ARG90
POLLEY EXTEND
MP TEMK
TS SQ
EXTEND
MP C5/2
AD C3/2
EXTEND
MP SQ
AD C1/2
EXTEND
MP TEMK
DDOUBL
TS TEMK
TC Q
ARG90 INDEX A
CS LIMITS
TC Q # RESULT SCALED AT 1.
The comment
# SINGLE PRECISION SINE AND COSINE
indicates, that the following is indeed an implementation of the sine and cosine functions.
Information about the type of assembler used, can be found on Wikipedia
Partial explanation of the code:
The function SPCOS
first adds one half to the input, and then proceeds to calculate the sine.
This indicates that the function is actually a scaled version of the sine/cosine functions.
The function POLLEY
calculates a polynomial approximation:
First, we store $x^2$ in the register SQ (where $x$ denotes the input).
This is used to calculate the polynomial
$$
((( C_5/2 x^2 ) + C_3/2 ) x^2 + C_1/2) x.
$$
The values for the constants can be found in the same github repository and are
$$
C_5/2= .0363551 approx big(fracpi2big)^5 cdot frac12cdot 5!\
C_3/2= -.3216147 approx -big(fracpi2big)^3 cdot frac12cdot 3!\
C_1/2= .7853134 approx fracpi2 cdot frac12\
$$
which look like taylor coefficients for a scaled version of the sine function.
These values are not exact, but I suspect that the error comes from the low bit resolution.
New contributor
supinf is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
edited 14 mins ago
New contributor
supinf is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
answered 1 hour ago


supinf
1414
1414
New contributor
supinf is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
supinf is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
supinf is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
1
I am reading into it, but it is not easy because i am not familiar with the programming language. At first glance it looks like a taylor approximation, but i am not sure. I will edit when i have more.
– supinf
1 hour ago
1
I'm on it... i think it has to do with scaling.
– supinf
46 secs ago
okay have fun I'll be quiet :-)
– uhoh
12 secs ago
add a comment |Â
1
I am reading into it, but it is not easy because i am not familiar with the programming language. At first glance it looks like a taylor approximation, but i am not sure. I will edit when i have more.
– supinf
1 hour ago
1
I'm on it... i think it has to do with scaling.
– supinf
46 secs ago
okay have fun I'll be quiet :-)
– uhoh
12 secs ago
1
1
I am reading into it, but it is not easy because i am not familiar with the programming language. At first glance it looks like a taylor approximation, but i am not sure. I will edit when i have more.
– supinf
1 hour ago
I am reading into it, but it is not easy because i am not familiar with the programming language. At first glance it looks like a taylor approximation, but i am not sure. I will edit when i have more.
– supinf
1 hour ago
1
1
I'm on it... i think it has to do with scaling.
– supinf
46 secs ago
I'm on it... i think it has to do with scaling.
– supinf
46 secs ago
okay have fun I'll be quiet :-)
– uhoh
12 secs ago
okay have fun I'll be quiet :-)
– uhoh
12 secs ago
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fspace.stackexchange.com%2fquestions%2f30952%2fhow-did-the-apollo-computers-evaluate-transcendental-functions-like-sine-tangen%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Are you sure about the need to do trigonometry for gimbaling? I'm pretty sure it would be easier to stay within vector math if you use a linear actuator. Anyway trignonometry functions are usually implemented by table lookup or approximated as a taylor expansion. No source directly related to Apollo, sorry.
– Christoph
1 hour ago
...or both, the taylor expansion preparing lookup tables on startup, in case permanent storage is less abundant than RAM.
– SF.
1 hour ago
@Christoph First sentence starts with two instruments that likely produce angular data. Also, what was done in the 1960's in computers in space, is not covered by how things are done now. I'll add the
history
tag to make that even clearer. You might also consider where tables would have to be stored, there was precious little memory in the Apollo computers.– uhoh
1 hour ago
@Christoph have a look here: youtu.be/9YA7X5we8ng?t=1283 and also here youtu.be/YIBhPsyYCiM?t=273
– uhoh
1 hour ago
@Christoph: Already in 1956 we had a better algorithm than Taylor, namely CORDIC. I don't know if that was used in Apollo.
– MSalters
53 mins ago