(15C) Digital Root, Modulus, and 2D Coordinate Rotation
|
01-08-2016, 03:24 AM
(This post was last modified: 06-15-2017 01:23 PM by Gene.)
Post: #1
|
|||
|
|||
(15C) Digital Root, Modulus, and 2D Coordinate Rotation
Link:
http://edspi31415.blogspot.com/2016/01/h...nd-2d.html HP 15C: Digital Root Input: Enter an integer and execute Label A (or whatever label you want to assign). Program: Code: Step Key Key Code Formula used: (Define DR(n) as the digital root function) DR(n) = n – 9 * int((n-1)/9), n > 0 DR returns the sum of n’s digits and repeats until a single digit remains. Examples: DR(4514) = 5 DR(9376) = 7 DR(636088) = 4 DR(761997) = 3 HP 15C: Modulus Function Input: Y: A X: B The program calculates A mod B. Program: Code: Step Key Key Code Formula Used: A mod B = B * frac(A/B) Add B to result if A*B < 0. Registers Used: R1 = A R2 = B R3 = A mod B Examples: A = 48, B = 3, result = 0 A = 41.3, B = 12, result = 5.3 A = 48, B = -7, result = -1 A = -50.2, B = 36, result = 21.8 HP 15C: 2D Coordinate Rotation Input: Store the following: X in R4, Y in R5, and θ in R3. Run the program. Results are stored in R6 and R7, for X’ and Y’, respectively. X’ is displayed first, press R/S to get Y’. This program uses the Polar to Rectangular conversion. Program: Code: Step Key Key Code Formulas Used: X’ = X * cos θ – Y * sin θ Y’ = X * sin θ + Y * cos θ Examples: X (R4) = 1, Y (R5) = 2, θ (R3) = 30°. Results: X’ (R6) ≈ -0.1340, Y’ (R7) ≈ 2.2321 X (R4) = 6.45, Y (R5) = 5.25, θ (R3) = 176°. Results: X’ (R6) ≈ -6.8005, Y’ (R7) ≈ -4.7872 |
|||
« Next Oldest | Next Newest »
|
Messages In This Thread |
(15C) Digital Root, Modulus, and 2D Coordinate Rotation - Eddie W. Shore - 01-08-2016 03:24 AM
RE: 15C: Digital Root, Modulus, and 2D Coordinate Rotation - Thomas Klemm - 01-08-2016, 11:23 PM
|
User(s) browsing this thread: 1 Guest(s)