HP-11C/15C Code optimization
|
10-26-2024, 03:14 PM
(This post was last modified: 10-26-2024 03:22 PM by jam.)
Post: #1
|
|||
|
|||
HP-11C/15C Code optimization
Hello everyone, I appreciate anyone who takes the time to read my concerns.
I am not an expert in programming the HP11C-15C. In some forum posts, I’ve seen very clever techniques to reduce the number of steps in certain programs, and I've been amazed. I'm trying to program the solution of the Colebrook equation to calculate the friction coefficient in a pipe using Newton’s method. Initially, with the parameters `4.2E-5 ENTER 126400 GSB B`, the runtime was 17 seconds. With the program below, the runtime was reduced to 10.18 seconds (on an HP11C, a bit longer on an HP15C). Can anyone recommend any improvements? My main interest is to increase execution speed, even if that means compromising a bit on program length. However, any suggestions are welcome. The Colebrook equation: \[ x = -2 \cdot \log(a + b \cdot x) \] where \( f = \frac{1}{x^2} \). The evaluation of Newton's method gives the following approximation: \[ x_{i+1} = x - \frac{x + 2 \cdot \log(a + b \cdot x)}{1 + \frac{2b}{\ln(10)(a + b \cdot x)}} \] LBL B 2.51 / 1/X STO 3 2 X 10 LN / STO 7 X<>Y 3.7 / STO 4 EEX CHS 5 STO 5 10 STO 2 LBL 1 RCL 2 RCL 4 RCL 3 RCL 2 X + STO 6 LOG 2 X + RCL 7 RCL 6 / 1 + / - STO 2 - ABS RCL 5 X<=Y GOTO 1 RCL 2 X^2 1/X RTN |
|||
« Next Oldest | Next Newest »
|
Messages In This Thread |
HP-11C/15C Code optimization - jam - 10-26-2024 03:14 PM
RE: HP-11C/15C Code optimization - Thomas Klemm - 10-26-2024, 08:04 PM
RE: HP-11C/15C Code optimization - jam - 10-26-2024, 08:56 PM
RE: HP-11C/15C Code optimization - naddy - 10-26-2024, 09:22 PM
RE: HP-11C/15C Code optimization - jam - 10-27-2024, 12:21 AM
RE: HP-11C/15C Code optimization - Albert Chan - 10-26-2024, 10:24 PM
RE: HP-11C/15C Code optimization - jam - 10-27-2024, 12:28 AM
|
User(s) browsing this thread: 2 Guest(s)