HP35s Calculator Max Rope Tension Program



#8

Hi,

This is my first post on the forum. I would like to introduce myself as an engineer that is still using a calculator instead of an iPhone application at work.

In 2007 I bought the HP35s as a replacement for another calculator and wrote a few programs to simplify several tasks. As a programming beginner I found the key stroke style much easier to use and get results. I stumbled on this site by accident searching for HP35s programming examples online. I also obtained the matrix program from stefan's website which helped a lot.

As my thanks to all the volunteers I am posting this simple program to calculate rope tension. Useful for riggers on the field who owns an HP35s calculator.

Schematic of problem ::

HP35s Calculator Max Rope Tension Program

Keystrokes Display Description

XEQ P ENTER 	                Run: program P pulley/sheaves
981 R/S L? Enter the load L = 981N
0.02 R/S F? For friction we will use m = 0.02
12 R/S N? Enter 12 as the number of parts
3 R/S D? 3 for deflected pulley/sheaves
96.51 Ans : 96.51N

The new code listing is as follows:

Line Instruction Comments
P001 	LBL P 	
P002 INPUT L Enter load L
P003 INPUT F Enter friction coeficient e.g 0.02
P004 INPUT N Enter the number of line parts
P005 INPUT D This is the number of deflected sheaves
P006 1
P007 ENTER
P008 RCL F
P009 +
P010 RCL N
P011 ENTER
P012 1
P013 -
P014 yx
P015 STO A
P016 ENTER
P017 1
P018 ENTER
P019 RCL F
P020 +
P021 RCL D
P022 yx
P023 STO B
P024 ENTER
P025 0
P026 ENTER
P027 RCL N
P028 1
P029 -
P030 RCL F
P031 ENTER
P032 1
P033 +
P034 x<>y
P035 yx
P036 +
P037 DSE N
P038 GTO P027
P039 STO T
P040 ENTER
P041 RCL A
P042 ENTER
P043 RCL B
P044 x
P045 RCL T
P046 ÷
P047 RCL L
P048 x
P049 STOP

LN=101 Checksum=FD5A

Compiled by Jean-Marc Biram, Copyright © 2007 Free Software Foundation Distributed under the version 3, GNU general public license

 I tried to get the formatting as best I could

#9

Nice work, and welcome to the forum!


#10

Thanks

#11

Hello,

Nice program. I don't think I will ever need to calculate rope tension for rigging, but I appreciate the use of the 35s. Since you state that you are a relatively new user to RPN, I'll risk pointing out a few improvements that might be made. Please don't take my suggestions as criticism, just trying to be helpful. With that said, your program could be shortened as follows:

The ENTER commands in lines 7, 11, 16, 18, 24, 26, 31, 40, and 42 are unnecessary due to automatic stack lift.

The RCL instructions in lines 8, 19, 43, 45, and 47 which are each followed by an arithmetic operation could be replaced with the corresponding combined instruction, e.g.,

RCL B

x

may be replaced with

RCLx B

With the above changes, your program is shortened to 35 steps:

Line 	Instruction 	Comments
P001 LBL P
P002 INPUT L Enter load L
P003 INPUT F Enter friction coeficient e.g 0.02
P004 INPUT N Enter the number of line parts
P005 INPUT D This is the number of deflected sheaves
P006 1
P007 RCL+ F
P008 RCL N
P009 1
P010 -
P011 yx
P012 STO A
P013 1
P014 RCL+ F
P015 RCL D
P016 yx
P017 STO B
P018 0
P019 RCL N
P020 1
P021 -
P022 RCL F
P023 1
P024 +
P025 x<>y
P026 yx
P027 +
P028 DSE N
P029 GTO P019
P030 STO T
P031 RCL A
P032 RCLx B
P033 RCL÷ T
P034 RCLx L
P035 STOP

I believe my suggestions are valid, as I get the correct answer for your sample calculation.

FYI, unfortunately the LN and CK figures on the 35s do not have any useful meaning as different users will get different values on different machines. For example, your original program produces LN =153, CK=2B98 on my 35s. My revised version gives LN=111, CK=7DC5. (See the complete HP 35s "bug list".)

My apologies if you were well aware of the above suggested improvements and simply prefer your code to be structured as in your original.


#12

The loop could still be improved a little:

Quote:
P019	RCL N 	
P020 1
P021 -
P022 RCL F
P023 1
P024 +
P025 x<>y
P026 yx
P027 +
P028 DSE N
P029 GTO P019

