
It can be used as a simple calculator, or one to compute complicated routines.
We hope you find FormulaCalc useful.
For a quick start read Installation and Quick Start.
Then after trying it out please return to this documentation to learn all of the features.
Documentation Sections:
Use your Pilot installer to install frmclc11.prc. If you are upgrading FormulaCalc Version 1.0
(frmclc10.prc) you must first delete FormulaCalc V1.0 or risk requiring a Palm OS reset.
FormulaCalc requires MathLib.prc*. If you have MathLib.prc already installed (because
some other application uses it) just install frmclc11.prc. Otherwise install both frmclc11.prc and
MathLib.prc.
The included MathLib.prc is the latest version (V1.1 dated 4/14/1999). You may update with this one if you desire.
Quick Start
When you first use FormulaCalc you will be greeted with a display as shown on the right.
The display consists of 3 areas:
If you want to use FormulaCalc as a simple calculator:
For this first trial tap the diamond to the right side of the input area. This icon action
is "highlight all text in the input store". Tap it again. That cut it to the clipboard, and
accomplished our immediate goal of clearing the input area. Now with the pen and enter:
3*4-7/3 then press Compute.
The value
9.67 will appear in the output box. An "ordinary" calculator would have
displayed 1.666... because it would use a left to right calculation rather than computing
3*4 then 7/3 and then subtracting as we understand algebraic formulas.
Now on the second input line enter: a=2; sr(a); a^2 then press
Compute. The output box now displays 4 lines: 9.67 2.00 1.41
4.00
Press the Compute and Clear buttons several times to see what happens.
Next press the Reg button. You will see that the A register
now has 2.00 and R has 4.00. That is because you stored 2 in A,
and R is the result register which contains the last
computed value 4.00.
Using the pen select register G, enter
20 and press Set Value. Now G contains 20. Press Done. On the third input line enter G
to the end of your routine. Your routine should now read:
You are now an expert!
To prove that see if you understand the example on the right.
| arithmetic: | + - * / ^ %; |
| functions: | sr() sq() ln() log() int() pi |
| trig: | sin() cos() tan() asin() acos() atan() |
| assignment: | = += -= *= /= |
| decision: | < <= = = >= > |
| grouping: | ( ) |
| control: | ; if(,,) deg rad dd: sr: |
| comment: | " " [ ] |
The first three commands refer to routines stored in a Memo Pad entry. Your
routines are stored in the Memo Pad under the name "Formula Calculator".
( See Storing Routines.)
This menu selects:
The 'Show Exponent' value determines when the notation is switched between fixed to scientific
notation. The Trim check box determines if trailing 0's in scientific notation are displayed.
For the preferences shown the above screen, the notation will switch from fixed notation to
scientific notation when the number would be displayed with an e5.
For example:
The actions of the Edit Menu work only with the Pen Store.
Create a Memo Pad entry entitled: Formula Calculator (the first line and column 1 of the entry -- be sure there are no leading spaces). It can be in an category. FormulaCalc will find it.
Each routine starts with a # sign in column 1 followed by the name e.g. #Compound
Interest.
A routine is of the form: formula followed by ; (and/or new line) followed by
formula .....
The routine is terminated by one or more blank lines.
All space characters within a formula are ignored.
Following is an example memo with two routines:
Formula Calculator
#Compound Interest
[Reg: I interest, P principle]
[N years, M periods per year]
dd:2
(1+i/m)^(m*n)*p
#Future Annuity
dd:2; ((1+i/m)^(m*n)-1)/(i/m)*p
This starts with the required title: Formula Calculator (actually only "Formula" is needed).
The second routine in the memo is Future Annunity.
As many routines as desired may be in the memo. Each must start with a #.
Operators and Functions
This explains each of the operators and function.
The operators:
Operator Calculation Order
This section discusses the order in which operators are used for a calculation when not
controlled by parenthesis.
The computation is done in a left to right order for the operators and functions of a given
group as listed next listed next. This means that operators in a given group are computed
in turn left to right and then the results of each group computation combined as specified
by the order. Parenthesis modify the order forcing computation to be completed within the
'( )' before combining with other values. See the example which follow the table.
Group computation order:
| First: | sr() sq() ln() log() int() pi sin() cos() tan() asin() acos() atan() if(,,) deg rad < <= = = >= > |
| Second: | * / ^   %; |
| Third: | + - |
| Last: | = += -= *= /= |
| Not Combined: | dd: sr: " " [ ] |
Example:
a = 10; deg Left to right
b = 2 * 3 + 5 * sin(a + 30) ^ 2 - 9 * (5 + 7)
| | | | \ / | | \ /
| | | | 40 / | 12 Compute inside ()'s 1st
| | | \ / / | |
| | | 0.64 / | | Then things in First
\ / \ / / \ /
6 3.21 / 108 Then Second (leftmost)
\ \ / /
\ 10.33 / And Second Again
\ / /
16.33 / Then Third (leftmost)
\ /
-91.67 And Third Again
Finally the assignment
Example 1:
This example shows the use of arithmetic assignments to registers, and iteration.
#Powers of 2
sr:y
u += 1; v *= 2
This routine sets the output display to show register assignments. Then 1 is added to the current value
of u and re-stored in u, and the current
value of v is multiplied by 2 and re-stored in v.Example 2:
This example shows the use of the int() function (i.e. whole number extraction).
Julian Date was defined by astronomers to have a uniform date code independent of the calendar. It makes
taking the difference between 2 dates easy. (See note below.)
#Julian Date
sr:n; dd:2; se:10
i=int(z/100); i=2-i+int(i/4)
int(365.25*z)+int(30.6001*(x+1))+y+1720994.5+i
Assume that register x (month) is 10, y (day) is 15, z (year)
is 1999 (October 15, 1999).
Note: A Julian Date is defined to start at noon and show the fraction of a day. So to be accurate
the day in y should be a day and a fraction. If y was 15.5 then noon on October 15, 1999 is the start of Julian Day 2451467.00
This routine is only accurate for the Gregorian calendar. A modification of this routine must be made
for dates before October 15, 1582.
Example 3:
This example is really too complicated but it shows the use of the if(,,) function, and it
shows how to encode 3 numbers into 1. It produces the calendar date for an Julian
date, and show the fraction of a day to two decimal places.
#Julian Calendar Program Comments
dd:6; se:10; sr:n 2 decimal digits, no scientific notation, no register values
i=int((z+1-1867216.25)/36524.25); number of centuries
i=z+1+i-int(i/4);i=i+1524; leap days
j=int((i-122.1)/365.25) a year value
m=int(365.25*j); k=int((i-m)/30.6001)
i=i-m-int(30.60001*k) day of the month
m=if(k<13.5,k-1,k-13); month number
if(m>2.5,j-4716,j-4715)+(m+i/100)/100 answer dependent on month value
The last line computes the year depending on the month. If the month is greater than
February then the year is j-4716 otherwise it is j-4715. Add to the year a fraction of the
combined month, day and fraction of a day. The form mmdddd. So the answer is yyyy.mmdddd
(where dddd means: day dd -- implied decimal point -- decimal part of the day dd). In
general, this scheme is a good way to display 3 different numbers as one number.
Contact Info
FormulaCalc was created by David W. Bray, Potsdam, NY;
Copyright © David W. Bray 1999-2003, All Rights Reserved.
The author may be contacted at: bray@davidbray.org.
The Bray Palm OS Page can be found at: http://davidbray.org/palm/
This archive may be freely redistributed, provided it is made available only in its complete, unmodified form with no additional files and for noncommercial purposes only. Any other use must have prior written authorization from David W. Bray at bray@davidbray.org.
Unauthorized commercial use includes, but is not limited to: