scicalc manual


scicalc is an ongoing project to develop a better pocket calculator for PDAs. 

the idea is that, although pocket calculators are cheap and plentiful, PDAs are becoming ubiquitous. why carry a calculator when these devices could support a virtual calculator which can be continually improved and updated.

general principles

the 90/10 rule says that most of the time will want to perform basic calculation. for this, a calculator should be simple to use and offer buttons that do these with a single press. these are the four usual operators, brackets, square, square root, change sign, reciprocal, memory, powers, and backspace for clearing entries or partial entries.

although this may sound trivial, it is important to make common operations easy to access. squaring is a common operation and should take only a single key press. both open and close bracket should be on keys of their own. modern algebraic entry calculators seem to require both a binary and unary minus key. this is really bad. so many times ive hit -2 to get "syntax error" because i should use the unary minus button. there is no need for this.

personally, ive always preferred postfix operators like 5 tan rather than tan(5), although the latter is correct algebraically. in practice most operations are part of a calculation chain where a number is currently on display and an operation is required. to do this, modern machines need to have a last result button. so, for example, i have 5.123 on display and i want to square root it. i want to just press the square root key and not have to type SQRT(ANS). in many machines i have to type in the brackets as well! i find this inefficient and infuriating.

rare and obscure operations are available on scicalc either on the 2nd page of buttons or only in the expression window. the latter are documented in the help functions menu library.

basic operation

this is mostly straightforward, but there are a few minor details made clear by examples.

basic operation chain operation precedence
1+2=3 1+2=3+2=5 1+2*3=7
-1+2=1 1+2=3-1=2 1+2*3^3=55
1+-2=-1 1+2=3--2=5 -2^2=-4 (treated as chain)
1--2=3 1+2=3+-2=1 1+-2^2=5 (treated as unary -)

the expression window

the top line is the expression window. the algebraic version of the current calculation is constructed on this line when you perform direct calculation. its purpose is confirmation of operation and to keep a record of the last calculation. by tapping on the expression window, the text may be edited and re-evaluated. scicalc knows when the expression has been modified and will evaluate it if '=' is pressed. note that if '=' is not pressed, the modified expression will be ignored and the machine will continue the original calculation displaying that instead.

the expression window has access to 26 registers named 'a' through 'z' (case not sensitive). you will notice that use of the memory results in the register 'm' being displayed in the expression window. this is because the key memory is actually register 'm'. if you change 'm' in the expression window, you change the memory.

registers are assigned to by the syntax, letter = expression. and recalled by placing the appropriate letter within an expression.

functions not directly available from the keyboard may be accessed in the expression window. build an expression from keyboard, then tap in the expression window, apply the function and press '='. this is a quick way to make use of an obscure function when you know its name. see the help functions library for a list of rare functions.

physical constants available on the help constants menu are designed to work with the expression window. select help constants and you are presented with a scrollable list of physical constants. select one and click "done" to return to calculation. the name of the selected constant is copied to the end of the current expression. notice that the names are prefixed by a "#" (hash) character. this is to differentiate them from ordinary expression variables. if you know the name already (eg #oz) you can write it using graffiti instead. sometimes this is quicker.

to perform unit conversions remember that all the constants are in terms of metric (SI) units. therefore, to convert from miles to fathoms, for example, multiply by #mi and divide by #fth. so 2 miles is 2*#mi/#fth = 1760. remember not to use the keyboard to edit expressions at the same time. 

where there are different unit versions eg uk gallons and us gallons, there are two unit names. in this case, #galUK and #galUS.

currently, the length of the expression is limited to 64 characters. once the maximum is reached, direct calculation will not extend the expression text. 

the abilities and capacity of the expression window will be enhanced in the next version.

scientific functions

scicalc offers a basic set of elementary scientific functions, logs, antilogs, trigs and hyperbolics.

use the 2ND key as a prefix for selection of the trig function and hyperbolic inverses. 2ND TAN performs arctan and so on. HYP is the hyperbolic prefix. use this to select hyperbolic versions of trig functions. HYP TAN is tanh and so on. use the 2ND and HYP together for inverse hyperbolic functions eg 2ND HYP TAN is arctanh.

trig calculations are in radians by default. change to degrees using the mode menu.

here are algebraic names of trigs, hyperbolic and their inverses used in expressions.

trig function inverse trig function hyperbolic trig function inverse hyperbolic
sin asin sinh asinh
cos acos cosh acosh
tan atan tanh atanh

note that trig functions are affected by the deg/rad mode, but hyperbolic functions are not.

because the expression window is amodal, appropriate conversion factors are expressed when trig operations are performed in degree mode. in future versions, formulae can be stored and should not depend on assumed mode settings.

fractions button: "->a/b"

scicalc supports fractions insofar as it tries to convert a floating point value to a rational number of the form a/b where a and b are integers. this is different from the way in which some calculators (eg casio) have a different representation for fractions and once a fraction has been "decimalised" it cannot be turned back again into a fraction.

in scicalc, you just operate on numbers as usual and if you expect the answer to be a fraction, press "->a/b" to convert. for example, calculate 1/3 + 1/7. press the keys as usual to display 0.47619047619047619. Then hit "->a/b" and the expression window will have converted the "1/3+1/7" expression into "10/21". Note that the normal display continues to show the decimal expansion and not the fraction.

You can work with rationalisation as you enter expressions. for example press 0.2 ->a/b + 0.7 ->a/b = to see 0.9, then hit "->a/b" once more to see the result as a fraction, ie "9/10".

scicalc wont convert something to a fraction that obviously isnt one. for example 2 SQRT ->a/b will do nothing, because the square root of 2 is not a/b for any a or b. this point is important because it means that scicalc doesnt try to approximate your answer as a fraction or show you closest fractional approximation, it will only display fractions when it is convinced you have one. sometimes scicalc will notice fraction-like answers like pi/2. eg 1 ARC TAN ->a/b gives 1/4*pi (if in radians).

factorise button: "->a.b"

this button attempts integer factorisation of the current expression. if successful it will replace the expression by its factorisation. eg. 204 "->a/b" shows 2^2*3*17.

of course, the current value is expected to be an integer. scicalc rounds any value to the nearest integer before running its factorisation algorithm. scicalc continues searching until the value is completely factorised, unless it gives up!

scicalc can give up when it knows it is dealing with a composite number but cant find a divisor. in this case it will display the unfactorised part in brackets.

when dealing with integers, you may wish to to tap the screen so that the smaller digits are displayed. in this way, you can see all of a 30 digit integer.


2 ^ 61 - 1 ->a.b, shows, 2305843009213693951. this number is prime.
2 ^ 64 + 1 ->a.b, displays the expression, 274177*67280421310721
2 ^ 67 -1 ->a.b gets, (147573952589676412927). this is because it gave up, but the brackets tell you that its known to be composite.
2 ^ 71 - 1 ->a.b, gives, 228479*(10334355636337793). this shows it found a factor, but couldnt do the remaining composite.
2 ^ 73 - 1 ->a.b gives 439*2298041*9361973132609. completely factored!
2 ^ 97 - 1 ->a.b, gets, 11447*13842607235828485645766393. another good one. (you need to tap the expression window to see the final 3 on the end).
2 ^ 101 - 1 ->a.b, gets (0). unfortunately 2^101-1 is too big to attempt, its more than 30 digits.

functions only available in the expression window

scicalc has additional functions not available from the keyboard. these are accessed via the expression window. you have to type in the function name using the graffiti pad.

function operation
normal(x) probability of normal distribution. probability of a normally distributed random variable <= x which has zero mean and unit variance.

eg normal(1) = 84.13%

erf(x) error function
int(x) integer part of x
frac(x) fractional part of x
abs(x) absolute value of x
mod(x,y) x (mod y). ie the remainder of x divided by y
modtwopi(x) mod(x, 2pi), more accurate than mod and valid to |x| < 1e130
ncr(n, r) the number of combinations of n items taking r at a time. = n!/r!(n-r)!
npr(n,r) the number of permutations of n items taking r at a time = n!/(n-r)!
elf(k,phi) Legendre's elliptic integral of the first kind.
elf(k,phi)=integral(1/sqrt(1-(k*sin(t))^2),t,0,phi). [see abramowitz & stegun ch. 17]
|k| <= 1

example. I have a clock pendulum of 1m. how long will it take to make one swing under gravity when it is released at an angle of 30 degrees.
swing time = 2*sqrt(a/#g)*elf(k,pi/2) where a =1m and k = sin(30/2).
(in degrees) sin(15) and put it in memory with STO.
write elf(m,pi/2) and =, then press *2=
then * menu|help|constants and select 'g' (little g) "done"
then press x^-1 and sqrt = 1.02066923292918416

ele(k,phi) Legendre's elliptic integral of the second kind.
ele(k,phi)=integral(sqrt(1-(k*sin(t))^2),t,0,phi). [see abramowitz & stegun ch. 17]
|k| <= 1

example, how many Km is the orbit of halley's comet?
halleys comet moves in an ellipse with major axis length, a, 17.9400782(au) and eccentricity, e = 0.96727426. the length of an ellipse is given by 4*a*ele(e,pi/2)
type .96727426 STO
write ele(m,pi/2) and =
then press, *4*17.9400782= (this is the distance in astro units)
finally press * menu|help|constants select "au" and hit "done" and press=
hit "E" to scale to engineering and read of 11.5299206077388e12 (in m)
thus the answer is about 11.53 billion km

jd(yyyy.mmdd) find the Julian day number for the given date expressed as a decimal number yyyy.mmdd, further digits are taken as a fraction of a day. eg Jan 1st, 2003 at noon is 2003.01015 and jd(2003.01015) = 2452641.

The Julian day number is the number of calendar days since noon, Jan 1st, 4713BC. There is no year zero. the year before 1AD is 1BC and is entered negative. thus jan 2nd, 1BC is -1.0102 and its jd = 1721058.5.

example, how many days between jan 1st, 2003 and oct 25, 1415 (battle of agincourt). jd(2003)-jd(1415.1025) = 214,457 days.

the gregorian calendar changeover is set at oct 4th, 1582, so that the day after this day is oct 15th, 1582. [note the uk changed in 1752]

date(x) convert a julian day number into a date expressed as yyyy.mmdd. this is the opposite operation to jd.

for example, 15000 days before jan1st, 2003 is date(jd(2003)-15000) = 1961.1207, ie dec 7th, 1961.

factor(x) try to find a non-trivial integer divisor of int(x). ie x regarded as an integer.

return value is x, if x is prime, 1 if x is composite but a factor cant be found or 0 if x is too big to handle. numbers up to 1e30 can be attempted.

gamma(x) gamma function of x, eg gamma(-.5)
fv(i,n,pmt,pv) TVM, future value of payments.
i = rate/100, n = number of payments, pmt = periodic payment, pv = present value.
pmt(i,n,pv,fv) TVM periodic payment.
i = rate/100, n = number of periods, pv = present value, fv = future value.
rate(n,pmt,pv,fv) TVM rate of return for periodic payments.
n = number of periods, pmt = payment, pv = present value, fv = future value.
lnone(x) calculates ln(x+1), but is accurate for small x.

numerical accuracy

floating point number systems are sometimes appallingly bad approximations of reals. in fact the arithmetic laws of association and distribution fail for floats (see knuth Vol2). that means something like (a + b) - c is not necessarily the same answer as a + (b - c) when using floats (of any precision). see example below.

the usual way around this is to simply throw many digits of precision at the problem until any error does not matter. an alternative to multiple digits is multiple numbers, a method first formalised by douglas priest in 1991. in this method, a real number is approximated by the sum of a set of floating point numbers. this method is more powerful because it allows each floating point component to range its own independent exponent as necessary to minimise error.

the general theory uses a set of floating point numbers for each real approximation. scicalc uses a simplified version of this system employing two ieee-754 doubles for each of its numbers, the pair have separately ranging exponents so that it is possible to accurately represent x + epsilon numbers. meaning that a scicalc number can be dense around any real point. this is enough to be useful in practice.

all operations are accurate to double double precision. expect around 30 digits of accuracy on basic and scientific one off operations. numerically unstable operations are in effect in calculation chains involving near cancellation of terms and for these (like the example above) less than 30 digits will be correct. the purpose of scicalcs precision is to get enough correct digits despite unstable cases (i know it would be nice if it could tell you!)

scicalc works internally in binary. see binary calculators.

note to palm users: you dont need to install mathlib for scicalc, it doesnt use it.


currently no state is remembered when scicalc is quit.