P019	1	
P020 RCL+ F
P021 RCL N
P022 1
P023 -
P024 yx
P025 +
P026 DSE N
P027 GTO P019

Cheers

Thomas

#13

I am always learning and improving and I don't mind listening to constructive suggestions.

#14

Thank you for sharing the program.

For those riggers on the field with an iPad mini (and an HP-67 simulator running on it), I've taken the liberty to provide the program as an HP-67 card on my website www.cuveesoft.ch/rpn67/p11.html

I hope that's okay with you; otherwise, please contact me (link is on the website). It would also be nice to have a simple illustration of the problem your program solves.


#15

There is a link to a sketch for the problem on the first post its under:-

Quote:
Schematic of problem ::

HP35s Calculator Max Rope Tension Program


It shows in blue on my browser.

Edited: 12 Dec 2013, 12:10 a.m.

#16

When I understand your program correctly the following is calculated:

A = (1 + F)^(N - 1)
B = (1 + F)^D
T = SUM (1 + F)^i for i in {0 ... N-1}
P = A*B*L/T

But for the geometric series we can use a closed form:

T = ((1 + F)^N - 1)/(1 + F - 1) = ((1 + F)^N - 1)/F

Thus we end up with:

P = (1 + F)^(N + D - 1)*L*F/((1 + F)^N - 1)

This can be reduced by (1 + F)^N:

P = (1 + F)^(D - 1)*L*F/(1 - (1 + F)^-N)

Now you could enter that formula in algebraic mode.
But if I remember correctly this is a little slow.
And of course we prefer RPN:

P001    LBL P  
P002 INPUT L Enter load L
P003 INPUT F Enter friction coeficient e.g 0.02
P004 INPUT N Enter the number of line parts
P005 INPUT D This is the number of deflected sheaves
P006 1
P007 RCL+ F
P008 RCL D
P009 1
P010 -
P011 yx
P012 RCL* L
P013 RCL* F
P014 1
P015 ENTER
P016 RCL+ F
P017 RCL N
P018 +/-
P019 yx
P020 -
P021 /
P022 RTN

Kind regards

Thomas

Edited: 9 Dec 2013, 12:52 p.m.


#17

Very nice, Thomas, your finding of a closed-form solution!

And thank you, Jean-Marc, for presenting an interesting program (even though not from my field of expertise). Don't worry about size, most import thing is to get the job done (my first RPN programs had a lot of needless ENTERs as well). I won't be surprise if someone shovels a step or two (you'll be surprised by the size-optimization some people here are capable of). Some fellow engineers might also like this:

http://www.hpmuseum.org/cgi-sys/cgiwrap/hpmuseum/archv021.cgi?read=213222

Welcome to the club, Jean-Marc, and

Best regards,

Gerson.

#18

Yes you understood the equation and improved it.


Possibly Related Threads…
Thread Author Replies Views Last Post
  HP35s Program Four Slings Lift Calculation Jean-Marc Biram (Australia) 2 2,295 12-16-2013, 07:21 PM
Last Post: Jean-Marc Biram (Australia)
  HP Prime: run a program in another program Davi Ribeiro de Oliveira 6 2,788 11-11-2013, 08:28 PM
Last Post: Davi Ribeiro de Oliveira
  Trouble entering a HP35s program line Arno 2 1,590 04-05-2013, 06:28 PM
Last Post: Arno
  HP35s scientific calculator GREG W THOMAS 4 1,983 03-22-2013, 06:49 AM
Last Post: Thomas Radtke
  HP35s "MEMORY CLEAR" flashes Mark Paris 1 1,527 08-31-2012, 07:35 PM
Last Post: Bart (UK)
  HP50G Max SDcard Storage space?? mr-scorpio 9 2,938 08-22-2012, 09:57 AM
Last Post: Bart (UK)
  Trying to calculate max energy that a wind turbine can get cyrille de Brébisson 4 1,889 08-06-2012, 06:03 PM
Last Post: Nigel J Dowrick
  HP35S keyboard Nick R 8 2,889 08-01-2012, 01:27 PM
Last Post: Dave Shaffer (Arizona)
  Where should I post new HP35s bugs Andres Capdevila 33 9,764 03-13-2012, 01:00 PM
Last Post: Jeff O.
  HP35s Internal Investigations - new processor? stefan 5 2,145 03-08-2012, 04:48 AM
Last Post: Paul Dale

Forum Jump: