Applets Tutorial



Basic Functionality for One Variable

This section is divided into three lessons.

Lesson 1: Viewing a 2D Graph


Figure1

This demo includes two windows: a control window (which contains the equation for f(x, y) in this case) and a 2D Graph window. You may find it useful to adjust the size of the graph window.

Once you are comfortable with the window size, you can translate or zoom in or out to change your view of the 2D graph.

To translate, select Translate from the Tools menu or hold down Alt. Click and drag in the direction you want to translate the graph.

To zoom, select Zoom from the Tools menu or hold down Shift. Click and drag upward to zoom in or drag downward to zoom out.

When you are finished using the demo, you can exit by closing the control window or by selecting Exit Demo from the Demo menu in the control window.



Lesson 2: Using the Control Window


Figure2

The control window in this demo includes two elements: the interval x and the function f(x).

Each time you change the information in a text box in the control window, you must press Enter for the change to take effect.

For example, suppose you wanted to view the graph from x = –1 to 2 instead of –1 to 1. To do this, you would type in "2" in the text box for the upper bound of x and press Enter.

In this demo, you have the option of changing the bounds on x, the resolution for x, and the expression for the function f(x). (See the table below for a list of some useful built-in functions.)

To save the altered demo (don't worry, this won't overwrite the old one), select Show Applet Tag from the Demo menu in the control window. Copy the HTML code that appears, and paste it in your response to a homework assignment or discussion. This will create a button in your response that leads to your version of the demo.



Lesson 3: Variables and Expressions


Figure3

In these demos, an expression can be assigned a constant or variable value and can then be used in any formula or plot in the demo. Here, the constant is called a, and it represents the magnitude of a vertical stretch of the graph. Try changing its value. You can change it to any number or to any expression involving c, the only variable used in this demo.

Variables in the demos, like intervals, are given minimum and maximum values. Instead of having resolution, however, variables have "steps." If you start a variable at its minimum value, the amount of times you would have to press the ">" button to get to the maximum value would be equal to the number of steps for the variable.

Just as the ">" button increases the variable value by one step, the "<" button decreases the value by one step.

To see an animation in which the variable value keeps increasing or keeps decreasing until it reaches its upper or lower bound, use the ">>" or "<<" button, respectively.

In this example, the variable c represents the altitude of the green line in the 2D Graph window.




Basic Functionality for Two Variables

This section is divided into three lessons.

Lesson 1: Viewing a 3D Graph


Figure1

This demo includes two windows: a control window (which contains the equation for f(x, y) in this case) and a 3D Graph window. You may find it useful to adjust the size of the graph window.

Once you are comfortable with the window size, you can rotate, translate, or zoom in or out to change your view of the 3D graph.

To rotate, select Rotate from the Tools menu or hold down Control (hold down [Apple] if you are using a Mac). Now, click and drag the mouse in the direction you want the part of the graph closest to you to move.

To translate, select Translate from the Tools menu or hold down Alt. Click and drag in the direction you want to translate the graph.

To zoom, select Zoom from the Tools menu or hold down Shift. Click and drag upward to zoom in or drag downward to zoom out.

To return to the default view, press [space bar] or select Default from the View menu.

There are six other preset viewing angles under the View menu, each from some position on one of the axes. The shortcut keys for these views are x, y, z, Shift + x, Shift + y, and Shift + z. The shift button gives you a view from a point on the negative-valued part of the axis. Otherwise, the view will be from a positive-valued point.

When you are finished using the demo, you can exit by closing the control window or by selecting Exit Demo from the Demo menu in the control window.



Lesson 2: Using the Control Window


Figure2

The control window in this demo includes three elements: the intervals x and y and the function f(x, y).

Each time you change the information in a text box in the control window, you must press Enter for the change to take effect.

For example, suppose you wanted to view the graph from x = –1 to 2 instead of –1 to 1. To do this, you would type in "2" in the text box for the upper bound of x and press Enter.

In this demo, you have the option of changing the bounds on x and y, the resolution for x and y, and the expression for the function f(x, y). (See the table below for a list of some useful built-in functions.)

To save the altered demo (don't worry, this won't overwrite the old one), select Show Applet Tag from the Demo menu in the Ccontrol window. Copy the HTML code that appears, and paste it in your response to a homework assignment or discussion. This will create a button in your response that leads to your version of the demo.



Lesson 3: Variables and Expressions


Figure3

