[ Prev | Main | Next ]

FamiliesOfGraphs Applet

The FamiliesOfGraphs applet allows a user to investigate parameterized families of graphs by varying the value of one or more parameters. Sliders that control the parameters are shown at the bottom of the applet. In the applet's default configuration, there is only one parameter, named "k", and the initial function is "sin(k*x)". Here is how the applet looks when it is not configured with any applet params:

Here is the applet with some different colors and stripped down to show just one example:

This applet was created using the applet tag:

      <applet archive="jcm1.0-config.jar" code="FamiliesOfGraphs.class" width=400 height=380>
         <param name="Parameter1" value="A 0 4 1">
         <param name="Parameter2" value="B 0 5 1">
         <param name="Parameter3" value="C 0 6.283185 0">
         <param name="Function" value="A*sin(B*(x-C))">
         <param name="UseFunctionInput" value="no">
         <param name="UseLimitsPanel" value="no">
         <param name="BackgroundColor" value="0 120 0">
         <param name="Insets" value="5">
         <param name="CanvasColor" value="220 255 220">
         <param name="GraphColor" value="180 0 0">
         <param name="AxesColor" value="0 120 0">
         <param name="PanelBackground" value="220 255 220">
         <param name="BorderWidth" value="0">
         <param name="PanelTitle" value="Graph of A * sin( B*(x - C) )">
         <param name="TitleBackground" value="220 255 220">

The final version of the applet appears as a button that will open a separate window. Note that the functions max(x,y) and min(x,y) are defined in the parser in this example. Two example functions are defined in this applet. To load an example, select it from the pop-up menu at the top of the applet and click the "Load Example" button.

The applet tag for this version of the applet is:

   <applet archive="jcm1.0-config.jar" code="FamiliesOfGraphs.class" width=200 height=40>
      <param name="LaunchButtonName" value="Click me! Please!!">
      <param name="Frame Title" value="Some Parameterized Families of Functions">
      <param name="FrameSize" value="450 450">
      <param name="BackgroundColor" value="black">
      <param name="CanvasColor" value="black">
      <param name="BorderColor" value="white">
      <param name="BorderWidth" value="3">
      <param name="AxesColor" value="yellow">
      <param name="AxesLightColor" value="180 180 0">
      <param name="GraphColor" value="green">
      <param name="Parameter" value="top 0 5 1">
      <param name="Parameter1" value="bot">
      <param name="Define" value="max(x,y) = x &gt; y ? x : y">
      <param name="Define1" value="min(x,y) = x &lt; y ? x : y">
      <param name="Example1" value="Truncated sine; max( bot, min( top, sin(x) ) ); -6 6 -2 2, 0 1 1, -1 0 -1">
      <param name="Example2" value="Truncated arctan; max( bot, min( top, arctan(x) ) ); -6 6 -3 3, 0 1 .25, -1 0 -.25">

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 the FamiliesOfGraphs applet source code:

Param Name Type Default Description
GraphColor Color magenta The color used to draw the graph.
Function String "sin(k*x)" If there is a function input box, this is its initial contents. If there is no function input box, then FamiliesOfGraphs uses this value to define the function that is graphed when the applet starts. (Actually, the default doesn't use the names "x" and "k". It uses the name of the variable and of the first parameter.)
String k; -5, 5, 0 These params define the parameters whose values appear as sliders in the applet. The data for the a parameter consists of the name of the parameter followed, optionally, by a semicolon and a list of up to three numbers. The first two numbers give the range of values on the slider for this variable. The third number is the initial value of the parameter. The default values for these numbers are -5, 5, and 0. If no parameters are specified in applet params, there will be one parameter named "k". Note that you can have a param named "Parameter1" whether or not you have one named "Parameter". However, to have a param named "Parameter2", you must also have one named "Parameter1". To have one named "Parameter3", you must have one named "Parameter2". And so forth.
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 numbers. The first four numbers in the list give the x- and y- limits for the graph. Remaining numbers, if any, come in groups of three and corresponding to the parameter sliders. The numbers give the minimum, maximum, and current value of a slider. Numbers can be separated by spaces and/or commas.

[ Prev | Main | Next ]