Post Reply 
HP-35 style trig functions
01-13-2019, 10:58 PM
Post: #3
RE: HP-35 style trig functions
(01-13-2019 08:32 PM)Druzyek Wrote:  Is there another algorithm you can use to find just sine or just cosine that doesn't require square root and multiply?

You may have a look at the Python examples in the attachment of Exploring the CORDIC algorithm with the WP-34S.

You can rotate by an angle and pre-calculate the radius K:
Code:
P, d = 1.0, 1.0
for i in range(N):
    P *= (1 + d*d)
    d /= 2

K = sqrt(P)
This value is a constant depending only on N.

Thus you can use (1/K, 0) as a starting value to calculate the values of cos(arg) and sin(arg) directly:
Code:
# Trigonometrics
arg = 0.4
cordic(0, 1, 1/K, 0, arg, 1.0, ATAN)
# (0.9210609940028851, 0.3894183423086506, -9.860820082244643e-20)
# cos(arg) = 0.9210609940028851
# sin(arg) = 0.3894183423086506

Kind regards
Thomas
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
HP-35 style trig functions - Druzyek - 01-13-2019, 08:32 PM
RE: HP-35 style trig functions - pier4r - 01-13-2019, 08:37 PM
RE: HP-35 style trig functions - Thomas Klemm - 01-13-2019 10:58 PM
RE: HP-35 style trig functions - Druzyek - 01-14-2019, 12:56 AM
RE: HP-35 style trig functions - Dan - 01-14-2019, 01:31 AM
RE: HP-35 style trig functions - Druzyek - 01-14-2019, 02:34 AM
RE: HP-35 style trig functions - Dan - 01-15-2019, 03:43 AM
RE: HP-35 style trig functions - Druzyek - 01-15-2019, 11:49 PM
RE: HP-35 style trig functions - Druzyek - 08-28-2023, 12:19 AM



User(s) browsing this thread: 3 Guest(s)