# GCalc 2.0 Documentation

## Functions and Input

GCalc graphs functions. To be more specific, GCalc graphs many types of functions where the domain and range are (floating-point) real numbers. The text field to the upper left is where the functions are entered. After typing in the function, press the `Enter` key on the keyboard to graph the function. The following are examples of valid inputs.

1. `siN (3x)`
2. `3 sin X - 4 (SIN x)^3`
3. `(x+1)(X-5)`
4. `X^2-4*x-5`
5. `E^(-(((x-1)/2)^2))/sqrt(pi)`
6. `2x+1`

Please note several things from these examples.

1. GCalc is case-INsensitive.
2. The independent variable is `x`, which means that all functions must only use `x` as the dummy variable.
3. Two mathematical constants are built into GCalc: e (2.718281828...) and pi (3.141592654...).

The following mathematical functions are currently implemented:

 Binary Operators + addition - subtraction * multiplication / division ^ exponentiation Algebraic/Arithmetic Operators sqrt square root neg negation, `neg(x)=-x` ln natural log (base e) log common log (base 10), `log(x)=ln(x)/ln(10)` abs absolute value exp exponentiation (base e), `exp(x)=e^x` - negation, `-x=neg(x)` ceil ceiling, `ceil(x)` equals the smallest integer greater than `x` floor floor, `floor(x)` equals the greatest integer less than `x` sign if x<0, sign(x)=-1; if x=0, sign(x)=0; if x>0, sign(x)=1 Trigonometric Operators sin sine cos cosine tan tangent csc cosecant sec secant cot cotangent Trigonometric Inverse Operators asin arcsine acos arccosine atan arctangent acsc arccosecant asec arcsecant acot arccotangent Hyperbolic Trigonometric operators sinh hyperbolic sine cosh hyperbolic cosine tanh hyperbolic tangent csch hyperbolic cosecant sech hyperbolic secant coth hyperbolic cotangent Hyperbolic Trigonometric Inverse Operators asinh hyperbolic arcsine acosh hyperbolic arccosine atanh hyperbolic arctangent acsch hyperbolic arccosecant asech hyperbolic arcsecant acoth hyperbolic arccotangent Constants / Variable x the independent variable pi π=the ratio between the circumference and the diameter of a circle e e=base of the natural log Calculus ddx differentiation operator

Also, keep in mind the following.

• Assume conventional order of operations rules.
• Parentheses are allowed.
• `e` has different symantics depending on the context. Since floating-point literals are allowed, `5e2` equals `5×102` but does not equal `10*e`.
• Implicit multiplication is allowed. For example, `3x cos x = 3*x*cos x`

## Graphing Screen and Tracing

If the trace feature is turned off, passing the mouse over the graphing screen will display the cursor's coordinates on the coordinate panel directly below the graphing screen. Double-clicking on the screen will center the graph at that point.

If the trace feature is on, the GCalc will trace the functions on the screen if you wave the cursor over it. Clicking on the screen will iterate through the functions. The traced point's coordinate will also be displayed in the coordinate panel. You will see that the "Box-Zoom" feature is disabled when the calculator is tracing.

There are several other buttons at the bottom of the screen. Many of them control the various features of the graph. You can turn on and off the axes, the scale ticks, and the grid. Also, you turn off the default behavior of GCalc that connects the various points it plots. In certain cases, this default has undesirable results, especially at discontinuities in a function.

## Color

Pressing the colored button (below the "Prev" button), a palette dialog will come up, allowing the user to select a different color. The selected color will be used for the next function entered. You can also change the default palette by double-clicking on a particular palette color. This will bring up another dialog which allows you to pick any arbitrary colors in the HSB (Hue/Saturation/Brigness) color space.

The color of a particular function is determined when it is drawn the first time. It can be changed through the Function Management dialog

## Zoom

