The Museum of HP Calculators

HP Forum Archive 15

[ Return to Index | Top of Index ]

Need an HP 49g+ Programming hint
Message #1 Posted by Yiannis on 24 May 2005, 8:33 p.m.

Hello!

I would appreciate if anyone could help me out with this little problem I have got... I need to create a quite simple program where I put the figures that represent the coefficients of more than one equations and get the results for each one of them instantaneously. I already know how to work this out when I have one output equation. To make more clear of what I need... let say I need a program that when I fill in the dimensions of a parallelogram (i.e its height and length) I get its area, volume and perimeter and then sum of the perimeter and the area.

Input h: and l: Output P: A: V: and P+A

Thank you very much for your time in advance!!

Edited: 24 May 2005, 8:55 p.m.

      
Re: Need an HP 49g+ Programming hint
Message #2 Posted by chris dean on 25 May 2005, 2:21 a.m.,
in response to message #1 by Yiannis

Yiannis

I hope this helps. I am only a relative novice with HP49G+ programming. I must admit it seems quite challenging! The program below finds the area and perimeter of a rectangle and then adds them for given inputs H and L.

<<'H' STO 'L' STO '2*(H+L)' 'P' STO 'H*L' 'A' STO <<A>> ->NUM <<P>> ->NUM <<'A+P'>> ->NUM >>

I hope this helps in some way. I do apologise but I do not know how to format the program. Can anyone tell me how to format?

Regards

Chris Dean

            
Re: Need an HP 49g+ Programming hint
Message #3 Posted by GWB on 1 June 2005, 9:41 p.m.,
in response to message #2 by chris dean

Chris Dean wrote:

Quote:
I do apologise but I do not know how to format the program. Can anyone tell me how to format?

Please take a look at "advanced formatting techniques":

http://www.hpmuseum.org/artfmt.htm

For example, if you want to format your program so that it looks like the way it's listed on the 49G+, edit your posting like this:

[pre]
<<'H' STO 'L' STO '2*(H+L)' 'P' 
STO 'H*L' 'A' STO 
  << A
  >> ->NUM
  << P
  >> ->NUM
  << 'A+P'
  >> ->NUM
>>
[/pre]

Cheers,

Gerson

Edited: 1 June 2005, 10:12 p.m.

                  
Re: Need an HP 49g+ Programming hint
Message #4 Posted by Chris Dean on 2 June 2005, 8:29 a.m.,
in response to message #3 by GWB

Gerson

Thanks for the information

Chris

      
Re: Need an HP 49g+ Programming hint
Message #5 Posted by EL on 25 May 2005, 2:37 a.m.,
in response to message #1 by Yiannis

Yiannis, Here's an example for a rectangle. I tried this, and it works:

<< -> h l << "area" 'h*l' ->NUM "perim" '(2*h)+(2*l)' ->NUM >> >>

Don't worry about carriage returns. Type the program exactly as above, and then press ENTER. Type 'yourprogname' and press STO.

To use it, first enter the two values: val1 SPC val2 and then press the softkey for 'yourprogname' or just type the name and press EVAL.

For example, for my rectangle, I type 3 SPC 4 ENTER and then press the 'yourprogname' softkey.

it outputs: "area" 12 "perim" 14

Hope this helps, EL

      
Re: Need an HP 49g+ Programming hint
Message #6 Posted by Valentin Albillo on 25 May 2005, 6:16 a.m.,
in response to message #1 by Yiannis

Hi, Yiannis:

Yiannis posted:

"say I need a program that when I fill in the dimensions of a parallelogram (i.e its height and length) I get its area, volume and perimeter and then sum of the perimeter and the area. Input h: and l: Output P: A: V: and P+A"

Excuse me but I couldn't resist, my mathematical guts just gave a jump upon reading your 'example'. I know that you intend it as just an example, not an actual need, but certainly it was as bad an example as it gets, namely:

  • Giving just height (h) and length (l), there's no way you can compute its volume (V), you need an additional parameter for that, namely the width (w)

  • Computing "sum of the perimeter and the area (P+A)" is absolutely nonsensical, their dimensionality is different and there's no way they can be added up meaningfully. It's like asking for the sum of volts and pounds ! :-)

That said, good luck with your 48/49 programming. For the HP-71B you'd simply use something like this:

10 INPUT H,L
20 P=2*H+2*L 
30 A=H*L
40 V=A*W
50 PRINT P,A,V,P+A
Best regards from V.


[ Return to Index | Top of Index ]

Go back to the main exhibit hall