Any RPN, No regs, line given 2 points
|
12-24-2017, 06:55 AM
(This post was last modified: 12-26-2017 04:15 PM by Bill Duncan.)
Post: #1
|
|||
|
|||
Any RPN, No regs, line given 2 points
Thought this might be useful for others. Use it either by itself or as a subroutine. I often use it with the HP-29c, but should work with any. Given 2 points it returns the slope in X, intercept in Y which is convenient for keying in another X for a linear estimate (just enter X, * and +).
Code:
As a trivial example, moving data. Say, I'd copied 100gb of data an hour ago, 150gb are currently copied; how long will it take to copy all 1000gb? -1 enter 100 enter 0 enter 150 gsb 0 1000 * + Answer, 17 more hours.. |
|||
12-24-2017, 10:56 PM
Post: #2
|
|||
|
|||
RE: Any RPN, No regs, line given 2 points
Code: CLsigma Then use \( \hat{x} \) or \( \hat{y} \) to calculate interpolations and linear regression to get the slope and intercept. Pauli |
|||
12-24-2017, 11:01 PM
Post: #3
|
|||
|
|||
RE: Any RPN, No regs, line given 2 points
Yes, but the CLsigma and sigma+ functions use registers
|
|||
12-24-2017, 11:10 PM
Post: #4
|
|||
|
|||
RE: Any RPN, No regs, line given 2 points
On the 42S REGS could be saved and restored I guess.
Pauli |
|||
12-24-2017, 11:10 PM
Post: #5
|
|||
|
|||
RE: Any RPN, No regs, line given 2 points
(12-24-2017 12:58 PM)Mike (Stgt) Wrote: Special version for HP41 Very cool, yes, the extra stack operations available on the 41 are fabulous. I did want something I could use on various machines however, but thanks! |
|||
12-24-2017, 11:16 PM
Post: #6
|
|||
|
|||
RE: Any RPN, No regs, line given 2 points
(12-24-2017 11:10 PM)Paul Dale Wrote: On the 42S REGS could be saved and restored I guess. Yes, linear regression could be used, but seemed like overkill using 6 registers. Also, not available on the hp-29c. I wanted something usable on any, and callable as a subroutine (with minimal side effects). But thanks! |
|||
12-25-2017, 03:42 PM
Post: #7
|
|||
|
|||
RE: Any RPN, No regs, line given 2 points | |||
12-25-2017, 04:00 PM
Post: #8
|
|||
|
|||
RE: Any RPN, No regs, line given 2 points
(12-24-2017 12:58 PM)Mike (Stgt) Wrote: Special version for HP41 Yes, direct stack access on the 41 and 42 is nice. But equations are even nicer – e.g. on the 35s: Code: (REGT-REGY)/(REGZ-REGX) (12-24-2017 12:58 PM)Mike (Stgt) Wrote: Output - slope in X, y-axis intercept in Y. Same here. But all these are no universal solutions that will run on virtually any programmable HP RPN device, such as the solution in the initial post. Dieter |
|||
12-26-2017, 12:46 AM
Post: #9
|
|||
|
|||
RE: Any RPN, No regs, line given 2 points | |||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 1 Guest(s)