There are five types of predefined zooms.

 Standard Zoom x ranges from -10 to 10y ranges from -10 to 10 Trigonometric Zoom x ranges from -5θ to -5θy ranges from -4 to 4(If in radian mode, θ=π/2; if in degree mode, θ=90°) Square Zoom This compensates for the aspect ratio of graph screen, so that right angles look like right angles by adjusting the y range appropriately. Graph-Fit Zoom This will iterate through each of the functions and find the maximum and minimum values in the domain. The y ranges from the minimum to the maximum. This is only applicable when there is a nonconstant function or when there are several distinct constant functions on the screen. Box Zoom When the trace feature is disabled, one can draw a rectangle on the graph screen. The box zoom feature will shrink or enlarge that box to fit the screen.

In addition to these preprogrammed zooms, you can zoom in and out with respect to the center of the screen with the "Zoom in" and "Zoom out" buttons. Under these buttons are two numbers. XZoom signifies the magnitude of the zoom (in or out) horizontally. YZoom denotes the magnitude of the zoom vertically. A value of `1.0` is no zoom. Negative are nonsensical and will be converted to its absolute value. Values less than `1.0` will reverse the effect to the Zoom In/Out buttons, so you can zoom in and zoom out at the same time along different axes. Pressing `Enter` in the textfield will activate the change.

## Window

And what graphing calculator is complete without the interface to set the window dimentions? It is relatively self-explanatory. A scale of `0.0` will make the scale vanish along that axis. Negative are nonsensical and will be converted to its absolute value. Also, don't trust the scales when the window is very very very small or very very very far away from the origin. There is an error in the implementation of the algorithm that draws the scales that will show itself at these extremes. My advice is, don't wander too far away from the origin. For most operations, it should be fine.

These window textfields will accept expression that do not contain x. `Pi/2 ` is a valid entry, for example. Pressing `Enter` in the textfield will activate the change.

## Differentiation

As mentioned before, differentiation is implemented and available through the `ddx` command. The neat thing is that GCalc is performing the differentiation symbolically. If you type in `ddx(x^3+x^2-3x+1)`, the calculator graphs `3x^2+2x-3`, explicitly. If you type in `ddx(x (2 x))`, the calculator will actually graph `x*2+1*2x`, using the product rule. The only problems I'm aware of in the differentiation code is with taking the derivative of the `atanh` and `acoth` functions. The problems occur because the GCalc has no notion of a function's domain other than the x range of the viewing window.

## Calculations and Some General Limits

All calculations are limited to about 15 significant digits. (1.23456789012345 is a number with 15 significant digits.) Please remember that the calculations are done in floating-point and is susceptible to round-off errors. For example, `(1/3)+(1/3)+(1/3)` may not equal `1`.

The overflow occurs at about 1.7x10308.

Also, GCalc can only work with real numbers. Therefore, functions such as `x^exp(pi*sqrt(-1))` will not produce a graph although it is mathematically equivalent to `1/x`.

## Angle Measurements (Degree vs Radians)

GCalc's default angle measurement is in radians, but this behavior can be changed by selecting the checkbox labeled 'Degree'. Graph involving trignometric functions will instantly reflect the change. Also, changing the angle measurement type will affect the functionality of the Trigonometric Zoom button. Selecting the checkbox labeled 'Radian' will easily switch to radian mode.

## Graph Window

As discussed in the Frequently Asked Questions, printing of Java applets directly is a next-to-impossible task. So, instead the common approach is to take a screenshot and print it through another application (such as Adobe Photoshop, Microsoft Paint, Word, etc.). To facilitate the process, GCalc incorporates a the "Graph Window" button. Pressing this button will cause a window to pop-up which contains only the current graphing screen in order to minimize the cropping one must do.

To include the trace crosshairs into the graphing window, press down on the mouse button for 2 or more seconds. Letting go of the mouse button will pop-up the Graph Window with the crosshairs.

## Compatibility

On Windows, GCalc should run on Netscape Navigator 4.06+, Microsoft Internet Explorer 4.0+, or any web browser that fully supports Java 1.1 API. Usually, you can download a Java plugin for your browser.

The mileage on other platforms may vary. The current development platform (as of May 2004) is Gentoo 2004.1 with Mozilla 1.6 and Java 1.4.2