Calculus Applets

Prev Home Next

Applet Introduction

The calculus applets are all based on the Web Components for Mathematics library and developed with the Java programming language. A typical applet, for graphing a function, appears below.

Try the following:

  1. At the top of the applet is a drop down menu of examples. Click on it to drop down the menu, then click on one of the selections. Note that the function definition (just below the graph) changes, as does the graph itself. Many of the applets have an examples menu at the top.

  2. You can type your own function definition. Click-drag over the current function definition and type a new one, such as x^3, then press Enter. You will see your cubic on the graph. More information on the syntax of function definitions can be found below.

  3. Error messages show up in the graphing area. For example, type in the function z^3 and press Enter. Since this applet doesn't know about the variable z (only about x), it displays an error message. To fix things, just edit the z back to an x and press Enter.

  4. You can zoom in and out using the zoom buttons on the Limit Control Panel, shown to the right of the graph. You can also directly edit the xmin, xmax, ymin, and ymax fields, pressing Enter to cause your limits to take effect (or click the Set Limits button). Pressing the Restore Limits button returns you to the last saved set of limits, useful if you've messed around with the limits and want to get back where you started. Some applets also have a Save Limits button, which saves the current limits for use by the Restore Limits button.

  5. You can also zoom and pan using the mouse. Click on the graph and the applet will zoom in by a factor of 2, centered on the location of the click. Do this with the Shift key held down to zoom out x2. Click-drag on the graph window creates a rectangle; when you let go of the mouse button, the graph will be zoomed to that rectangle. Click-drag with the right mouse button (or while holding down the command key on a Macintosh) will pan the graph. Remember, you can always undo your zoom/pan experiments with the Restore Limits button.

  6. The Equalize button will cause both axes to have the same scale (i.e., circles will look like circles instead of ellipses). This is useful if you want the scales to be the same on both axes and you have resized the window or zoomed in a way that the axes no longer have the same scale.

  7. Try dragging the slider at the bottom of the applet, and watch the crosshair move along the graph. Many applets have sliders that allow you to adjust a value. You can also type a value into the x = box next to the slider, and have the slider updated directly to your desired value. Once you have clicked on the slider, you can also move the slider using the ← and → keys on your keyboard.

  8. If you want to project an applet onto a screen for use in a lecture, the normal applet's lines and fonts may be too small. Most pages provide a Launch Presentation button that opens a new window with the applet in it, also with larger fonts and wider lines. Try clicking the button below to see what this looks like. The resulting window can be resized to fit your screen.

Function Syntax: The syntax for the definition of a function is very similar to that found on common graphing calculators. Binary operators such as + (addition), - (subtraction), * (multiplication), / (division), and ^ (exponentiation) follow the standard rules for precedence. Operators at equal levels are performed left to right, and grouping parentheses are also supported. The following are the symbols and operations allowed in a function definition.

+, -, *, / The standard arithmetic binary operators. Multiplication is implied if the * is left out (e.g., 2*x and 2x are equivalent, but note that 2*3 is not the same as 23). Example: 2x-1
The – sign can also be used as negation, as in – ( x + 2 ). Use parentheses when an exponent has a - sign, as in e^(-1).
( ) Parentheses are used for grouping and also to delimit the arguments to a function. Examples: (x-2)/3 and sin(x)
x The independent variable used in all function definitions (some applets support other variables, as noted on those pages)
^ Exponentiation binary operator. If the exponent is not an integer, the program checks whether it is a rational number. If the reduced denominator is even, or if the program cannot determine that the exponent is rational, then only the non-negative part of the domain is graphed. If it is rational and the reduced denominator is odd, then the negative part of the domain is also graphed. For example, x^(1/3) will graph a domain of all reals, while x^(pi) will only use non-negative reals.
! Factorial, as in x !
e, pi Built-in constants.

Built-in Functions: The following built-in functions are provided:

abs(x) Absolute value
arccos(x) Inverse cosine (radians)
arcsin(x) Inverse sine (radians)
arctan(x) Inverse tangent (radians)
ceiling(x) The smallest (closest to negative infinity) real value that is greater than or equal to x and is equal to a mathematical integer.
cos(x) Cosine (radians)
cosh(x) Hyperbolic cosine
cot(x) Cotangent (radians)
csc(x) Cosecant (radians)
cubert(x) Cube root
exp(x) Exponential function (i.e., e^x)
floor(x) The largest (closest to positive infinity) real value that is less than or equal to x and is equal to a mathematical integer.
ln(x) Natural logarithm (base e)
log2(x) Base 2 logarithm
log10(x) Common logarithm (base 10)
round(x) The closest integer to x
sec(x) Secant (radians)
sin(x) Sine (radians)
sinh(x) Hyperbolic sine
sqrt(x) Square root
tan(x) Tangent (radians)
tanh(x) Hyperbolic tangent
trunc(x) Drop any digits after the decimal point

Piecewise Functions: In addition, a special syntax is provided for conditional expressions, which enables you to graph piecewise functions. A conditional expression is an expression using the ? operator. An example is ((x > 0)? x : -x) which says: “if x is greater than 0, then the value is x, otherwise it is – x.” The part before the ? is the condition and compares two quantities using one of the comparison operators =, >, <, >=, <=, or <> (not equal). You can also write more complex expressions using & (the AND binary operator), | (the OR binary operator), and ~ (the NOT unary operator). The part between the ? and the : is the value if the condition is true and can be any valid expression (even another conditional expression). The part after the : is the value if the condition is false. Note that the parentheses surrounding the conditional expression are not required, but are recommended if the conditional expression is part of a larger expression. The false part (after the :) is optional. If it is not present, then when the condition is false the expression evaluates to “not a number,” which will cause nothing to be graphed for that domain value.

Background: These applets are built using the Web Components for Mathematics(WCM) library and the Java programming language. More information on WCM can be found at http://webcompmath.sourceforge.net/

Creative Commons License
This work by Thomas S. Downey is licensed under a Creative Commons Attribution 3.0 License.

Prev Home Next