HP Forums
Need an HP 49g+ Programming hint - Printable Version

+- HP Forums (https://archived.hpcalc.org/museumforum)
+-- Forum: HP Museum Forums (https://archived.hpcalc.org/museumforum/forum-1.html)
+--- Forum: Old HP Forum Archives (https://archived.hpcalc.org/museumforum/forum-2.html)
+--- Thread: Need an HP 49g+ Programming hint (/thread-73912.html)



Need an HP 49g+ Programming hint - Yiannis - 05-24-2005

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 - Chris Dean - 05-25-2005

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 - EL - 05-25-2005

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 - Valentin Albillo - 05-25-2005

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.


Re: Need an HP 49g+ Programming hint - GWB - 06-01-2005

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 - Chris Dean - 06-02-2005

Gerson

Thanks for the information

Chris