The Museum of HP Calculators

HP Forum Archive 18

[ Return to Index | Top of Index ]

Complex numbers HP32SII
Message #1 Posted by ravwalia on 9 Jan 2008, 4:59 p.m.

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

      
Re: Complex numbers HP32SII
Message #2 Posted by Jeff Kearns on 9 Jan 2008, 7:02 p.m.,
in response to message #1 by ravwalia

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

            
Re: Complex numbers HP32SII
Message #3 Posted by Trent Moseley on 9 Jan 2008, 9:13 p.m.,
in response to message #2 by Jeff Kearns

Or the other famous 42S.

tm

            
Re: Complex numbers HP32SII
Message #4 Posted by Jeff O. on 9 Jan 2008, 10:10 p.m.,
in response to message #2 by Jeff Kearns

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

            
Re: Complex numbers on HP-35s
Message #5 Posted by Karl Schneider on 10 Jan 2008, 12:23 a.m.,
in response to message #2 by Jeff Kearns

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

            
Re: Complex numbers HP32SII
Message #6 Posted by ravwalia on 10 Jan 2008, 12:19 p.m.,
in response to message #2 by Jeff Kearns

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.

      
Re: Complex numbers HP32SII
Message #7 Posted by Jeff O. on 9 Jan 2008, 8:25 p.m.,
in response to message #1 by ravwalia

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.

            
Re: Complex numbers HP32SII
Message #8 Posted by ravwalia on 10 Jan 2008, 12:29 p.m.,
in response to message #7 by Jeff O.

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.

      
Re: Complex numbers HP32SII
Message #9 Posted by George Bailey (Bedford Falls) on 10 Jan 2008, 2:40 a.m.,
in response to message #1 by ravwalia

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...

            
Re: Complex numbers HP32SII
Message #10 Posted by ravwalia on 10 Jan 2008, 12:31 p.m.,
in response to message #9 by George Bailey (Bedford Falls)

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

Thanks,

Rav.


[ Return to Index | Top of Index ]

Go back to the main exhibit hall