HP35s Calculator Max Rope Tension Program « Next Oldest | Next Newest »

 ▼ Jean-Marc Biram (Australia) Junior Member Posts: 7 Threads: 2 Joined: Dec 2013 12-08-2013, 09:40 PM 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 :: 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` ▼ Les Koller Senior Member Posts: 253 Threads: 20 Joined: Jun 2012 12-08-2013, 11:42 PM Nice work, and welcome to the forum! ▼ Jean-Marc Biram (Australia) Junior Member Posts: 7 Threads: 2 Joined: Dec 2013 12-12-2013, 12:11 AM Thanks Jeff O. Posting Freak Posts: 875 Threads: 37 Joined: Jul 2005 12-09-2013, 10:29 AM 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. ▼ Thomas Klemm Senior Member Posts: 735 Threads: 34 Joined: May 2007 12-09-2013, 12:31 PM 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 Jean-Marc Biram (Australia) Junior Member Posts: 7 Threads: 2 Joined: Dec 2013 12-12-2013, 12:13 AM I am always learning and improving and I don't mind listening to constructive suggestions. Willy R. Kunz Junior Member Posts: 17 Threads: 5 Joined: May 2013 12-09-2013, 10:33 AM 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. ▼ Jean-Marc Biram (Australia) Junior Member Posts: 7 Threads: 2 Joined: Dec 2013 12-12-2013, 12:10 AM 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. Thomas Klemm Senior Member Posts: 735 Threads: 34 Joined: May 2007 12-09-2013, 12:17 PM 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. ▼ Gerson W. Barbosa Posting Freak Posts: 2,761 Threads: 100 Joined: Jul 2005 12-09-2013, 08:17 PM 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: Welcome to the club, Jean-Marc, and Best regards, Gerson. Jean-Marc Biram (Australia) Junior Member Posts: 7 Threads: 2 Joined: Dec 2013 12-12-2013, 12:03 AM 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 1,506 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 1,843 11-11-2013, 08:28 PM Last Post: Davi Ribeiro de Oliveira Trouble entering a HP35s program line Arno 2 1,066 04-05-2013, 06:28 PM Last Post: Arno HP35s scientific calculator GREG W THOMAS 4 1,342 03-22-2013, 06:49 AM Last Post: Thomas Radtke HP35s "MEMORY CLEAR" flashes Mark Paris 1 974 08-31-2012, 07:35 PM Last Post: Bart (UK) HP50G Max SDcard Storage space?? mr-scorpio 9 2,050 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,342 08-06-2012, 06:03 PM Last Post: Nigel J Dowrick HP35S keyboard Nick R 8 2,009 08-01-2012, 01:27 PM Last Post: Dave Shaffer (Arizona) Where should I post new HP35s bugs Andres Capdevila 33 6,219 03-13-2012, 01:00 PM Last Post: Jeff O. HP35s Internal Investigations - new processor? stefan 5 1,511 03-08-2012, 04:48 AM Last Post: Paul Dale

Forum Jump: