dcalc - manual


This is an html version of the helpfile on the Psion - it might be useful on your PC.

1. Introduction

Welcome to dCalc, a quality application from Bob Hepple

Support: bob@PocketIQ.org

Internet: sedumi.freeshell.org/psion

2. How to register

dCalc is shareware which means that you can try it out for free for up to 4 weeks. You can also distribute it freely as widely as you like (the wider the better, as far as I am concerned!). If you decide that you like it, you can get a permanent license for a small fee. There are four ways to pay:

www.handango.com

Address for cash registrations:

Bob Hepple,

Suite 296, 131 Old Cleveland Rd

Capalaba,

QLD 4157,

Australia

Registration brings several benefits to you:

Firstly, registering will remove the nagging startup screen.

Secondly, you will be entitled to all future versions of dCalc for the Psion that I write and if you provide a email address you'll be notified when new versions are available.

Thirdly, by paying the (very small) registration fee, you will ensure that there will indeed be future versions of the program with morefunctions and fewer bugs.

It is a one-time registration valid for any Psion that you personally own. There is no crippled functionality in the unregistered program - just the nag screen and the nagging thought that you ought to do the right thing.

Corporate and other group terms are slightly different but are calculated at the same (already low!) rate as individual licences - one payment per Psion. As for personal use, it is a permanent license.

3. Overview

DCALC is a calculator very similar to the venerable line of calculators that HP has sold for the last 30 years or so. Like the HP calculators it operates much more intuitively than calculators with an equals sign.

It features:

DCALC operates on real numbers with Scientific, Statistics and Financial functions or 32-bit integers (for programmers).

The precision in Scientific, Financial and Statistics mode is about 15 significant places of decimals.

As well as the stack, which is always visible - a nice plus over an actual HP calculator - there are 10 integer and 10 real registers to store numbers.

All your numbers and settings are saved between sessions and DCALC works with other applications by supporting Cut and Paste into and out of the X register.

A full set of unit conversions including:

DCALC runs on the Psion-5, 5mx, Ericsson MC218 and the Revo. No, I'm sorry there are no versions for the Series 3, 3c or Siena. f you want a version on another platform let me know!

4. Getting Help

You're already there!

If you want to do know what a key will do, press the Explain button on the toolbar (or Ctl-X or Menu->Help->Explain key) and then the key. An explanation will be given instead of operating the key.

To exit this help, press Ctl-E. If you're desperate - drop me an email.

5. A Short RPN Tutorial

RPN is an easier way to use a calculator than the so-called algebraic method on so-called conventional calculators. It's just a shame that HP called it RPN, which means Reverse Polish Notation and that puts a lot of people off!

Think about how you do a sum on a piece of paper because that's how RPN works:

You write down the first number.

Then you write down the second number.

Then you do the sum.

Now, let's do it on dCalc. Write down the first number (by tapping the screen keys or pressing the number keys). You can use the BSP (backspace) key to correct any mistakes.

Now press the Enter key.

Now tap out the second number - the first number jumps up into the Y register above X - the large numeric display. When you've finished the second number press the key for the sum you want to do, for example, the + plus sign. There's your answer.

Not so very awful after all, reverse whatsit or not.

If you want to do another sum on the answer, just tap in the new number and then the key for the operation, e.g. X, multiply.

6. Entering Numbers

Just use the screen keys or the keyboard keys. In Real modes (FIN SCI STA) you can use the decimal point and 'E' key which allows you to enter powers of ten e.g. if you enter 1 E 5 you get 1.0x105 or 100,000.00

You change the sign of your number with CHS

You can use BSP to backspace at any time (or the del key)

You can use CLX to completely clear X.

INV CLX clears the stack.

Invalid characters will be simply ignored e.g.

In Real modes:

In PRO mode:

7. The Stack

Above the large numeric display (called X) there are four smaller numbers called Y, Z, T and L which make up the stack..

L is simply the last X value - every time the number in X is used, it is stored into L. You can exchange X and L by simple tapping the L register..

