## SecantTangent Applet

The SecantTangent applet is a rather special purpose applet that is supposed to show secant lines converging on a tangent line. The applet draws a tangent line to a graph at a point marked by a draggable disk (which is red in the default version). By dragging this disk, you can move the point. A secant line is drawn from this point to another point, which is marked by another draggable disk (green in the default version). You can also set the x-coordinates of the point by entering them in the input boxes at the bottom of the applet. The slopes of the two lines are shown at the upper left, but you can turn off the display of the tangent slope if, for example, you want the user to estimate the slope of the tangent line from the slopes of secant lines. Here is what you get if you use no applet params:

And here is an example that shows a gallery of examples. This example responds to mouse actions on the canvas (click, shift-click, click-and-drag, and right-click-and-drag). Note that in the last example, the computer incorrectly thinks that the function has tangent at x=0.

The applet tag for this version is:

<applet archive="webcompmath.jar" code="net.sourceforge.webcompmath.applets.SecantTangent"

width=350 height=360>

<param name="UseMouseZoom" value="yes">

<param name="UsePanner" value="yes">

<param name="UseFunctionInput" value="no">

<param name="UseLimitsPanel" value="no">

<param name="UseLoadButton" value="no">

<param name="CanvasColor" value="255 255 225">

<param name="GraphColor" value="blue">

<param name="SlopeTextColor" value="180 0 0">

<param name="SlopeTextBackground" value="lightGray">

<param name="ShowTangentSlope" value="yes">

<param name="Example1" value="Vertical tangent at x=0?;

abs(x)^x; -2 2 -1 3 0 1">

<param name="Example2" value="Try dragging points off the

graph; sqrt(x); -2 5 -1 3 1 3">

<param name="Example3" value="Tangent exists at x=0; (x = 0)? 0

: x^2 * sin(1/x); -2 2 -2 2 0 1">

<param name="Example4" value="No tangent at x=0; (x = 0)? 0 : x

* sin(1/x); -2 2 -2 2 0 1">

</applet>Many of the applet params are processed by the source code in the base class, GenericGraphApplet. See the list of params for that class for information about those parameters. Here is a table of the additional and modified applet parameters for the SecantTangent applet:

Param NameTypeDefaultDescriptionGraphColorColor black The color used to draw the graph. FunctionString "e ^ x" If there is a function input box, this is its initial contents. If there is no function input box, then SecantTangent uses this value to define the function that is graphed when the applet starts. (The "x" is replaced by the name of the independent variable.) TangentColorcolor red The color for the tangent line and the draggable disk that is drawn at the point of tangency. SecantColorcolor 0 200 0 The color for the secant line and of the second draggable point. x1number 0 Initial x-coordinate for point of tangency. x2number 1 Initial x-coordinate of second point on secant line. ShowTangentSlopeyes/no yes If this is "no", then the slope of the tangent line is not displayed. (The slope of the secant line is displayed in any case.) ShowTangentLineyes/no yes If this is "no", then the tangent line is not displayed. SlopeTextColorcolor black Color used for text in the display of the tangent and secant slopes. SlopeTextBackgroundcolor black Background color for the little box in which the tangent and secant slopes are displayed. Example,

Example1,

Example2,

...String (none) These params, if present, define examples that appear in an Examples menu at the top of the applet. You can define "Example1" whether or not you define "Example". However, you can only have an "Example2" if you have an "Example1", you can only have "Example3" if you have "Example2", and so on. An example takes the following form: First, a descriptive title that will appear in the example menu, followed by a semicolon. Second, a function definition that will be displayed (and put in the function input box, if there is one). This can be optionally followed by another semicolon and a list of four to six numbers. The first four numbers give the x- and y-limits to be used for the example. If they are not present, then -5,5,-5,5 is used. The fifth number gives the x-coordinate of the point of tangency. The sixth number gives the x-coordinate of the second point on the secant line.

If there are more semicolons and elements, each such element is a comma separated list. For open points, the first item is "open" and the next two items are the x,y coordinates of the point. Closed points are similar, except that the first item is "closed". Line asymptotes use "asymptote" as the first item, followed by four numbers representing the x,y coordinates of two points on the line.