In these demos, an expression can be assigned a constant or variable value and can then be used in any formula or plot in the demo. Here, the constant is called a, and it represents the magnitude of a vertical stretch of the graph (along the z-axis). Try changing its value. You can change it to any number or to any expression involving c, the only variable used in this demo.

Variables in these demos, like intervals, are given minimum and maximum values. Instead of having resolution, however, variables have "steps." If you started a variable at its minimum value, the amount of times you would have to press the ">" button to get to the maximum value would be equal to the number of steps for the variable.

Just as the ">" button increases the variable value by one step, the "<" button decreases the value by one step.

To see an animation in which the variable value keeps increasing or keeps decreasing until it reaches its upper or lower bound, use the ">>" or "<<" button, respectively.

In this example, the variable c represents the altitude of the green plane in the 3D Graph window.




Built-in Functions and Constants for Demo Software

Notation Meaning
pi
π = 3.14159265
e
2.71828183
+ - * /
Standard arithmetic functions. Warning: Always put a * in between two values you want mulitplied.

Always remember your order of operations and use parentheses as necessary.

x^n
xn
ln(x)
Natural log (log base e) of x
a^x
ax
sin(x)
Sine of x
cos(x)
Cosine of x
tan(x)
Tangent of x
asin(x)
Arcsine or inverse sine of x
acos(x)
Arccosine or inverse cosine of x
atan(x)
Arctangent or inverse tangent of x
sinh(x)
Hyperbolic sine of x
cosh(x)
Hyperbolic cosine of x
tanh(x)
Hyperbolic tangent of x
sqrt(x)
√x
abs(x)
|x|
f'(x)
The first derivative of f(x)
f''(x)
The second derivative of f(x)
integral(integrand, variable,lower, upper, [resolution])
The integral of integrand with respect to variable from lower to upper bound: e.g., for 01x2dx, type integral(x^2, x, 0, 1)

The resolution is an optional input that can be used to increase the accuracy of the integral approximation.

t_max
The maximum value of the variable or interval t
t_min
The minimum value of the variable or interval t
t_res
The number of steps of the variable or interval t
scale(t)
Converts the value of t to a point in the 0–1 range
ipart(x)
The integer part of x
fpart(x)
The fractional part of x
max(a,b,...,h)
The maximal element of the set
min(a,b,....,h)
The minimal element of the set
random
A random number (Note that this takes no argument)
and, or, <, >, =, true, false
Logical operators that return 1 if true and 0 if false




Extending an Applet's Functionality

This tutorial is divided into two lessons.


Lesson 1: Adding Elements to a Demo


Figure4

The ability to add and remove features of a given demo is a particularly nice feature of these demos. We show how to add features by starting with a ''blank'' demo, which has no predefined elements.

Suppose that we wish to plot the graph of a function f(t) = t3 for t in the interval [0,3]. We would take the following steps:

  1. Under the Controls menu, select Add New Interval. In the new window that pops up, type in t=0,3,20, where we have chosen 20 as a number of subintervals for the resolution. (This controls how smoothly values are sampled from the interval.) Click OK.
  2. Next, under the Controls menu, select Add New Function. For the proposed function, type f(t)=t^3 in the text area. Click OK.
  3. Under the Controls menu, select New 2D Graph. Immediately another window appears, but it is empty, except for the axes.
  4. In this new window, select PlotAdd PlotCurve.
  5. In the first panel, following the and type in a parametric curve. For our example, type in (t,f(t)).
  6. The second panel contains options for defining the color of the curve, including coloring by a gradient of some other function. We leave the interested reader to explore these options. Click OK.

Now that the demo has been created (modified), one can change the interval for t or the function f(t) in the control window.



Lesson 2: Using Hotspots


Figure5

This demo shows a feature that is to available to all demos: the hotspot.

In the Altitude of Line window, one can click on and drag the white (heavy) dot. The user can move this so-called hotspot up and down, and if it is connected to other pieces of the demo, then it will modify the other pieces according to its definition.



The reader is encouraged to try the following extensions to a demo.
  1. Create a new demo by following these steps:
    • Add an interval x that goes from –1 to 1 in 20 steps.
    • Add a variable a that goes from –1 to 1 in 10 steps.
    • Add a function f(x), and type in any expression for it.
    • Add a 2D graph window that shows the function graph of f(x) and plots the point (a, f(a)).
  2. Create a demo that shows a graph of the function f(x) and also graphs the tangent line to f(x) at some point, x0.
  3. Create a demo based on your favorite calculus topic


Return to home page
Continue to Chapter 1