Complex numbers HP32SII



#5

Hello Everyone,

I have an equation which is the relationship between reflection coefficient and impedance

r=(ZL-ZS)/(ZL+ZS)

ZL and ZS are complex numbers. Typical ZS is always 50+j0.

At the moment I am doing the following for the calculation

ZL imaginary part
ENTER
ZL real part
ENTER
ZS imaginary part
ENTER
ZS real part
ENTER
COMPLEX
-

Then this gives me the numerator, I write this down and then

ZL imaginary part
ENTER
ZL real part
ENTER
ZS imaginary part
ENTER
ZS real part
ENTER
COMPLEX
+

To get the denominator and again write this down.

Finally I enter the complex numbers in again and / to get the reflection coefficient in rectangluar form and then finally convert it to polar.

I tried writing a program for this but the answer came out completely wrong, though if I do it by hand it's okay.

Anyone have any hints on how to start this?
Also anyone have any RF programs they would like to share?
Does the HP35s handle complex numbers better, so that I could use it as an excuse to buy one?

Thanks,

Rav


#6

Hi ravwalia,

Can you please provide the values you are using? It seems like a simple error when I read your post:

When you divide the two complex numbers (i.e. numerator and denominator) you must also press LEFT SHIFT CMPLX prior to executing the division.

I also own the 35s and it does seems to have a much improved COMPLEX Operations implementation in that you can treat complex numbers as you do real numbers (without always pressing LEFT SHIFT CMPLX prior to executing the operation) and you actually enter the numbers in a more logical sequence - real part first, then imaginary part. The 35s has can also accommodate up to four separate complex numbers in the complex stack as opposed to only two as in the 32sii - that is a big selling point to me! This makes it 'almost' as good as the 15C in this regard.

Verdict: If you do a lot of COMPLEX operations, you will like the 35S. I haven't figured out a way to directly enter a number like: 2-4*SQRT(5)i, as one can easily do with the famous 15C... Oh well.

Jeff


#7

Or the other famous 42S.

tm

#8

Quote:
I haven't figured out a way to directly enter a number like: 2-4*SQRT(5)i, as one can easily do with the famous 15C...

how about:
5
SQRT
4
*
i
*
CHS
2
+

I think the 15C would require the following:

5
SQRT
4
*
CHS
Re<>Im
(back-arrow)
2

And the 42S:

2
ENTER
5
SQRT
4
*
CHS
COMPLEX

#9

Jeff --

Quote:
Verdict: If you do a lot of COMPLEX operations, you will like the 35S. I haven't figured out a way to directly enter a number like: 2-4*SQRT(5)i, as one can easily do with the famous 15C... Oh well.

That's a bit easier in Algebraic (ALG) mode:

MODE 4
2 - 4 i * SQRT 5 ENTER

Despite its lack of one-screen complex-number display, the HP-15C's complex-number handling is much better. The HP-42S is better yet.

-- KS

#10

Quote:
Hi ravwalia,

Can you please provide the values you are using? It seems like a simple error when I read your post:

When you divide the two complex numbers (i.e. numerator and denominator) you must also press LEFT SHIFT CMPLX prior to executing the division.

I also own the 35s and it does seems to have a much improved COMPLEX Operations implementation in that you can treat complex numbers as you do real numbers (without always pressing LEFT SHIFT CMPLX prior to executing the operation) and you actually enter the numbers in a more logical sequence - real part first, then imaginary part. The 35s has can also accommodate up to four separate complex numbers in the complex stack as opposed to only two as in the 32sii - that is a big selling point to me! This makes it 'almost' as good as the 15C in this regard.

Verdict: If you do a lot of COMPLEX operations, you will like the 35S. I haven't figured out a way to directly enter a number like: 2-4*SQRT(5)i, as one can easily do with the famous 15C... Oh well.

Jeff



Hello All,

I apologise for not being more precise in my question.

Firstly in the listing above there is an extra ENTER before each
of the complex command. Those should not be there as the stack is
already filled.

