The Museum of HP Calculators

HP Forum Archive 15

[ Return to Index | Top of Index ]

Equation problem in Hp32II
Message #1 Posted by Ravinder Walia on 6 Jan 2006, 12:09 p.m.

Hello everyone,

I have a HP32II and stored an equation

D=10xLOG(W/0.001)

If I try solving the equation for D, by pressing EQN and then enter everything is fine.

However I can't get it to work for to solve W. I just got this calculator and don't have a manual. I can use the number crunching fine but this is my first attempt at storing an equation.

Any help greatly appreciated.

      
Re: Equation problem in Hp32II
Message #2 Posted by Antoine M. Couëtte on 6 Jan 2006, 12:19 p.m.,
in response to message #1 by Ravinder Walia

Assuming that "LOG" is the Napier Logarithm - if decimal, there is one constant to multiply with - and assuming that I correctly rewrote your equation, did you attempt solving for W with W=1000 EXP (D/10)? Antoine

            
Re: Equation problem in Hp32II
Message #3 Posted by Ravinder Walia on 6 Jan 2006, 12:55 p.m.,
in response to message #2 by Antoine M. Couëtte

I think that the rearranged equation would be

W=0.001xALOG(D/10)

and if I put this in, it works fine to solve for W.

What I wanted to do is enter the first equation which was

D=10xLOG(W/0.001)

And then use this single equation to solve for either W or D. I thought that there was a way to do this, but maybe there isn't.

                  
Re: Equation problem in Hp32II
Message #4 Posted by Chris Dean on 6 Jan 2006, 1:03 p.m.,
in response to message #3 by Ravinder Walia

When trying to solve for W did you enter a value for D first?

                        
Re: Equation problem in Hp32II
Message #5 Posted by Ravinder Walia on 6 Jan 2006, 1:20 p.m.,
in response to message #4 by Chris Dean

I entered the equation

D=10xLOG(W/0.001)

Then I did

[LEFT SHIFT]

[STO]

This brings up the equation. Then I pick to solve for W by

[LEFT SHIFT]

[7]

Which then ask me what variable to solve for. To pick W I do

[1]

To give me W. It then asks for a value for D. If I want 12

[12]

It then gives the error LOG(0).

I'm pretty sure I am doing something wrong, but not sure what.

                              
Re: Equation problem in Hp32II
Message #6 Posted by Norris on 6 Jan 2006, 1:52 p.m.,
in response to message #5 by Ravinder Walia

I tried this equation on a 33S, which should be functionally equivalent to a 32SII as far as equations go, and had no problem solving the equation in question for D=12 (for the record, W=0.158489319246).

I also have a 32SII, but it's at home, so I can't try that until tonight

                                    
Re: Equation problem in Hp32II
Message #7 Posted by Chris Dean on 6 Jan 2006, 2:10 p.m.,
in response to message #6 by Norris

I actually make the answer W=3.3201169223e-3 for D=12. I am sorry but I cannot be of any more assistance as I do not have a 32SII and cannot replicate your problem.

Edited: 6 Jan 2006, 2:13 p.m.

                                          
Correction
Message #8 Posted by Norris on 6 Jan 2006, 2:31 p.m.,
in response to message #7 by Chris Dean

Quote:
I actually make the answer W=3.3201169223e-3 for D=12

You are using a natural (base-e) logarithm (LN function). But the equation appears to call for a base-10 logarithm (LOG function).

My initial answer also needs correction. For a base-10 logarithm, W=0.0158489319246, not 0.158489319246. I used the SHOW function on the 33S to get all the digits, but I forgot that that the display drops leading zeros. Oops.

Edited: 6 Jan 2006, 2:37 p.m.

                              
Re: Equation problem in Hp32II
Message #9 Posted by Katie Wasserman on 6 Jan 2006, 2:41 p.m.,
in response to message #5 by Ravinder Walia

You can tell the calculator to look for a solution within a certain range in order to avoid it trying to calculate log(x); where x<=0.

To do this store one limit, say 1 in this case, in W and put the other limit, say .01 in this case, in the x register.

So you would do:

1 STO W .01 ENTER EQN (select your equation) SOLVE W D=12 R/S

I get W=1.58489319 E -2

      
Re: Equation problem in Hp32II
Message #10 Posted by John Smitherman on 6 Jan 2006, 2:26 p.m.,
in response to message #1 by Ravinder Walia

Ravinder, here is a link to the 33s manual which provides the same information as the 32sii manual on how to handle equations:

http://h10032.www1.hp.com/ctg/Manual/c00251639.pdf

Regards,

John

      
Re: Equation problem in Hp32II
Message #11 Posted by Ben Salinas on 6 Jan 2006, 2:48 p.m.,
in response to message #1 by Ravinder Walia