The stack (Y, Z and T) is connected to X. Every time you tap Enter, the numbers in X, Y, Z and T propagate upwards. The number in Z moves to T, Y moves to Z and X moves to Y. The number which was in T is forgotten.

Numbers move down the stack as they are consumed in X - e.g. if you tap + repeatedly, Y and X are added and put into X, Z moves down to Y and T moves down to Z. Try it.

You'll notice that the number in T stays put - it is copied when the stack is consumed at the bottom - this is really useful in repeated calculations

e.g. to work out how interest compounds every month just put in the interest rate percent (as a real number - 1.1 means 10%) and then press Enter until the interest rate reaches the T register. Then tap in your principal, say 1000.00 (don't press Enter!) Then just keep pressing the X (multiply) key - every time the principal is compounded by 10%.

There are other keys to manipulate the stack, mentioned elsewhere in this help. The stack is your best friend and using it well is the secret to effective calculation with RPN.

8. RollDown

The Roll stack operator rotates the stack downwards -

T->Z

Z->Y

Y->X and X goes back up to T.

9. Exchange X

You can exchange X and any other number in the stack by tapping that number on the screen.

The X key exchanges X and Y.

10. The registers

There are 10 registers labelled 0-9. You can store X into a register by tapping STO. A menu of all the registers appears and you tap on the register you want to use. Recall from registers is done in the same way (RCL key)

The registers are stored every time you exit so that the values are available next time.

You can add, subtract, multiply and divide X to a register with ST? which pops up a menu for:

11. Cut/Paste

The usual shortcut keys Ctl-c and Ctl-v work in DCALC as well as the silk screened buttons to the left of the screen and Menu->Edit->Copy and Paste..

Ctl-c copies the X register into the clipboard which can then be used in a spreadsheet or Word processor. Similarly, if you are in another Psion application and copy a number to the clipboard (with Ctl-x or Ctl-c) then you can paste it into X with Ctl-v.

Obviously, if it's not a number, you'll get an error message.

12. Main Modes

There are 4 main modes - Scientific, Financial, Statistics and Programming.

The first three operate on real (floating point) numbers and programming mode operates on 32-bit integers. To change mode just use the buttons PRO FIN STA and SCI, the pull-down menus or shortcut keys:

Ctl-s SCI scientific mode

Ctl-f FIN financial mode

Ctl-p PRO programming mode

Ctl-t STA statistics mode

Don't confuse the SCI and the Sci buttons - the Sci button changes to Scientific Display mode (e.g. 1.0E-6 - see under Real Modes).

There is an indicator to the right of the message window showing the current mode.

13. PRO Mode

PRO mode can operate and display binary (BIN), octal (OCT), decimal (DEC), hexadecimal (HEX), Internet Protocol address (IP) and ascii (ASC) formats.

Ascii format shows the value of each byte as a printable glyph (a-z, A-Z, 0-9 etc) or as an control/alt keystroke e.g. ^-a means control a (decimal 1), a-b means alt-b which is 0x80 + 0x62. Note that Ctl- shortcuts are not available in Asc mode - they enter the appropriate ascii code instead.

Hex numbers are displayed with a leading 0x, octals with a leading 0.

IP address numbers are displayed as 4 decimal numbers in the range 0-255, corresponding to bits 0-7, 8-15, 16-23 and 24-31. The same bit manipulations can be made with IP numbers as for any other format eg.to calculate a subnet address using AND. The other arithmetic operations operate as before but are fairly meaningless on an IP address.

There is an indicator to the left of the log key showing the current display number base.

The usual suspects including AND, OR, XOR, MOD, left/right shift, complement. The logarithm, pi, e, square root and 1/x keys do not work in Prog mode.

The P-F key calculates the prime factors of X.

32 bit integers are used.

14. Real Modes

By Real I mean Financial, Scientific and Stats modes.

Entering numbers should be fairly intuitive. For very large or small numbers, you can use exponent notation. For example, type:

1 E 15 CHS

for 1.0E-15. Notice that before the E is entered, the CHS button applies to the sign of the number. After E is put in, CHS applies to the sign of the exponent.

Angles for trig functions are normally expressed in decimal degrees, but a minor mode exists for radians - use the toolbar Mode key or the pull down menu.

There is an indicator to the right of the message window showing degrees or radians setting.

There is also an invert function INV which reverses the sense of some functions - for example, if INV is tapped before SIN then the asin function is called instead. Hopefully this is intuitive.

There is an indicator to the right of the message window showing the status of Invert.

In all real modes you have acces to:

The Fix, Sci and Eng keys allow you to select the mode of real number display. Fix mode is the default and displays as e.g. 10.123. Very small or large numbers use scientific mode.

Sci real mode displays as 1.0123E+01 with a mantissa and exponent.

Eng mode restricts the exponent to be a power of 3 e.g. 10.1230E0

15. SCI mode

The trig functions SIN, COS, TAN and their inverse functions are provided as well as the hyperbolics Sinh, Cosh and Tanh and their inverses..

h\.ms converts a decimal hours into sexadecimal hours, minutes and seconds (or back if Invert is pressed first). e.g., 2.56 hours converts to 2 hours 33 minutes and 36 seconds which is displayed as 2.3336.

The r->p button converts from rectangular coordinates to polar (or the inverse)

The d->r button converts from degrees to radians (or the inverse).

16. FIN mode

Compound interest and other financial calculations.

In these calculations we are interested in:

With any 4 of these values, we can calculate the fifth. E.g. if we know the initial value, the interest, the number of compounding periods and the regular payment, we can calculate the final value. Similarly, if we know the value of a mortgage, the interest rate and the repayment period, we can calculate the payment necessary to pay off the mortgage in the time given.

With all the financial functions, the method of data entry is optimised - if you type in a number and then press a key (e.g. PMT) then DCALC stores that number. If you press a financial function without entering a number, DCALC calculates that value. If you press a financial key and the number is entered instead of calculated, just press the key again to perform the calculation.

Finally, if you press INV before a function, the current value is retrieved to X. You can see all the current values at once by pressing RCL (and then Cancel to return to the calculator)

The financial keys are:

Note that cash flows (PMT, FV, PV) are negative for payments..

The CLf key clears all the finance registers which are:

There is a global setting under Menu->Mode->Annuity at Begin/End or Ctl-h which when set, allows a payment to be made at the start of the investment. Otherwise, the first payment is calculated at the end of the first period.

The DYS function allows you to calculate the number of days between 2 dates. The dates must be entered as YYYY.MMDD.

If prefixed by INV, DYS calculates the number of days in a nominal month as 30 days in a 360 day year.

The TDY key is a shortcut for today's date.

Compound Interest Example:

let's invest $1000 for 3 years at 5% per annum paid monthly.

Tap in:

3 Enter ×12 ... 3 years is 36 months

1000 PV ... present value

5 Enter ÷12 i ... interest (5% per annum = 5/12 monthly)

0 PMT ... we are not making monthly payments

FVl ... the final value is $1161.47

Another example: we have a $100,000 mortgage at 6% to be paid off completely after 20 years. What's the payment every month?

20 Enter ×12 n ... 20 years

6 Enter ÷12 i ... monthly interest

100000 PV ... present value

0 FV ... future value will be 0

PMT ... -716.43 per month.

Note the change of sign - the payment is a negative cash flow, and don't we know it!

The formula for these calculations is:

0=f+p(1+i)n + d((1+i)n - 1)(1+s.i) / i

where:

The calculation for i is done by a Newton-Raphson iteration so may take a few seconds and in some circumstances may not converge at all.

17. STA mode

Calculating sums, means and standard deviations is easy with these functions which operate on X and Y. The SUM key adds the current values in X and Y into the sum and increments the counter. Just keep entering your values and the running total is kept.

The m key gives the averages (means) of the X and Y values respectively.

StdD gives the standard deviation of both X and Y (into the X and Y registers). StdD, d is given by:

d² = (S(x²) - S(x)²/n)/(n-1)

where S(x) means the sum of x values

n displays the count.

Sum- subtracts the current X and Y from the total (e.g. if you entered a value incorrectly).

The statistics registers are:

x! predictably computes the factorial.

yPx and yCx calculate permutations and combinations for x <= y. The integer part of x and y are used.

LR calculates a linear regression using the least squares method on the values input as (X, Y) pairs by Sum. A best fit straight line is presented as the slope m in the X register, and the Y intersect c in the Y register. The correlation coefficent r² is provided in Z - a value of r² closer to 1 means a good fit to a straight line. r² close to zero means a poor fit.

You can display the current linear regression formula with INV LR. The OPL formula given can be copied and pasted into one of the programmable keys or into the graphs function.

The best fit line is given by the formula

y = my + c

S(x) means the sum of x values:

Dx = n.S(x²) - (S(x))²

Dy = n.S(y²) - (S(y))²

m = (n.S(xy) - S(x).S(y))/Dx

c = (S(x²)S(y) - S(x)S(xy))/Dx

r² = m.Dx/Dy

f(X) calculates a value for Y from X using the straight line calculated by LR. Use the INV function to calculate the value for X for a given value of Y.

18. Programmable Keys

The keys initially marked f1-f3, f(X) and f'(X) are programmable in the Psion's native language OPL. To program one of these keys, press it while holding down shift. You can then set the label (up to 4 characters) and the function. f(X) and f'(X) (function keys 4 and 5) are used in Newton-Raphson approximations but you can label them and assign them as you wish.

OPL is similar to Basic and gives you access to a huge number of functions and all the data stored in the calculator. A full tutorial on OPL is not possible here (see the Symbian website) but here is a short guide to get started.

You can access the stack variables - X Y Z T L and the registers R0..R10. The integer variables (from PROG mode) are also available as X& Y& Z& T& L& R0&..R10& but due to limitations in the EVAL function of OPL, the programmable keys are only available in floating point modes SCi, FIN and STATs.

The arithmetic operations are:

+ - * / (note: not × and ÷)

** for exponentiation (not ^)

SQR(x) for square root

% for percentage

Functions: Note that built-in OPL functions are notated in capitals here e.g. SIN(x). dcalc internal functions are denoted in lower case and have a colon.

SIN(x), ASIN(x), COS(x), ACOS(x), TAN(x), ATAN(x), atan2:(y,x)

sinh:(x), asinh:(x), cosh:(x), acosh:(x), tanh:(x), atanh:(x)

RAD(x) converts from degrees to radians - the trig functions all use radians so you need to do SIN(RAD(x)) if x is in degrees.

EXP(x), LOG(x) (base 10), LN(x) (base e)

ABS(x) gives the absolute value of x.

INTf(X) gives the integer part of x.

Extra functions available:

RND gives a random number from 0 to 1.

seed:(x) sets the random number seed to x. dcalc sets the seed on startup with the time of day in millisecs.

fact:(x,y) gives N!/M! e.g. fact:(4,1) gives 4!

19. Newton-Raphson

dcalc can perform Newton-Raphson approximation on a function. The idea is to find solutions of the general equation f(X)=0. If xn is the nth approximation for x then the formula for the next (hopefully better) approximation is:

f(xn+1) = xn - f(xn)/f'(xn)

f'(X) is the derivative of f(X) (or dy/dx). Both functions must operate on X for this to work.

dcalc will stop iterating after 30 seconds if a solution is not converging. Of course both functions f(X) and f'(X) must be entered correctly before the iteration can proceed - check them out individually. They work just like the other programmable keys on X.

For example, we want to find values of x that solve the equation:

x3 + 9x2 + 11x - 21 = 0

Put the following OPL into the f(X) and f'(X) programmable function keys:

f(X): x*x*x + 9*x*x + 11*x - 21

f'(X): 3*x*x + 18*x + 11

Now put a guess into the X register - e.g. 20 and press the N-R button and you should get the answer 1. Since this is a tertiary equation you can find up to 3 solutions - you'll need to try other starting guesses to find the other solutions - or factor out the first solution and solve the simpler quadratic:

x3 + 9x2 + 11x - 21 =

(x - 1)(x2 + 10x + 21)

20. Graphics

dcalc has a useful graphing function to allow you to create (X, Y) graphs of any OPL function (see under Programmable Keys for details of OPL).

To enter the graphics menu, select

Menu->Tools->Graphics or use the Graphs button on the toolbar.

Creating a graph consists of

Try it now - a simple function is pre-loaded into the graphics menu so you can just press Plot!

To finish viewing the plot, press the Calc button to return to the dCalc menu.

While the plot is displayed, you can touch the screen and a cursor and coordinate readout will appear. This can be useful, for example, to get the coordinates of an intersection of two graphs

The plot can be controlled through the Globals, Axes, Ticks and Functions settings on the graphics menu.

With Global you can set up the size of the plot e.g. if you want it smaller than the default full screen. Smaller plots are faster.

The Plot Interval governs the distance in X between consecutive plot points - the higher the Plot Interval, the coarser and faster the plot. Finally, a Grid can be selected - either dots or faint lines.

Under the Graph Axes element of the graphics menu, you can set the X axis... i.e. the value in Y that the X axis is to be drawn - in units of Y, of course. The default is 0. Similarly, set the Y axis as the value in X that the Y axis is to be drawn. You can also set the range in X and Y that you want plotted.

The Graph Ticks item allows you to set the interval for axis ticks (on grid dots if selected under Globals). Similarly, the interval for axis labels can be set - don't set them too close or you'll get a blur.

The Functions menu allows you to specify the OPL code that you want plotted. There is a discussion of OPL under the Programmable Keys heading which applies equally to this section. There is a Pen Width item for each function - a width of 0 supresses the plot of the corresponding function. Larger pen numbers give thicker plots. The graphing functions are stored independent of the Programmable Keys f1-f5 - but you can always use copy and paste between them.

All plot settings are saved by dcalc on exit along with all other settings in the dcalc.ini file.

Plot files

The format of the plot file is that provided by the standard Psion gSAVEBIT OPL call - in other words, an MBM file. Curiously, the standard Psion Sketch application does not read this format by default but you can persuade it to import it. You have to open Sketch, clear the screen (Menu->Edit->Delete all or Ctl-d), and then merge in the plot file (Menu->File->More->Merge in) making sure you set the File Type to EPOC Picture.

You can also, read the graph format into a PC and convert it to other formats including Sketch. Or you can get the excellent mbmview program to convert it on the Psion.

21. Conversions

In real modes you can convert between a wide range of units. Just tap on the Convert button on the side bar (not available on the Revo), Ctl-C or Menu->Tools->Convert

The conversions are arranged in groups:

The last category allows you to input the values of up to 36 currencies of your choice. The first currency listed is used as the base for all transactions and should have a 'rate' of 1.

You can change the rates and the names of the currencies by tapping on Modify Rates while in the currency converter. Your settings will be saved.

Whenever any rate is changed, the date displayed on the converter is changed to the current date.

There is a daily currency file available at http://www.geocities.com/bob_hepple/dcalc/psion/update.txt

Download it to the Psion and use Menu->File->Read currencies or Ctl-y to read it into dCalc. Newer values will be updated but other currencies manually entered will not be affected.

More detail on currencies.

The currency rates are read and stored by dCalc whenever the program is started or exited. There is a plain text file: C:\System\Apps\Dcalc\Currency.txt with the following format:

08 Feb 201

Euro,1

US$,1.07353730542136

£,1.56739811912226

A$,0.590074939517319

...

The first line is the date that the rates apply. Up to 12 characters are used. The remaining lines consist of a currency abbreviation (up to 12 characters) a comma and the rate. The rate may be an OPL expression such as 1/1.234.

You can edit this file as you wish - just make sure it is formatted correctly and is saved as a text file.

22. Keyboard shortcuts

Most of the keyboard keys operate the way you would expect, e.g. the numeric, Backspace (Del) and Enter keys.

Some shortcuts are:

Ctl-a displays the 'About' message

Ctl-A Axes in graphics mode

Ctl-c Copies X to the clipboard

Ctl-C conversion in real modes

Ctl-d sets Degree mode

Ctl-e Exits

Ctl-f Financial mode

Ctl-F Functions in graphics mode

Ctl-g Graphics on/off

Ctl-G Globals in graphics mode

Ctl-h Toggle payment at N=0

Ctl-H Help

Ctl-i set number of decImal places

Ctl-o set preferences

Ctl-p Programming mode

Ctl-r Radians

Ctl-R Register

Ctl-s Scientific mode

Ctl-t sTatistics mode

Ctl-v paste to X

Ctl-X Explain next key

Ctl-y Read in currency file

x swap X and Y

y h multiply (j on AZERTY kb)

u j divide (k on AZERTY kb)

i k plus (l on AZERTY kb)

o l minus (m on AZERTY kb)

< shift X left by 1 bit (prog mode)

> shift Y right by 1 bit (prog mode)

! factorial

~ complement X (prog mode)

& toggle FIX & SCI display (real modes)

\ 1/X (reciprocal) (real modes)

, (comma) CHS (real modes where decimal point = .)

. (full stop) CHS (real modes where decimal point =,)

p PI

R recall

S store

L lastx

q quit

% percent

In addition, once DCALC is running, you can bring it to the front with the hotkey, which is initially set to Ctl-Fn-D. You can change that to any other key through Menu->Tools->Hotkey or Ctl-o.

Instead of using a Ctl-Fn- keystroke you can let dcalc steal the Calc button (below the screen) from the built-in calculator (not on the Netbook).

You can set the keyboard type to one of:

English/Euro ... ×=y/h ÷=u/j +=i/k -=o/l

MC218 ... ×=r ÷=t +=y -=u

French/AZERTY ... ×=j ÷=k += l -=m

with Menu->Tools->Preferences

23. Planned features

Features that might make it into future versions include:

What do you want to see?

24. Credits

Thanks to Al Richey for the excellent RMRevent framework used in this program - check out his great software at http://www.rmrsoft.com

Thanks to Richard Smedley for SafeOPL and ScrambleOPL copy protection software: http://www.cix.co.uk/~rsmedley/s5/

Thanks to Manfred Schories for the German translation.

25. Internet / eMail

Keep your eye on http://sedumi.freeshell.org/psion for news and new versions.

email address:: sedumi@freeshell.org

26. Licence Agreement

The Pocket IQ End User Licence Agreement (EULA) is a legal agreement between you and Pocket IQ Limited. By downloading or installing this SOFTWARE, you agree to be bound by the terms of this Agreement. If you do not agree to the terms of this Agreement, remove this SOFTWARE immediately.

Pocket IQ END USER LICENCE AGREEMENT (EULA)

This licence refers to any product which is distributed by Pocket IQ.

GRANT OF LICENCE

This Pocket IQ Licence Agreement ("Licence") permits you to use one copy of this product, on multiple machines which may include user documentation provided in electronic form ("SOFTWARE"), providing it is for the sole, exclusive use of the registered user. The SOFTWARE is licensed as a single product. Its component parts may not be separated for use on more than one computer or by more than one user at any one time.

COPYRIGHT

The SOFTWARE (including any images and text incorporated into the product) is owned by Pocket IQ and the independent application author, or its suppliers and is protected by English copyright laws and international treaty provisions.

REVERSE TRANSLATION

The SOFTWARE, including all related program files may not be altered in any way. Reverse Translation is expressly forbidden without written permission of the Pocket IQ and the independent application author.

LIMITED WARRANTY

To the maximum extent permitted by applicable law, Pocket IQ and the independent application author disclaims all warranties, either express or implied, including but not limited to warranties of merchantability and fitness for a particular purpose. In no event shall Pocket IQ, the independent application author or its suppliers be liable for any damages whatsoever (including, without limitation, damages for loss of business profits, business interruption, loss of business information, or other pecuniary loss) arising out of the use or inability to use this Pocket IQ product.

The SOFTWARE is supplied 'as is' and no advice or technical support is guaranteed from Pocket IQ or any third party.