Just a Few More Things

Stack, no enter, mode, comma, type it, “.”, last.

We didn’t use any functions to manipulate the stack in the tour, but in daily use, you’ll be needing them all the time.

Especially one: swap

Classic:

Swap swaps the contents of stack positions 1 and 2.

Imagine you compute one result, then another, and then find yourself with the need to divide or subtract the second result by/from the first. Happens all the time.

With non-RPN calculators that can be quite a nuisance. With RPN calculators, you just swap.

Let’s try it.

Calculate (2+5)/5.

RPN entry for this is “2”, “5”, “+”, “5”, “/”.

Now divide 13 by this number.

Enter “13”

Tap 2nd level, ⌥ (SWAP)

Tap “/”

A thing of beauty.

Here’s another function you may often need.

Tap “5”, Enter

Tap “8”, Enter

Now add 4 to the result we had previously, now on level 3.

That sucks, you say? Having to Drop 5 and 8, which you so laboriously added, just to get back at that result?

There’s a stack function for that, too. It’s called: roll [above the Drop key: (ROLL)]

You give roll the stack level which you wish to pull down to position #1, with all positions in between moving one level up.

Tap “3”, tap 2nd level, ↺ (ROLL)

(You noticed, you didn’t Enter “3”? You could have, but as we’re getting proficient, we keep not pushing Enter when the next thing we do is trigger some action. We exploit “auto-push”.)

Tap “4”, tap “+”. Done.

In the tour, we cleared the stack several times by repeatedly pushing the Drop key.

Now, in actual use, you’d use a different function for that: clear

Try it now.

Tap 2nd level, (CLEAR) (Above the zero.)

Ok, enough of the stack. Know that there’s a whole menu, Stack, with functions that manipulate the stack. It can be a great time saver to know these functions well.

The mode menu: mode (MODE). It’s quite important.

This where you set the angle mode (Radian, Degrees) and the way numbers are being displayed.

Let’s see the effect of changing the number display format.

Let’s type in a complex number: “(7,8” (w/o quotes)

Take the square root.

Now we need two lines because of all the digits after the point.

Tap “4”. Tap fix (FIX).

If you calculate with money, you typically set this to 2. It will round correctly. In FIX mode, numbers will also display with a thousands separator, when applicable.

Tap std (STD) to get back to displaying all digits.

360° (DEG), 2π (RAD) do the obvious: letting you set the angle mode.

In the iOS Settings app, under ND1, you can configure which mode you want to see shown at the top of the display. The default is to show , but maybe you want a clear display when in this mode and have yourself visually alert only when you’re in Degree mode. If so, change this in Settings. (There’s other good stuff in there as well.)

The comma key.

It’s a BIG time saver.

If you have multiple arguments to enter, instead of pressing Enter between each, you can just place a comma.

Try “3,4,5,6,7” (w/o quotes, but with the commas), then Enter.

Let’s use this while we look at the Units system.

Type “5,in,cm” (w/o quotes), then 2nd level convert (CONVERT).

Note, we exploited “unknown-becomes-a-name” mechanism here, by not putting our units in quotes. If you had an in or cm variable in your local folder, this wouldn’t have worked.

Let’s try another one. Let’s figure what escape velocity from earth (11 km/s) would be in miles per hour.

Type “11,’km/s,’mph” (w/o quotes), then 2nd level convert (CONVERT).

(Okay, so scrap the “mod the car and use a ramp” idea.)

This time around we entered the unit names with quotes. Note that

(That is, you didn’t have to provide closing quotes for ‘km/s’ or ‘mph’.)

ND1 can do 160 or so conversions and is smart about SI Unit prefixes. For example, there’re no units “cm” or “km” in the Units definitions, but there is “m”. ND1 recognizes the prefix before the SI Unit “meter” and does the right thing.

You don’t have to know the unit abbreviations, common names also work. Try: “1,Calorie,Joule” (w/o quotes), 2nd level convert (CONVERT). (With unit abbreviations, you’d use “1,ca,J”.)

The Unit system contains a good number of physical constants that can come in very handy. Weight, length, area, volume, time, frequency, speed, acceleration, pressure, force, energy, power, charge, temperature, and angle conversions are all covered.

Better yet, perhaps, you can inspect and augment the system, even add your very own units and conversions. Most Unit conversions are factor-based, but ND1 allows any arbitrary expression, even RPL programs (!), to be used.

If this interests you, look in My Data | Units for the Temperature conversions, which deploy (mini-)RPL programs to do conversions.

Unary minus.

To enter a negative number, use the ± key. You cannot simply use the “-” key, as it, as operator, will issue a command. Except, when you’re in an expression, you may. (Because, when typing an expression operators print their names, instead of “operating”).

So, to enter -6 to the stack, do this

Tap “6”, tap ±, Enter

In an expression you can use the “-” key, but you may want to use the ± key anyhow. Esp. because it has a few tricks upon its sleeve.

Try this:

Type (and don’t enter) ‘5+6     (use ± or the “-” key between 5 and 6)

Now tap ±

As you see ± inverted the sign for you. If you had typed 5+6 it would have made that into 5-6.

Enter.

Here’s another very important thing:

If you have a variable named “A” in your local folder, you don’t have to navigate to the folder and type its soft-key. Oftentimes, it’s way easier to just type it in. Type A (w/o any quotes) and you’ll be recalling its contents.

Similarly, you don’t have to go to the Trigs menu to get to the sine function. You can just type sin or SIN (both will work in both modern and classic modes).

Now, here’s some added niceness about that:

Here’s an example for that.

Enter “INTC (type the double-quote)

Type Stocks.quote

No matter what folder you’re in, this will work, because you’re using the folder name in which quote is defined, and the “.” operator. This will also work from within an RPL program. (That is, a mini-program like ≪ "INTC" Stocks.quote ≫ will run from any folder.)

If you want to inspect the contents of a variable without evaluating it (for example, you want to edit function/program, rather than running it), here’s a nice short-cut:

You’ll want to use this a lot when writing programs.

By the way, you surely noticed that you can flick through the stack with your finger. Know that if you start your scroll in the display area, you can drag past it into and over the keys area, and keep scrolling. That’s very convenient, if you have a big stack and want to quickly inspect your last 10 positions or so, without having to switch to fullscreen mode.

Last, but not least: last. Immensely useful.

Try it: 2nd level last (COMMAND)

This shows you the last command line entered on the stack. (It’s especially useful if you used commas, as you can get back to a complex input sequence.)

There’s another key, args (LAST), that does the same for the last arguments used. (So, if you didn’t use commas, you can still get the last command and all its args by tapping args (LAST) followed by last (COMMAND).)

Great. You did it! This is truly the end of the “basics.” All that’s left for you to get good mileage out of ND1 is exploration. We recommend you look over the functions list in References and pursue Tutorials (such as Graphing) or Reference sections that might further interest you.