Has anybody found any clever solver tricks for the 17bii that allow making unit converters that work like on the 19bii? By that I mean, store your input unit, then solve for any desired output unit. I'm sure there are plenty of L(), G(), and S() tricks I haven't fully explored yet.
17bii unit conversions
|
03-26-2012, 07:20 AM
03-26-2012, 08:03 AM
Here's one from about six months ago.
03-26-2012, 08:16 AM
Thanks Don!
03-26-2012, 08:57 AM
That looks pretty close to the technique I've used before, but it looks like it's limited to converting between mm and in, or m and ft, or km and mi. So there's no way to go from, say, in to km. I'd like to get as close to the 19bii unit converter as possible, so you could enter any one of mm, in, m, ft, km, or mi, and then solve for any one of the remaining five. I've got an idea that I think I'll tinker with on my 200LX, since that's a bit easier for typing out long formulas.
03-26-2012, 10:46 AM
Dave, I think I see what you want. It may be possible, but you will have to check and see which value was entered so you can convert from that to what you want, and if you do a conversion after that there will be two values already present, so you'll have to figure out what to do in that situation (maybe that's OK, just convert from either of the two). I'll play with this tonight when I get home.
03-26-2012, 11:26 AM
This is what I tried so far (on my 200LX, so the syntax and formatting will be a tiny bit different). It doesn't seem to behave as desired, though.
L(val:IF(S(mm):mm/10:0)+IF(S(m):m*100:0)+IF(S(cm):cm:0))=IF(i=1:cm:L(cm:val)*L(i:1)) The idea would be to do Clear Data, store the value into the appropriate starting unit, then immediately solve for that unit. That will convert it to cm and store that value in cm. (The variable i is used to indicate if the solver has been initialized.) Then you would be able to pick any of the other units in the formula, and it will convert them from cm. I suspect something is going wrong with setting val on the left side, and stuffing it into cm on the right side. When I clear the solver, store a value into mm, and solve for mm, it just zeros out mm, cm, and val, and sets i to 1. If I remove '*L(i:1)' from the right side to prevent initializing i, it initializes cm properly, but then you can't solve for the other units.
03-26-2012, 01:36 PM
Dave, this would be my approach. I only took it as far as 3 units: IN, FT, and MI, but it could be extended to include the other three units as well. You would have to Clear Data between calculations:
IF(S(IN):
03-26-2012, 04:07 PM
This almost works, but it seems to behave unpredictably (at least on my 200LX):
L(val:IF(S(mm):mm/10:0)+IF(S(m):m*100:0)+IF(S(cm):cm:0))=IF(i=0:L(i:val):i) The idea is to load 'val' with whatever value is in the variable being solved for, and then if 'i' is zero (i.e. it's the first "run"), load 'val' into 'i'. Subsequent runs then use this value that was stored in 'i' (which in this case, would be the length normalized to cm). This actually seems to be working most of the time. But for some reason, if I do Clear Data, I can't reinitialize using the same variable/unit I just solved for. It'll just zero it out. The sequence looks something like this:
18 Not totally sure what's going on here. I'll have to try it on my 17bii and 19bii tonight.
03-26-2012, 04:53 PM
Dave, I entered your equation on my 17bii and got these results:
clear data You are blazing new territory here. I have to admit I don't understand exactly what your equation is doing. I haven't tried it on my 19b but I expect the results would be the same.
03-26-2012, 05:15 PM
Yeah, just tried it on my 19bii and 17bii. Didn't work on either of them. The variables 'val' and 'i' never get set. Back to the drawing board.
03-26-2012, 07:17 PM
Hi Dave & Don, This is a very interesting solve problem. Looks simple, but is a lot deeper than it looks. My first few tries were trying to enter FEET into FT and then press a second time, but no matter what I tried, the solver would always zero feet out. The work around was to use a dummy variable X. The following listing is from the CPACK200 program, but should work on a real HP-17BII.
{IF (S(MILE):
To convert Miles to FT, IN, KM, and M, enter the miles into X and then press MILES key to do the conversion. Results are in each of the variables. Likewise for Inches, enter inches into X and then press IN key. The routine could be expanded to do the remaining units. Bill
03-27-2012, 07:55 AM
Hmm, interesting, if a bit "wordy". I'll have to play with that and see if there's a way to do it without entering the conversion factors twice. I have an idea, but it might be too crazy to work (like my last attempt). :)
03-27-2012, 11:59 AM
Alright, this works on my 19bii, but there are two problems with it. 1. It's kind of slow. 2. It's completely insane. I'll try to add some C-style inline comments, since it's not obvious what's going on here.
//Throwaway values (all the L() magic happens in here). But it works! All you do is Clear Data, store your starting unit, then immediately solve for that same unit. You'll get the same value back. Then if you solve for any other variable, you'll get the amount converted to that unit. |
« Next Oldest | Next Newest »
|