(12C) Complex Arithmetic
|
05-20-2017, 01:47 PM
(This post was last modified: 05-20-2017 01:47 PM by Eddie W. Shore.)
Post: #1
|
|||
|
|||
(12C) Complex Arithmetic
Let A and B represent the two complex numbers
A = R1 + R4*i B = R2 + R5*i Where i = √-1 Store real components in R1 and R2, and imaginary parts R4 and R5. Choose the arithmetic calculations: Enter 0 for addition: A + B Enter 1 for multiplication: A * B Enter 2 or otherwise for division: A ÷ B Result: C = R3 + R6*i Program: Code:
Example: A = 4.25 + 3.16*i, B = -2.27 + 1.04*i Option 0 (+): 1.98 + 4.20*i Option 1 (*): -12.93 – 2.75*i Option 2 (÷): -1.02 – 1.86*i |
|||
05-24-2017, 05:27 PM
Post: #2
|
|||
|
|||
RE: (12C) Complex Arithmetic
Hi Eddie ! Nice program.
In step 16, there is a mistake: you wrote "RCL"6 instead of "STO"6. The keycode is correct. My calcs: HP12C, HP15C, HP17BII+, HP20S, HP20B, HP32SII, HP34C, HP35S, HP42S, HP48GX. |
|||
05-27-2017, 09:02 AM
(This post was last modified: 05-27-2017 09:20 AM by Dieter.)
Post: #3
|
|||
|
|||
RE: (12C) Complex Arithmetic
(05-20-2017 01:47 PM)Eddie W. Shore Wrote: Store real components in R1 and R2, and imaginary parts R4 and R5. Choose the arithmetic calculations: This approach can be improved so that you do not have to store four values into four registers. The program may do this for you. Also chain calculations are possible if the final result is stored as input for the next calculation. Here is my suggestion: Code: 01- 44 2 STO 2 Enter program, switch back to run mode [P/R] 0. Reset calculation: [f] [PRGM] 1. Enter first operand: real [ENTER] imaginary part [R/S] 2. Enter second operand and opcode: real [ENTER] imaginary part [ENTER] code [R/S] where code=1 for add, 2 for subtract, 3 for multiply and 4 for divide. Any other code yields Error 0. For further calculations with the result continue with step 2. Example: (3+4i * 5–6i) / (1+2i) + (7+3i) Code: [f] [PRGM] So the final result is 15,6 – 12,2 i Of course the intermediate results do not have to be examined by [X<>Y] to show the real part, you can simply continue calculating after each step. Start a new calculation with [f][PRGM] which resets the program to step 00 to accept a new first operand. Dieter |
|||
06-27-2017, 10:17 PM
Post: #4
|
|||
|
|||
RE: (12C) Complex Arithmetic
I like Dieter's approach the best. It allows chain calculations and is more flexible.
Regards, Bob |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 2 Guest(s)