## Parametric Applet

This applet draws a parametric curve (x(t),y(t)), for t in a specified range of values. It does this by plotting a sequence of points on the curve and connecting them with lines. The number of points that are plotted can be controlled. In the default version of the applet, there are input boxes for the starting and ending values of the parameter and for the number of intervals into which the range of t-values is divided. There is also a "Trace Curve!" button. If you click this button, a crosshair will move along the curve.

Here is a version that uses some applet params for configuration. This version is configured to respond to mouse actions on the canvas (click, shift-click, and click-and-drag for zooming and right-click-and-drag for panning). It also shows a grid, and it has several examples that can be loaded.

This version of the applet appears as a button that you can click to open a separate window:The applet tag for this version of the applet is:

<applet archive="webcompmath.jar" code="net.sourceforge.webcompmath.applets.Parametric" width=220 height=35>

<param name="FrameTitle" value="Parametric Curves">

<param name="FrameSize" value="600 400">

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

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

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

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

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

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

<param name="Example1" value="Try tracing this ellipse; 5*sin(t); cos(t); -6 6 -6 6, 0 6.2832 100">

<param name="Example2" value="An example with discontinuities; trunc(t); 1/t; -3 3 -3 3, -3 3 200">

<param name="Example3" value="Logarithmic spiral; ln(t)*cos(t); ln(t)*sin(t); -4 4 -4 4, 1 30 400">

<param name="Example4" value="A cute squiggle; 2*cos(11*t) + 3*cos(5*t); 2*sin(10*t) - 4*sin(6*t); -6 6 -6 6, 0 6.2832 500">

<param name="Example5" value="A pointy squiggle; 2*cos(7*t) + 3*cos(5*t); 2*sin(9*t) - 4*sin(3*t); -6 6 -6 6, 0 6.2832 500"">

</applet>And finally here is a version that is set up as a gallery of examples. This has the same examples as the previous one, but no user input an no mouse zooming:

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 applet parameters processed by Parametric, including the params from GenericGraphApplet whose default values are changed in Parametric:

Param NameTypeDefaultDescriptionCurveColorColor magenta The color used to draw the parametric curve. FunctionString cos(t) + cos(3*t) If there are input boxes for the functions, this is the initial content of the first box, which gives the horizontal coordinate on the curve. If there is no function input box, then Parametric uses this value to define the curve that is graphed when the applet starts. (Actually, the default doesn't use the name "t". It uses the name of the Variable.) Function2String cos(t) + cos(3*t) If there are input boxes for the functions, this is the initial content of the second box, which gives the vertical coordinate on the curve. If there is no function input box, then Parametric uses this value to define the curve that is graphed when the applet starts. (Actually, the default doesn't use the name "t". It uses the name of the Variable.) FunctionLabelString x(t) = The label shown to the left of the first input box, if any. (Actually, the default doesn't use the names "x" and "t". It uses the value of the XName parameter and the name of the Variable.) FunctionLabel2String y(t) = The label shown to the left of the second input box, if any. (Actually, the default doesn't use the names "y" and "t". It uses the value of the YName parameter and the name of the Variable.) UseParamInputsyes/no yes If this is "yes", then there will be input boxes where the user can enter a starting and ending value for the parameter and the number of intervals into which this range of parameter values is divided. If there is a limit control panel, the animator inputs are added to the limit control panel. Otherwise, a separate panel is created to hold the parameter inputs. TwoLimitsColumnsyes/no (see discussion) This parameter determines whether the applet will try to put the controls in the limit control panel into two columns instead of one. In GenericGraphApplet, the default value is "no". In Parametric, the default is "yes" if animator inputs are used and otherwise is "no". (Otherwise, there would be too many rows in the limit control panel.) ParameterMinString -2 The starting value for the parameter. (Note that the value can be a constant expression, such as "pi/2" or "sqrt(2)"). ParameterMaxString 2 The ending value for the parameter on the curve. Note that the value doesn't actually have to be greater than the value of "ParameterMin". Intervalsinteger 25 The number of intervals into which the range of parameter values is divided. The number of points in the animation is this number, plus one, except that some extra points might be added if there are discontinuities and there might be missing points if there are points where one of the functions is undefined. UseTraceryes/no yes If this is yes, there will be a button named "Trace Curve!". When the user clicks this button, a crosshair is moved along the curve from beginning to end. CrosshairColorColor gray The color of the crosshair used to trace the curve. This is ignored if "UseTracer" has value "no". TracerIntervalsinteger 100 The number of intervals into which the range of parameter values is divided when the curve is traced. That is the crosshair is shown at this many points, plus one. However, if the value provided for the parameter is 0 or less, then the number of "TracerIntervals" will be the same as the number of intervals on the curve. This is ignored if the value of "UseTracer" is "no". 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. This is followed by an expression, a semicolon, and another expression. These expressions give the x- and y- coordinates on the parametric curve. These can optionally be followed by another semicolon and a list of four to seven 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 next three numbers specify the minimum value for the parameter, the maximum value, and the number of intervals into which the range of parameter values is divided.