I can perform the calculation by hand but this is something that I
do a lot and 99% of the time ZS is always 50+j0. So I thought that
a program would be better. However, when I put in the program,
this first one I have ever written, and used the test case

ZL=40+j70 and ZS=50+j0

I get the wrong answer, doing it by hand I get the correct one. I
just programmed it in as the keypresses I was using and it was
still wrong.

It looks like I might have a good excuse to get the HP35S.

I'll try the program listing suggested and report back.

Thanks,

Rav.

#11

Are you sure the keystrokes given above will give the right answer? It looks to me like you have an extra ENTER in each sequence. The last ENTER before you do the complex operation would push the imaginary part of the first number off of the top of the stack and screw up the complex numbers that you are operating on. If your program somehow does this, that would explain why it gives incorrect answers. What is your program listing? I don't have a 32SII in front of me, but an off-the-cuff program to do want you want might be as follows:

LABEL A
STO A
Rv
STO B
Rv
STO C
Rv
STO D
Rv
COMPLEX +
STO E
x<>y
STO F
RCL D
RCL C
RCL B
RCL A
COMPLEX -
RCL F
RCL E
COMPLEX /
R->P
STOP

Enter your ZL and ZS values as you described (without the last ENTER), press XEQ A and it will give you your answer in polar form without writng any intermediate answers down.

As Jeff K stated, the 35s handles complex numbers in a much more natural way. The only thing worth mentioning is that it does not do Polar to Rectangular and Rectangular to Polar conversions in a manner comparable to the 32SII. It does however let you enter the numbers in either polar or rectangular form, operate on them, and change the display mode to either polar or rectangular. For example, for your problem you could put the calculator in polar display mode, enter your numbers in rectangular form, operate on them, and when complete the answer would be displayed in polar form. The complex number handling capabilities and polar to rectangular conversion capabilities of the 35s generated MUCH discussion last summer when the 35s was released. Search the archives for more information.


#12

This program did it very nicely. Thanks for this.

I'll print this out and see if I can work out what's going on.

Thanks again,

Rav.

#13

In the 35s you would enter R=(A-B)/(A+B) as an EQN equation just the way I wrote it down here. Then you display the equation list and solve for R (EQN Right-Shift R) and enter complex numbers A and B each once when prompted: real part followed by pressing i and then imaginary part and R/S. You can then read R from the display either in rectangular or in polar form, depending on how you've set the display mode. A matter of 10 seconds...


#14

Seems like a really nice and intuitive way to do it. I'm really tempted to get a HP35s now.

Thanks,

Rav.


Possibly Related Threads...
Thread Author Replies Views Last Post
  HP Prime: complex numbers in CAS. Alberto Candel 1 349 12-06-2013, 02:36 PM
Last Post: parisse
  [HP Prime] Plots containing complex numbers bug? Chris Pem10 7 652 12-05-2013, 07:40 AM
Last Post: cyrille de Brébisson
  Complex Number Entry on Prime Jeff O. 19 1,289 11-16-2013, 12:34 PM
Last Post: Jeff O.
  comparing numbers on the WP 34S Kiyoshi Akima 7 660 10-19-2013, 09:28 AM
Last Post: walter b
  HP Prime: Operations with Large Numbers Eddie W. Shore 0 180 10-19-2013, 12:24 AM
Last Post: Eddie W. Shore
  HP Prime complex results Javier Goizueta 0 209 10-06-2013, 12:59 PM
Last Post: Javier Goizueta
  HP Prime Solving Nonlinear System of Equations for Complex Results Helge Gabert 11 922 09-30-2013, 03:44 AM
Last Post: From Hong Kong
  HHC 2013 room numbers David Hayden 2 312 09-20-2013, 05:34 PM
Last Post: sjthomas
  [HP-Prime xcas] operations with complex numbers + BUGs + Request CompSystems 9 776 09-08-2013, 10:40 PM
Last Post: CompSystems
  TED Talk: Adam Spencer: Why I fell in love with monster prime numbers Les Bell 3 400 09-05-2013, 12:54 PM
Last Post: Ken Shaw

Forum Jump: