PC-CALCULATOR
Aimo Niemi, 1994-2018
INTRODUCTION
Pc-Calculator is a powerful scientific, programmable
calculator with a full-screen formula editor, large
working memory and 30 variables to store constants and/or intermediate results.
Trigonometric, logarithmic and user defined functions
are supported.
The use of the calculator is easy. The working memory
is like a piece of paper, which you can scroll back and
forth and write your formulas just where you wish. You
can also add explanatory comments and, if you
want to execute a formula, you only need to move the
cursor onto that line and press ENTER to see the
result. It is then shown on the corresponding line in
the answer window and, if you execute another formula,
you don't lose the previous one. All the results are
shown and scrolling of the formulas scrolls the results
as well. This means that all possible errors are
easily corrected, if needed, and fast recalculated.
STARTING PCCALC
When you first time start the program, you may want to choose a different font size.
If so, right-click program's title bar, select Properties and then Font.
Note that you can also fine-tune the colours there. If your operation system is
WIN10, then you must also select Options and choose Use legacy console as shown
in the picture below. To avoid scroll bars in the big window mode, select also Layout
and adjust the Window and Screen Buffer Size Widths and Heights to be equal.
The figure above shows PcCalculator in the big window mode. Press F9 to toggle between it and the default mode. To shrink the window, press Alt-N.
Note also, press Alt-S to toggle program's shortcut mode on or off. If it is on,
only function shortcuts are allowed in the formulas. If it is off, then both the shortcuts
and their wider tokens are allowed. In that case, for instance, pressing of the key s
produces a token sin into the editor, although they both mean the same sinus function. If, however, the
mode is on, only s means sinus while sin means s(i(n(..)))
|
FORMULA EDITOR
Most of the time, when you run Pc-Calculator,
you are in the program's formula editor. It is like any
other text editor with its own commands to scroll the
text and move the cursor. The maximum file size the
editor can handle is 30000 lines and each line can be
even 2000 characters long.
Available editing commands are:
Arrows: | Move cursor to the direction of the arrow |
Home: | Move cursor to the beginning of the line |
End: | Move cursor to the end of the line |
Del: | Delete the character shown by the cursor |
Back Space: | Delete the character left of the cursor |
Insert: | Toggle between the insert and overwrite mode |
Ctrl-right arrow: | Move right to the next space |
Ctrl-left arrow: | Move left to the previous space |
PgUp: | Scroll the text one page back |
PgDn: | Scroll the text one page forward |
Ctrl-End : | Go to the end of the text |
Ctrl-Home: | Go to the beginning of the text |
Ctrl-PgUp: | Scroll the text from the current position halfway to the beginning |
Ctrl-PgDn: | Scroll the text from the current position halfway to the end |
Ctrl-a: | Add to the clipboard |
Ctrl-c: | Copy to the clipboard |
Ctrl-v: | Paste clipboard. |
Ctrl-z: | Scroll the text one line forward |
Ctrl-x: | Scroll the text one line back |
Ctrl-s: | Split a long line. |
Alt-b, Alt-z: | Break a line at the cursor position |
Alt-c: | Copy the line shown by the cursor |
Alt-f, Ctrl-f: | Find a string of text or numbers. The string is copied also to the clipboard. |
Ctrl-l: | After find look for the next occurrence. |
Alt-d: | Delete the line shown by the cursor and add its content to the clipboard |
Alt-i: | Insert a new line above the cursor |
Alt-n: | Narrow the edit window. You may find this useful,
if you want to run Pc-Calculator in a smaller window. On the exit this setting is saved. |
Alt-h: | Opens a menu of user notes and more help. |
Alt-r: | Read used defined constants, shortcuts and commands and
open a menu to select one of them. Lines, which are read, must begin
with a character < and they are shown by their comments, if there are any.
See more here, here and here.
|
Alt-s: | Toggle the function shortcut mode on or off. If it is off
then, for instance, sin x = sx = trigonometric sinus of x. If it is on, only shortcuts are allowed and
sin x = s(i(n x)). |
Alt-l: | | (absolute value sign) |
§: | = (Equals sign, no need to press shift) |
½, Alt-m: | Format the result |
F1, Ctrl-h: | Show the help screen |
F2, Ctrl-r: | Change the colour scheme, Recolor |
F3, Ctrl-s: | Select the line shown by the cursor.
The line is then highlighted and can be moved with the arrow
up or arrow down keys. |
F4, Alt-w: | ƒ (function symbol for find zeropoints = ASCII 159) |
F5: | £ (line reference prefix = pound sign) |
F6: | @ (temporary memory sign) |
F7: | * (the multiplication sign) |
F8: | ^ (rise to the power sign) |
F9, Ctrl-n: | Show variables, which are not zeros. |
F10, Ctrl-q: | Exit Basic Calculator, Quite |
TAB: | Adds "a calculate total sign" to the beginning of
the line and executes it. The value of the line
is then added to memory f. |
|
FORMULA INTERPRETER
Each time the ENTER-key is pressed, the line shown by
the cursor is executed and its value is put to the answer window and stored in the temporary memory @.
The line is interpreted from left to right and standard arithmetic calculation
rules are obeyed. If not otherwise shown with the
parentheses, functions are calculated first, then powers (^),
multiplications (*) or divisions (/) and
last additions (+) or subtractions (-).
The use of the multiplication sign is voluntary. So, for instance,
xy=x*y and
c30^2(1+3) = c30*c30*4 = 3, (c=cos).
Note above, the use of the shortcut c for cos (cosine). If the shortcut mode is off
(meaning not only shortcuts are allowed) then the above expression is equivalent to
cos(30)*cos(30)*(1+3).
Pressing of Alt-s toggles between the two modes.
Except numbers and operators formulas can contain variable names,
named constants and references to other memory lines
too. Capital letters A-Z, @ and small letters f,x,y and z and some foreign characters
are available variable names. Variables are actually named memory places,
where values are stored or recalled by using the name.
To set a value to a variable or to store it in the memory an equal '=' or greater than '>' signs
are used. For instance, line
A=100 B=456>x + 2A
sets 100 to A, stores 456 to x and sets 656 to B.
Except the variable memory, values can be
stored to the memory lines, too. If n is a line number, then the line function £ and the command
(expression)>£(n;c)
stores the value of the expression to the cell c, in the line n. Note that n and c may here be
also variables or results of some calculations. Comment marks ' are used to divide a line into cells. If cells
are not defined, store to the line command creates them. If, however, c=0 and insert is on, then the value of the expression
is only added to the beginning of the line. If the insert is off, then the value is stored onto the line n.
An opposite command, read from the line n cell c, is
m(n;c).
Values can also be stored into the temporary memory @, if a semicolon (;) precedes the value. This is the way,
how parameter values are transmitted to the user defined functions. For instance, expression
z=u(x;y)
stores x to f and y to @, executes then line 2 and sets the result to z.
Table of the keystrokes and functions recognized by the
formula interpreter
key | meaning | examples |
{[( )]} | opening and closing parentheses | 2{3[4(5*6+7)+8]+9} = 954 |
a | trigonometric arc function | as1=arcsin(1) = 90 |
| | absolute value | |2=|(-2) = 2 |
c | cosine | c60=c(--60) = 0.5 |
e | exp = e to power x | e1=e(2-1) = 2.718282 |
g | convert sexagesimal to decimal | g11 22 33.0 = 11.3758333 |
h | convert hexadecimal to decimal | hff = 255 |
o | convert octal to decimal | o101 = 65 |
b | convert binary to decimal | b101+b10.1 = 7.5 |
i | integer | i3.6 = 3, i(-4.1) = -5 |
l | logarithm | l100 = 2 |
n | ln = natural logarithm | ne1 = 1, n2 = 0.693147 |
! | factorial | 5!=120, 0.5!= 0.88622692545 |
p | pi = 3.141592653589793 | 2pp = 19.7392088, qp/2=0.88622692545 |
q | square root | q2 = 1.414213562, qp= 1.77245385091 |
k | cube root | k8 = 2 |
r | reset f,x,y,z and clipboard | 0>f>x>y>z |
r* | reset all variables except foreign | 0>x>X>A>B ... but ä, Ä, å, ë ... prevails |
rd | random number | 0 < rd < 1 |
s | sinus | s210 = -0.5 |
t | tangent | t45 = 1 |
^ | rise to power | xy^2 = xyy, 2^0.5 = q2, sin x ^2 = (sin x)^2 |
\ | mean value | 1+2+3+4\ = 2.5 |
== | logical operator "equal to" | (x==x) = -1, (1==2) = 0 |
< | logical operator "less than", in the first column = shortcut prefix | (1 <2) = -1, (2 <1) = 0 |
m | matrix reference prefix | m(n,c) meaning:
recall the value of the cell c on the line n. If n is negative, the inverse of
a square matrix [cxc] starting from the line |n| is calculated.
|
£ | line reference prefix | £135, £x, £(5+2x) |
# | Return the current line number or the line number of a quoted line.
| £(#+1)£(#+2) meaning: Execute the following two lines.
If name is a valid line name, then "name and £("name#) are behaving alike.
|
", $ | named line reference prefixes |
If a line has got a name, it can be executed by putting a quote (") or a dollar ($) before its name. |
= | set a value to a variable | x = 3.14, A = 2x+1 |
> | store to | 600>x>£x>£(22+x) |
u | store to f and insert line 2 | ux = £(2+x>f0) meaning:
put f=x and insert the value of the line 2. |
w | store to f and insert line 3 | wx = £(3+x>f0) |
j | store to f and insert line 4 | jx = £(4+x>f0) |
d | store to f and insert line 5 | dx = £(5+x>f0) |
; | store to temporal memory @. This is used in the function calls to give values to a parameter. |
9;2-@ = 7 or u(5;3) meaning:
put f=5, @=3 and insert the value of the line 2. |
? | Print the result of the formula
to the end of the line. |
?g | Print a desimal number in
the sexagesimal form | 11.3758333 ?g= 11 22 33.0 |
?h | Print decimal in hexadesimal | 255 ?h = FF |
?o | Print decimal in octal | 255 ?o =377 |
?b | Print decimal in binary | 25.5 ?b =11001.1 |
@ | Temporary memory sign, used to transmit parameter values to functions.
Also, after a line is executed line's value is set to @. |
' | Comment follows or a cell definition precedes. |
: | Comment or a line name follows. In the beginning
of the first line the working memory
is not saved on the exit with F10. |
TAB | Executes a line and adds its value to the f. |
&o(p;q;r) | Calculates with big numbers given on the lines p and q. Uses operator o and stores the result onto the line r. |
Alt-t, Ctrl-t | Toggle timer/stopwatch mode on or off.
Stopwatch mode is assumed, if T=0. If T>0, then T is assumed to equal a preset alarm time
expressed in decimal hours and, when the alarm time is passed, an audible signal is given and the batch file
"pccalarm.bat" is started, if there is any. In both modes a stopwatch reading is printed,
if the ENTER key is pressed. If you need to calculate in these modes, use ctr-m to invoke the result. |
Note that usually the function definition precedes
its argument. The only exceptions are: \ > ! ^ and ?
Notice also, an audible warning signal is given,
if the interpreter finds an error, like q(-1) or q(1,
for instance.
|
NAMED LINES AND CONSTANTS
Named constants are actually named
memory lines, where the constants are stored. Names are case sensitive and the
syntax for a name is a colon (:) and a user defined name. In the name spaces and
operators +-*/ and ^ are not allowed, small and capital letters,
numbers and point (.) and underscore (_) are. See the examples below. There the names
are Planck and Light_speed. The fourth line is an example,
how a constant can be used in a formula. There the "Avogadro number" is only an ordinary comment, which, however,
is shown in the "read menu", if Alt-r is pressed.
<6.0225*10^23 'Avogadro number
6.626068*10^-34 :Planck's constant m^2*kg/s
<299792.458 :Light_speed km/s
2q"Light - 100 = 995.06613
|
Names are used together with the quote function " (or $) and they can be shortened as far as
the name remains unique. If two or more lines have the same name, the first one is only
valid. If you are using many constants, it is a good practice to put 'a less than' character (<)
to the first column of the line. You can then use Alt-r command to see all the definitions if
you later want to check, what there is available.
Note! Names are not normally recognized if there are comment marks before the name.
However, comment marks are used to divide a line into cells. If you want to name this kind
of a line, add a comment mark also immediately before the name definition, for instance ':your.name.
|
QUOTE FUNCTION (" or $)
Quote function is used to execute a named (or a quoted) line. The line's value is then put to the
quote mark (") in the current formula. If the name is followed by a colon (:), the
editor shows the line, where the quoted name is. If the name is followed by the character #,
the line number of the quoted line is returned. If again the name is followed by a semicolon, then
the following expression, usually a number or a variable, is stored in the temporary memory @ before
the quoted line is executed. The syntax for the latter is:
"user_defined_name;(expression))
Note the closing parenthesis if it is missing, the line number of the quoted line is returned. If you
want to create your own functions, this is the way, how parameter values are transmitted to them.
LINE FUNCTION (£)
Function £ performs much the same way as the quote function above, but it is much faster.
Instead of the name £ uses a line number to show, which line is to be executed.
Also, the parameter passing method is the same. So
£("user_defined_name#;(expression))
is equivalent to the quote function's syntax above. The main use of the
line function is to execute a block of lines. They can be executed either one by one or
a loop may be created, which will execute them. These methods are discussed in a more detailed way
in the chapter "Advanced programming".
USER DEFINED FUNCTIONS
In the Pc Calculator memory lines 2-11 are reserved for the user-defined two parameter functions.
They can have any names you choose, but the first four have also the default names u, w, j and d.
So, for instance if line 2 has a name Line2, then the previous example z=u(x;y) is equivalent to
z="Line2(x;y)
This expression, too, sets f=x and @=y, executes line 2 and stores the result to z.
If not needed, one or both parameters may be omitted in which the parentheses are unnecessary. However,
between the name and a parameter must be either a space or a quote to tell the program, where the name
ends and where the parameter starts. For instance, the following expressions are valid:
z="Line2 x, z="Line2"x or z="Line2(x)
but, however, the use of the last one is recommended.
Even more parameters can be transmitted if you combine two of these functions. See the example below.
B=@ C=f :Line5 d(f;@)
A=f D=@ @=.. :Line6 here @=.. is your function using parameters A,B,C and D
...
$Line6(1;2;d3;4)'sets A=1 B=2 C=3 D=4 and returns the value of your function
|
|
TABLE MANIPULATION
Although PcCalculator is not a real spreadsheet program,
it can, however, manipulate and calculate tables almost as well as
a real spreadsheet can. You must, however, create all
the cells and columns manually and the accuracy of the
cell is only that, what you see. There are no hidden decimals.
PcCalculator's table oriented commands are:
x=m(line_number;cell_number) = set a cell value to x
x>£ (line_number;cell_number) = store x to a cell
"execute(line_number_L ; N_times) = user defined program,
executes the line number_L N times.
The example below shows one way, how the above mentioned execute a line command may be defined.
It is then used to create a simple trigonometric table, where the arguments are
given in the column 1.
å=f ü=@ @="ÿexec :execute(line f; @ times) 'on line 6,..11
ü=ü-1 @=£å+£(#-(ü<1)) :ÿexec 'line 12 ...
q-1 = 'give the end sound
' sin ' cos ' sin²+cos² :tble_header
0' 0.0000000' 1.0000000' 1.0000000
10' 0.1736482' 0.9848078' 1.0000001
20' 0.3420201' 0.9396926' 0.9999999
30' 0.5000000' 0.8660254' 1.0000000
40' 0.6427876' 0.7660444' 0.9999999
50' 0.7660444' 0.6427876' 0.9999999
60' 0.8660254' 0.5000000' 1.0000000
70' 0.9396926' 0.3420201' 0.9999999
#-1:end_tbl
K="tble_header# N="end_tbl-K
"execute(#+1;N)
K=K+1 @=sm(K;1)>£(K;2) + cm(K;1)>£(K;3) + £(#+1)
(m(K;2)^2+m(K;3)^2)>£(K;4)
|
|
FINDING ZEROPOINTS
Suppose some of the memory lines is a function of the variable x.
Line's zero point or points can then be found by executing
ƒ(n;r) where ƒ is the ASCII character 159,
n is the line's line number and r the
range of the search area centered around
the current value of x.
If a zero point is found, a new search can be done, at which
the next search is from x to x+r and again from x-r to x if not succeeded.
If r is given, a complete search is performed, even
if the program finds errors in the calculations. Most
commonly this occurs, when a square root is taken from
a negative value. If r is not given, it has a default
value 10000 and the imaginary areas of the search are
jumped over. See the example below.
(x+3)(5xx-8)(2qx-7) :my_func1
It clearly has a root x=-3 but it can't be found if we seek
ƒ"my_func1#.
If, instead, we seek ƒ("my_func1#;500), the root is easily found.
If again we want to find, for instance, when the line my_func1 gets a value 10,
we can create a new line
"my_func1 - 10 :my_func2
and seek for its zero points.
|
LONG NUMBERS
If the accuracy of the program is not enough, basic
calculations with the long numbers can still be made.
Write the numbers to the adjacent lines, put the
operator before the lower number and press Ctrl+Enter.
The result is then inserted into the next line. For
instance, write
123456789123456789.000 000 000
/987654321 'and press CTRL+ENTER here to get
=124 999 998.985 937 498
'or calculate with the whole numbers to get the remainder if any
123456789123456789
/987654321
=124999998 :973765431
|
or
q2.000 000 000 000 000 000 000' press CTRL+ENTER here
=1.414 213 562 373 095 048 8016
|
With the same technics functions q, k, s, c, t, as,
ac, at, n, e, !, p(=pi ) and f (=factor) can be calculated, too.
For instance:
f1234567890121 'press CTRL+ENTER here ..
f33366699733*37*1 'and here again ..
f174694763*191*37*1
f32309*5407*191*37*1
32309*5407*191*37*1 'No more factors
|
Function &o(p;q;r)
is more flexible, if you will make many long number operations in a flow. In it operator o can be any of the above operators, parameters p and q are line numbers, where the actual numbers are and r is the line number, where the result is stored.
However, if q<=100 instead of being a line number, it is assumed as an operand.
With one parameter operators, the operand is line q at which the parameter p is not used. However, if p<=11, then line q or q is copied to the line r.
See the example below. In it line start sets the starting values, the result is calculated
onto the line !Euler and the line addon defines the accuracy of the result.
'Euler constant
E = 1 + 1/1! + 1/2! + 1/3! + 1/4! + 1/5! + 1/6! + 1/7! +...
R="!E# A=R+1 N="!N# &*(1;1;R) &*(1;0;N) :start
1 :!Euler
1.0000000000000000000000000000000000000000000000000000000 :addon
0 :!N
&+(N;1;N) &/(A;N;A) &+(A;R;R)
"start "execute(#-1;70)
|
The internal accuracy of the constants pi and e in the long number mode is 2000 digits.
You can calculate even with longer numbers, but their trigonometric and logarithmic functions
are not accurate over 2000 digit. In addition, you can save even longer memory lines, but when you
start PcCalculator, longer than 2000 character lines are truncated.
Making cyphers
Related to long numbers is the function ü (ASCII character 129). If it starts a line and
Ctrl+Enter is pressed, then the rest of the line is transformed to a modified two digit ASCII-code.
You can then mathematically manipulate it as you will and create your own cyphers, for instance. You can
multiply or divide it with your password number, take square roots, add decimal points, calculate
trigonometric or logarithmic functions, and so on.
To interpret the code, manipulate it backwards, add üü to its beginning
and press Ctrl+Enter again. Note that ü is here also an ordinary variable.
It acts as a function only if it is situated at the beginning of a line and Ctrl+Enter is pressed.
See the example below.
ü press Ctrl+Enter to cypher a message
32121401151532671614084369101601143216113299211204011432973209011515970301
' manipulate the code mathematically, as you will
...
' manipulate backwards to interpret and press Ctrl+Enter
üü32121401151532671614084369101601143216113299211204011432973209011515970301
press Ctrl+Enter to cypher a message
|
|
USING CELLS
Occasionally you may need to handle more variables than there
are available names. You can then use vectors or
matrixes to store your data and use the recall a cell or store to cell
commands to manipulate it.
Comment marks ' are used to divide a line into the cells and cells are counted
from left to right starting from the number 1.
Syntaxes for the recall and store to commands are
x=m(n;c) and x>£(n,c),
where n is the actual line number and c the number of the cell.
If c is greater than the actual number of cells on the line, then the recall command returns 0
while the store to command creates the missing cells.
Finally, if n is negative in the recall command, then the inverse of
a square matrix [cxc], starting from the line |n|, cell 1, is calculated.
Both n and c can also be expressions or variables and symbolic memory addressing
can be used to give values for n. See the example below.
With symbolic memory addressing cell [F = -3.406], for instance, can there be
referenced in either matrix or vector form as
[F = - 3.406] = m("matrixA+1;3) = m("RowB#;3)
#+1:matrixA
A=0,2491' B=0,1577' C=-4,319 ':RowA
D=0,1965' E=0,1244' F=-3,406 ':RowB
0 ' 0 ' 1 ':RowC
'to get the inverse of the matrixA execute m(-"RowA#;3) or
m(-"matrixA;3)' to get
-12440000.' 15770000.'-15740.000':invArX
19650000.'-24910000.' 24890.000':invArY
-0.0000000' 0.0000000' 1.0000000'
'Notice, if we set x=m("invArX;3) y=m("invArY;3)
' then Ax+By+C=0
' and Dx+Ey+F=0
|
The example above shows, how linear equations can be solved.
You only need to write down the matrix of their coefficient,
add the bottom line [0' 0'...0' 1'] and
the solution is then the upper part of the
rightmost column of the inverse of this matrix.
|
OPENING A NEW TASK
If you use PcCalculator for different tasks, you can open a new task also
from the inside of the program. Write <./ to the beginning of some line and the
name of the file you want to open. Add a comment and the name of the task.
See the example below.
<./newfile.fml 'Open New Task
|
If you now want to exit from your current task and choose
a new one, press Alt-r and make your choose. The old formula collection is then saved
and the new task is opened or created, if it doesn't already exist.
STARTING OTHER PROGRAMS
When you use PcCalculator you may want from time to time to remove old garbage from its memory.
You can then invoke an external editor to do the job. Write <.. to the beginning of
some line, add the name and path of the editor and the name of the file
you want to edit. Add the comment mark ' and a comment and press Alt-r to execute your wish.
See the examples below.
<..notepad.exe pcalc.fml 'Edit default task file with the windows' notepad
<..pcalc.fml
'Edit with an editor assosiated to the file extension fml
<..pccmanual.bat 'Read the manual
<..url
'Open a web page,
e.g. try
this
<..pccalarm.bat 'Alarm
|
The batch files of the above example are delivered together with the PcCalculator.
You are free to tailor them to suit your wishes. Below is a list of their default contents. Depending on
your tasks, you may find it useful to bookmark other net pages, too, in order to consult them
later, if needed.
pccmanual.bat: start ./pccmanual.html formulas.bat: start www.stclarescomprehensive.ie/PDF/Formulae
%%20"&"%%20Tables.pdf
pccalarm.bat: start ./wake-up.gif
|
Note above the red characters. They are needed in the batch file to make the URL address
compatible with the HTML. From version 4.21 onward URLs, HTML and picture files can be invoked also
directly from the program. You need only add <.. before the file name or the URL and end it
with your comment. The comments are then shown in the alt-r menu, where you can pick them for a choice
and, if you so choose, you can invoke the aktion also directly by moving the cursor onto that line and pressing Ctrl+ENTER.
|
STOPWATCH ALARM-WATCH MODES
Press Ctrl-t or Alt-t to toggle timer/stopwatch mode on or off.
If then T=0, stopwatch mode is assumed and the clock is started, when the space bar
is a next time pressed. To read the watch, press ENTER. To stop it, press Alt-t again.
To start a timer or alarm clock mode save first the alarm time in decimal hours to the memory T.
Use function g, if needed (e.g. T=g154500) and press Alt-t. The countdown
begins immediately and the current time and remaining seconds are shown in the
program's title bar. When then the alarm time is passed, an alarm signal is sounded
and the batch file "pccalarm.bat" is started, if there is any.
In this mode, too,
a clock reading is printed, counted from the start, if ENTER is pressed.
If you need to calculate in these modes, use Ctrl-m to invoke the result.
Even better, however, is to start a new session of the program and select a different task.
So you can be sure you don't lose your newer notes, when you later close the alarm clock session.
DEFINING KEYSTROKES
During the years while PcCalculator has existed, the computer keyboards have changed a lot.
Many common keys, which older keyboards had, are now missing in the newer ones.
Therefore, many PcCalculator commands have alternate keystrokes to activate them. See the table
above.
On many keyboards also the equal sign (=) is difficulty attainable. Therefore, in the PcCalculator
you can invoke it by pressing § (Chr(61)) or Shift+Space bar, too.
You can also press Ctrl-e to give ASCII codes and store the character to the current cursor position.
If you press Ctrl and any of the keys G, K, P, W or Y, you can also assign any ASCII character to these keys and
invoke them by pressing Alt and the key in the question. See the table below. In the table the
default values of the keys are also shown but you can change them as you will. Instead, the foreign
character definitions are fixed. They cannot be changed.
Keystroke definitions: Defaults: Press: to get ASCII:
Ctr-G = Define Alt-G Chr(144) = É [=@] Ctrl-o chr(134) = å
Ctr-K = Define Alt-K Chr(60) = < Alt-e chr(137) = ë
Ctr-P = Define Alt-P Chr(62) = > Alt-a chr(132) = ä
Ctr-W = Define Alt-W Chr(159) = ƒ Alt-o chr(148) = ö
Ctr-Y = Define Alt-Y Chr(152) = ÿ Alt-u chr(129) = ü
Foreign characters behave like any other variable in the program. You can set values
to them and use them in the formulas like the others. However, they are not reset, if r or r*
is pressed. You may find this useful, if you want to store some permanently active values to the memory.
|
ADVANCED PROGRAMMING
Although the aim of the Pc-Calculator is not to
compete with other high level programming languages,
it is in principle, however, capable to solve
rather complicated problems too.
To execute a block of lines there are no specific means in the Pc-Calculator.
Instead, the line reference method can be used, but then there must be a reference
to every line we want to execute or we can also create a function, which does the job.
See the examples below. On the other hand, this is very seldomly
needed because the line can be even 2000 characters long and we can write
all the commands onto the same line.
Program branching is made with the
logical operators < and ==.
Suppose we want to perform: ' if A=5 then execute line AA else execute line BB. '
With line function £ this is done as
£{ -[A==5]$AA# + (1+[A==5] )$BB# }
The same technique can be used even if our task is more complicated, say
' If A=5 then AA else if A=6 then BB else CC. '
Then we calculate the address of £ as
£{ -[A==5]$AA# - [A==6]$BB# + (1+[A==5]+[A=6] )$CC# }
Program loops use the same technique. First, we set a loop index, say z,
to a desired value. Then we execute a line, which advances or recedes z, executes our task and tests,
if the loop index still differs from the end value. If it does, the line is executed again. Otherwise
the loop ends. Depending on the task, it may use z, too, and/or set its value so that the loop ends.
z=@ f=z @=£(#+1) :factorial
z=z-1 @="your.task @=£(#-z==1) 'loop
f ' value of this line is returned, when the loop ends
....
f=zf :your.task
$factorial;9) 'calculate 9!(=362880)
|
The example defines the factorial function n! (=1*2*...*(n-1)*n ),
which takes its parameter n from the temporal memory @. The loop starts
from the next line and ends, when z has become =1.
Note, however, the factorial function is one of the Pc-Calculator's standard functions.
So there is no need to redefine it by the user.
Note also, when you experiment with
loops, you may easily create a never ending loop.
This is the case, for instance, if we on the third line of the above example change f to £(#-2).
If this happens, or, if your loop is too slow, press F10
to get rid of the loop. However, this works only, if your loop runs at least on two lines.
If it doesn't, like y=£#, then nothing helps and you must end the whole
session from the title bar. So be careful and take always safety copies before testing.
|
EXAMPLES
Following examples show some ways to create and use loops
within the Pc-Calculator.
':EXAMPLES BEGIN (line 1)
'Reserved for user function u(f;@) (line 2)
'Reserved for user function w(f;@) (line 3)
Y=f D=C M=B @="julian.day 'j(f;@) (line 4) used as j(Y;M;dD)
B=@ C=f 'd(f;@) (line 5) param. passing help function
A=f D=@ @=$triangle.area :tri.a '(line 6) used as $tri.a(A;B;dC)
'Reserved for user functions (line 7)
'Reserved for user functions (line 8)
'Reserved for user functions (line 9)
'Reserved for user functions (line 10)
å=@ ä=f+å @=£(#+1):execute_lines(start;length) '(line 11)
å=å-1 @=£(ä-å) @=£(#-å<1) '(line 12)
'Note above, the use of the foreign characters å and ä.
'They can be changed to any available variable name,
'which are not used in the loop.
'
'HYPERBOLIC FUNCTIONS
(e@-e(-@))/2 :sinh(@)
(e@+e(-@))/2 :cosh(@)
(e@-e(-@))/(e@+e(-@)) :tanh(@)
(e@+e(-@))/(e@-e(-@)) :coth(@)
n(@+q(@@+1)) :arsinh(@)
n((1+@)/(1-@))/2 :artanh(@)
'Example
"(sinh;1,4)^2 - "cosh;1.4)^2 ?d'= -1
'DATE OF THE EASTER SUNDAY y=year, x=month, f=day
'User defined function "execute_lines(start;length)
'executes here the following 11 lines.
y=@ @="execute_lines(#;11) :easter_sunday;year)
(y-100(i(y/100)>D))>A'
(A-4i(A/4))>B
(y-19i(y/19))>C
i(D/4)>E
i((D-15)/25)>F
i((D-F)/3)>G
((19C+D+15-E-G)>K-30i(K/30))>K
((18+2D-E+2B+4A-K)>L-7i(L/7))>L
(((K+L)>J+7(34<J))>J+22+7(J==34)(K==28)(10<C))>J
(3-(31<J)-(61<J))>x
(J+31(31<J)+30(61<J))>f
'Example
"easter;2009
' Random.number.Pi
' This example calculates the value of the pi using
' random numbers to simulate the well known match
' dropping method. See the picture.
' It also demonstrates the use of two nested loops.
' When the inner loop is completed, an intermediate
' value of pi is calculated and after that, the outer
' loop starts the process again. This way we can
' follow the progress, as the screen is automatically
' refreshed after every 2000 loops.
f=360 z=0 T=1000 V=#+3 @=£(#+1) :rd.n.pi
z=z+1 W=2000 y=2(A+B)/A x=y-p @=£(#+1) @=£(#-z==T)
@=£V @=£(V+1<W)
W=W-1 C=rd+s(rdf) A=A-(C<0)-(1<C) B=B+(C<1)(0<C)
r* 'Example
"rd.n.pi 'Start the counting, press F1 to get rid of it.
' TRIANGLE AREA
' If A, B and C are the side lengths of a triangle,
' then its area is
q[(A+B+C)(-A+B+C)(A-B+C)(A+B-C)]/4 :triangle.area
'Example
"tri.a(3;4;d5) '= 6
' JULIAN DAY is a measure of the time in many astronomical
' calculations. It is a running number of days
' starting at noon on the Julian calendar date
' January 1. 4713 BC.
' In this example, however, only Gregorian calendar
' is used. Set Y=year, M=month and D=day.
1721058 + £(#+1) :julian.day
Y365+D+31i(.56M)+30i(.44M)+2i(3/(M+.9))+£(#+1)
i((Y-i(3/(M+.9)))/4)-i(.75*i((Y-i(3/(M+.9)))/100+1))
'The routine above is valid at noon GMT.
'If needed, add decimals accordingly.
'Julian day mod 7 is also an easy way to calculate the day of the week.
'Examples
"(easter;2016)
J=j(y;x;df)
J-i(J/7)7 '=6=Sunday, 0=Monday, 1=Tuesday, ..
|
A Worked Example of calculator's advanced properties is also
available at
On a ray tracing method to calculate atmospheric refraction
|
USING THE CLIPBOARD
If Ctrl-V is pressed the content of the windows clipboard is pasted
to the current cursor position. If there are multiple lines and insert is on,
new lines are inserted between the old ones. If the insert is off, the
content is added inside the old lines.
If Ctrl-C is pressed, the result of the cursor line is copied to the clipboard.
If no result is visible, if the line is commented, for instance, then the line is copied.
If again the line is selected with F3, both the line and its result are copied.
Finally, Ctrl-A behaves like the copy above, but now the new content is added to the clipboard.
This way multiple lines can be added and transferred to other applications.
On the other hand, this property is very rarely needed because usually only it is the result
that is.
USING THE MOUSE
PcCalculator has no specific mouse buttons, but following mouse gestures are available:
Left-click mouse on the working area - Move cursor to the mouse pointer.
Left-click below the working area - Copy character to the cursor position.
Left-click on the left border - Break a line from the cursor position.
Right-click on the left border - Delete character left of the cursor.
Right-click on the result window - Execute cursor line.
Right-click on the working area - Scroll up one line.
Right-click and hold down on the working area - Scroll up.
Left-click and hold down on the working area - Scroll down.
Note that there are no block oriented gestures. If you really need them, click programs title bar and
use Windows' own, copy and paste or use your favorite text editor to do the job.
|
Copyright
Pc-Calculator is released as freeware though
on exit it asks you to make a donation to UNICEF.
If you find this annoying, put ': to the beginning
of its formula memory and become an honorable user
by making your donation as asked.
|
Miscellaneous
- The default working file of the PcCalculator is Pcalc.fml.
If you like, you can edit it with your favorite text editor. You can invoke the editor also directly
from the inside of the program.
-
With an external text editor you can edit also the first two lines of the working file, which are not otherwise shown.These lines contain the information in what state the program was previously closed. At the end of the first line there is the default value x=90043 meaning: In the big window mode Windows' Screen Buffer Size Width=90 and Height=43. If you want to use even bigger window size, you can edit this value as you wish.
-
If you use PcCalculator for different tasks, you can choose and open a new task file from the programs task menu. You can also open there your task related websites or images if needed. Note that you can name the task files as you like. Choose the file extensions accordingly, if you want to edit them also with your favorite text editor.
-
To avoid unnecessary garbage, you can exit PcCalc also without saving.
Put then a colon (:) to the start of line 1 and move the cursor to an empty page.
If you now open a new task, the current settings are saved and next time you start
PcCalc, it offers you always the same empty page.
-
If you press F2 or Ctrl-r (Recolor) program's colour scheme is changed.
Some of them may look awful, but as explained in the start,
you can fine-tune them as you wish.
- In the long number mode, the number of the decimals in the answer depends on the number
of the decimals of the operands. If whole numbers are divided, then no decimals are calculated,
instead, the remainder of the division is given.
- In the long number mode, you can easily get results, which are even longer than the nominal line
length 2000 characters. Pressing Ctrl-S splits long lines into a more easily readable form.
- To make long numbers more readable, spaces can be inserted to any place in the number.
The decimal point again can be either dot or comma. If both or many points are used,
the first one only matters, the others are omitted.
- The length of the program is about 200 Kb while the size of its screenshot image
is about 100-400 KB if packed in JPG format. The author is
proud being able to announce that.
-
Load Pc-Calculator
Pc-Calculator Home
Back to Contents |
|