So, after a bit of fooling around, I think I found the solution. The 32sii uses a numerical approximation (Newton's Method?) to solve equations. It calls for guesses.

The two bounds the 32sii (and consequently, the 33s) use are the number stored in the variable (W, in this case) and the number stored on the top of the stack (the screen). Before, you probably had either 0, or a negative number stored in one of these. Try putting a small number in each. I put 1 in W (5 or 10 should also work fine) and 1E-5 on the stack.

If you limit the interval it has to solve over, then it will solve quicker.

-Ben

            
Re: Equation problem in Hp32II
Message #12 Posted by Norris on 6 Jan 2006, 3:10 p.m.,
in response to message #11 by Ben Salinas

I would have expected the 33S to behave in the same manner as the 32SII. Yet I can't duplicate the LOG(0) error on the 33S with the equation D=10xLOG(W/0.001) and D=12.

It doesn't seem to matter what kind of numbers are initially stored in W, or left on the X-register. Positive, negative, or zero, large or small...the 33S responds almost immediately with W=0.0158 regardless.

Needless to say, this is very frustrating. What I am I doing wrong ?? Why won't my calculator give me an error message, instead of the correct answer ?!?

Edited: 6 Jan 2006, 3:17 p.m.

                  
Re: Equation problem in Hp32II
Message #13 Posted by Eamonn on 6 Jan 2006, 6:08 p.m.,
in response to message #12 by Norris

Hi Norris,

It may be that the HP-33s first attempts to re-arrange the equation so that it can directly solve for a real root. If it cannont do this, then it uses an iterative method (see appendix D of the HP-33s manual).

The HP-32sII, if I recall correctly, always uses an iterative method to solve for the root. I remember some discussion on this site about solving A=SQR(B) on the HP33s and that it could not directly find the negative root of B without some re-shuffling of the equation so that it could not be solved directly. Sorry, I don't have a link to this discussion.

The equation in the original post can be re-arranged and solved directly - I suspect that is why it doesn't matter what initial values are in the X register and the W variable on the HP-33s, but it does matter on the HP-32sII.

Best Regards,

Eamonn.

            
Re: Equation problem in Hp32II
Message #14 Posted by Ravinder Walia on 6 Jan 2006, 6:13 p.m.,
in response to message #11 by Ben Salinas

I think that the idea put forward by Ben is correct. I managed to follow his instructions and the equation solves.

I think that for an equation this simple it's not worth it, but at least I understand it a bit better now.

For those that might have been interested in what the equation was, it's a conversion from Watts to dBm, both units of power and used in radio frequency engineering.

Time to go and play some more.

                  
Re: Equation problem in Hp32II (summing it up)
Message #15 Posted by Karl Schneider on 7 Jan 2006, 1:22 a.m.,
in response to message #14 by Ravinder Walia

A few good points by several people in this thread. I'll try to sum it all up.

To recap, the problem was to solve the equation

D = 10 * LOG(W/0.001)

for D = 12.0 on an HP-32SII in Equation mode.

Indeed, the HP-32SII solves only iteratively, unlike the HP-33S, which will return an algebraically-derived direct solution if it deems possible.

The 32SII will use the stored value of the variable to be solved, and the value in the x-register as the first guesses for the solution. This is true when solving an equation or a program.

In equation mode, when the user enters 12 as the prompted value of D, that unfortunately is one of the guesses for the solution of W. Pre-storing a positive value for W that is less than, or close enough to the solution W = 0.001*(10^1.2) = 0.015849 will ensure that the algorithm will converge. A larger pre-stored value will cause the algorithm to project the next guess for W from the first two guesses into the undefined non-positive region, causing an error.

Pre-storing a positive value of W that is less than the actual solution will bound it between 12, bringing convergence. Pre-storing W = 0.02 will also work. However, Pre-storing W = 0.1 will fail, as the next projection of W -- based on function values calculated at W = 0.1 and W = 12.0 -- is negative.

One way to get around this problem is to enter the equation as a program, so that two legitimate guesses can be entered.

The methods of the HP-33S are more adroit: It will solve the equation directly.

-- KS

      
Re: Equation problem in Hp32II
Message #16 Posted by Tizedes Csaba [Hungary] on 9 Jan 2006, 2:31 a.m.,
in response to message #1 by Ravinder Walia

Hi, try this (I have an HP32SII, but not here, so I can't to try now...):

D = 10*LOG(W/0.001)  is equal

D/10 = LOG(W)+3 and SOLVE it --- and you can to substitue L=LOG(W), if it is not working:

D/10 = L+3 then SOLVE for L and W=10^L

Csaba


[ Return to Index | Top of Index ]

Go back to the main exhibit hall