Note: Enable Word Wrap (in Notepad, Edit-->Word Wrap) to read this document easily.

4Day Graphing Calculator v1.05
==============================

My latest creation.  I call it "FourDay" (4D) because version 1.0 took four days to write.  I was hoping for three days, but as it turned out I could barely do it in four.  Like most things, I blame it on Windows. 

It supports all kinds of standard expressions such as (sin x) and 12/(2+x); type expressions at the line at the bottom of the window and press Enter to evaluate and graph.  You can recall previously typed lines using the up arrow key.

The expressions are evaluated using a certain order-of-operations, also known as precedence rules.  For example, if you type 1+2*3, the multiply ("*") operation occurs before the add ("+"), so the result is 1+(2*3) or 7.

On the left side of the window is the graph; if you are familiar with graphing calculators, then you know it produces the image you see by varying the variable X horizontally, then placing a pixel vertically according to the result.  The vertical coordinate is called Y by convention.  This graphing calculator also supports a "pseudo-3D" mode, where you can use both X and Y in your expression.  Then, the color of each pixel on the graph varies to show you the result.

On the right side of the window is the "ordinary calculator".  It shows you the RPN version of what you typed (if you don't know what RPN, or "Reverse Polish Notation" is, just ignore it), followed by the result of the expression.  For example, if you type 1+2*3, it will give you the result, 7.  If you give an expression with X in it, the ordinary calculator will treat X as an ordinary variable whose value is zero by default.

Special Values
==============

The calculator recognizes the following "special" values, which are replaced with the appropriate number:

- pi: 3.1415926535897932
- e: 2.71828182846
- ans: The result of the last expression

Variables
=========

In this calculator "variables" are simply memory cells that can hold numbers.  4DGC has 26 variables: one for each letter of the alphabet.  You can hold a number in a variable, then use it later.  For example, if you type

	A = 3

Then the variable "A" will hold the value 3.  If you then type

	A*X

3 times X will be graphed, which will be a steep diagonal line.  X is also a variable, but it is special when graphing because the calculator gives it a new value for every point along the graph.

Boolean expressions
===================

Boolean, or "logical" expressions are expressions wherein the last operator executed is one of the following:

	>  <  >=  <=  ==  !=  &&  ||  ^^  !

For example,

	2*X >= 2

is a boolean expression.  Boolean expressions are special because the result is always one (true) or zero (false).  For example, the above expression is true for 3, but false for -1. Because there are only two possible values for the result, 4DGC makes special graphs from boolean expressions.  It uses both X and Y coordinates, and at every point on the graph it puts a dark blue pixel to represent true and a white pixel to represent false.  For example, if you type

	X*X + Y*Y < 9*9

4DGC will produce a blue circle with a radius of 9.

Boolean expressions are always shown this way, regardless of the Graph Type setting.  For more information about the Boolean operators, see the "operators" section.

It is not recommended you use the equality (==) or inequality (<>) operators, since the left and right numbers must be exactly equal.  For example, 

	X*X + Y*Y == 9*9

Would not give a graph of a circle because few, if any, of the points shown would exactly equal 81.

The status text
===============

The status text at the top-right corner of the window gives the following information:

- Value at mouse: the value of the expression where the mouse pointer is on the graph
- Approximate Integral:
	- For boolean graphs, the area of the shaded region that is visible on the graph
	- For line or dot graphs, the area under the curve between X Low and X High
	- For pseudo-3D graphs, the volume under the curve between X Low, X High, Y Low, and Y High.
- Approximate Derivative: the slope of the graph where the mouse is located.  This is most useful in 2D, but in 3D there are two slopes given: one for horizontal and one for vertical, i.e. d/dx and d/dy.  This feature does not apply to boolean graphs.

Operators
=========

Operators are those things which perform calculations.  For example, + is the addition operator.  All calculations in 4DGC are done with operators, and they come in two flavors:

- Binary: this means there are two "arguments", or "parameters" to the operator, one on either side of the operator.  For example, in 3+6, the two arguments are 3 and 6.
- Unary: this means there is only one argument, on the right side of the operator.  For example, abs is a unary operator that makes its argument positive.  In abs 4, 4 is the argument (and the result is also 4.)

All operators have a precedence level that determines what order operations will be performed in.  For example, * has a higher precedence than +, so * will be performed first. Brackets can be used to override precedence.

All unary operators have the highest precedence.  Here is a complete list of them:

Operator  Example Result  Description
--------  ------- ------  -----------
abs/+     abs(-3)      3  Calculates the absolute value; Negative numbers
                          become positive
neg/-     -X          -X  Negates the number; positive becomes negative and
                          negative becomes positive
~         ~1          -2  Calculates the one's complement by inverting the
                          bits (sometimes useful for programmers)
!         ~0           1  Logical not: zero becomes one, and non-zero becomes
                          zero.
sin       sin (pi/6) 0.5  Trigonometry functions: they calculate the sine,
cos       cos 0        1  cosine, and tangent, respectively, of the specified 
tan       tan (pi/4)   1  angle in radians.
asin      asin 0       0  Inverse trigonometry functions: they calculate the 
acos      acos -1     pi  arcsine, arccosine, and arctangent, respectively, of 
atan      atan 1    pi/4  the specified unit value between -1 and 1.
sqrt      sqrt 81      9  Calculates the square root
square    square 7    49  Squares the number by multiplying it by itself
cube      cube 3      27  Cubes the number (raises it to the third power)
recip     recip 4   0.25  Calculates the reciprocol (that is, 1 divided by the
                          number.
log       log 100      2  Calculates the logarithm, which is the power you must
                          raise 10 to to get the specified number.
ln/loge   ln (e**3)    3  Calculates log-base-e, which is the power you raise
                          the number "e" to, to get the specified number.
int       int 5.8      5  Converts the number to an integer by removing the
                          digits after the decimal point.

The other operators are all binary.  They are shown in order of precedence in the following table:

P Operator  Example Result  Description
- --------  ------- ------  -----------
7 **        3 ** 4      81  Calculates a power: Left number is the base, right
                            is the exponent.
6 *         3 * 4       12  Multiplies two numbers.
6 /         12 / 6       2  Divides the left number by the right number.
6 %         13 % 5       3  Calculates the modulus--the remainder after the
                            numbers are divided.
5 <<        2 << 3       6  Integer shift left and integer shift right: these
5 >>        12 >> 2      3  operators, well known by programmers, shift bits 
                            left or right a certain number of slots.
4 +         1 + 1        2  Adds two numbers.
4 -         4 - 1.5    2.5  Subtracts two numbers.
3 &         255 & 522   10  &, |, and ^ are bitwise and, bitwise or and bitwise
3 |         10 | 100   110  exclusive or, respectively.  They are used in 
3 ^         6 ^ 3        5  programming, and that's as far as I care to explain.
2 <         2 < 3        1  Is-less-than
2 >         2 > 3        0  Is-greater-than
2 <=        2 <= 2       1  Is-less-than-or-equal-to
2 >=        -1 >= 1      0  Is-greater-than-or-equal-to
2 ==        5 == 5       1  Is-equal-to
2 <>/!=     4 != 4       0  Is-not-equal-to
1 =         A = 2        2  Assignment: sets a variable to a certain value
1 **=       A **= 2   A**2  Comound assignment: raises variable to a power
1 *=        A *= 2     A*2  Comound assignment: multiplies variable by number
1 %=        A %= 2     A%2  Comound assignment: variable = remainder of division
1 <<=       A <<= 2   A<<2  Comound assignment: shifts variable left
1 >>=       A >>= 2   A>>2  Comound assignment: shifts variable right
1 +=        A += 2     A+2  Comound assignment: adds a number to the variable
1 -=        A -= 2     A-2  Comound assignment: subtracts number from variable
1 &=        A &= 2     A&2  Comound assignment: masks out all but specified bits
1 |=        A |= 2     A|2  Comound assignment: sets specified bits
1 ^=        A ^= 2     A^2  Comound assignment: toggles specified bits

The "P" column gives the precedence level.

Revision History
================

v1.05: Day 5:
I added a "status bar" function.  Okay, it's not a status bar, but it displays status information.  Look for it in the top-right corner.  It displays:
- The value of the expression at the current mouse position
- The slope of the graph at the current mouse position.  In 3D mode, it displays the slope dZ/dX followed by dZ/dY.
- The area or volume under the graph, within the current X range (for 2D graphs) or X/Y ranges (for 3D and boolean graphs).

v1.00: First release

Fun Graphs
==========
2D:
((abstanx>1) * (1/x) + (abstanx<=1) * tanx) * 3 + x*sinx / 2

3D:
2**x - 2**y
(x-6)*(x-2)*(x+2)*(x+6)*(y-6)*(y-2)*(y+2)*(y+6)/4000
5*x*6**(x*sin y)*(tan (y/x))

Logical (a.k.a Boolean):
square x + square y < 100 ^^ sin x + sin y > 0

I hope you have fun with this... or it helps you with your math homework... or whatever.

- Qwertie (David Piepgrass)
qwertman@hotmail.com
http://members.nbci.com/Qwertie

4Day Graphing Calculator Copyright 2001 by David Piepgrass