![]() |
HP 35s "Low footprint" Linear Interpolation - 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: HP 35s "Low footprint" Linear Interpolation (/thread-146636.html) |
HP 35s "Low footprint" Linear Interpolation - Elliott W Jackson - 02-08-2009 Hello, I went to college from '80-'84, and lived and died by my HP 41CV. I wrote dozens of programs for it as I progressed through my courses. I recently picked up a new HP 35s, and decided to convert one of my oldest, most-used HP41 programs to the 35 as a learning exercise mainly. The program just does simple linear interpolation. Suppose we have a table of data such as
... Given any value X, it simply estimates Y using linear interpolation. The equation to do that is brutally simple, it is just such a frequent need that it is a great candidate for a quickie program. As a further requirement however, I decided that I wanted to make it "low footprint," i.e. such that it only used the absolute minimum of the 26 A..Z named storage registers, and relied instead on the 800 indirect-addressed unnamed storage registers for any temporary storage requirements. I'm not sure how strong a need that is, frankly, but I thought it might be, to preserve the named registers for use as variables in equations, and allow those values to remain unmolested and untrampled-upon. That design decision did complicate things a bit, resulting in some muddy-looking code as the program plays games with the stack, but it's not too bad. Program Name: "L" (it lived for years as "LIP" in my HP41 calculators) Named storage registers used: I Un-named indirect addressed storage registers used: "n" through "n+3", where the value of "n" is set early in the program and can be easily changed if needed. Default = 10.
L001 LBL L As mentioned, the linear interpolation equation is trivial and straightforward and not really worthy of much discussion. The only thing possibly novel in this program is my attempt to make it "low footprint", and use the un-named storage registers as much as possible for temporary storage needs, rather than the named A..Z registers. That decision did complicate the code a bit, as I had to manipulate I in the middle of the "real math", which complicates the listing somewhat.
Best, Re: HP 35s "Low footprint" Linear Interpolation - Cliff V - 02-15-2009 thanks for the program. step 23 is missing.
Re: HP 35s "Low footprint" Linear Interpolation - Elliott W Jackson - 02-15-2009 Oops, thanks for noticing. It's actually not missing, my line numbers are just messed up. The LN and CK numbers are correct, and the program should end on line L048.
|