## MultiGraph Applet

The MutliGraph applet can show the graphs of several functions. The functions can, optionally, depend on parameters that are controlled by sliders at the bottom of the applet. (This is similar to the FamiliesOfGraphs applet, except that it can handle more than one function and it is possible to have no parameters at all.) The default is to have a single function input and no parameters. Here is how the applet looks when it is not configured with any applet params:

However, it is possible to have any number of function inputs (although, in practice, having too many of them will take up too much space). Each function has as associated color for its graph. If you have a lot of function inputs, you can arrange them into two columns instead of one. Let's look at the applet configured for four function inputs. It is configured to respond to mouse inputs (click, shift-click, click-and-drag, and right-click-and-drag), and I've added a grid for fun. Click this button to open the applet in a separate window:

By the way, in the MultiGraph applet, it's OK for a function input box to be empty. The corresponding function simply won't be drawn. In all the other WCM applet, and empty function input box will be reported as an error.

This applet was created using the applet tag:

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

<param name="FrameSize" value="580 440">

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

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

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

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

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

<param name="FunctionCount" value="4">

<param name="Function1" value="tan(x)">

<param name="Function2" value="sin(x)">

<param name="Function3" value="cos(x)">

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

</applet>Finally, let's look at a version of the applet configured to use parameters.

This time, the applet just shows a single example, without any input boxes

(although you can certainly use input boxes and parameters in the same applet). The third function in this applet is the sum of the first two functions. I've set the colors so the first two functions are drawn in light colors, while their sum is shown in black.The applet tag for this version of the applet is:

<applet archive="webcompmath.jar" code="net.sourceforge.webcompmath.applets.MultiGraph" width=330 height=380>

<param name="PanelTitle" value="sin(A*x) + cos(B*x)">

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

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

<param name="Limits" value="-5 5 -3 3">

<param name="Parameter1" value="A -5 5 1">

<param name="Parameter2" value="B">

<param name="Function1" value="sin(A*x)">

<param name="Function2" value="cos(B*x)">

<param name="Function3" value="sin(A*x)+cos(B*x)">

<param name="GraphColor1" value="255 180 180">

<param name="GraphColor2" value="180 180 255">

<param name="GraphColor3" value="black">

</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 applet parameters processed by the MutliGraph applet:

Param NameTypeDefaultDescriptionGraphColor,

GraphColor1,

GraphColor2,

...Color (see discussion) The colors used to draw the graphs. If one GraphColor param is defined, that color is used for all the graphs. If more than one is defined, each graph is assigned its own color, but if there are more colors than graphs, the colors will repeat. If none of these parameters are defined, then a default set of eight colors is used. (You can use GraphColor1 whether or not you use GraphColor. However, to have GraphColor2, you must also have GraphColor1, and so on.) Function,

Function1,

Function2,

...String (see discussion) Define the functions that are initially shown. If none of these parameters are defined, there is one function with initial definition "abs(x)^x". If the value of the "UseFunctionInput" is "yes" (the default value), then a function input box is created for each function. You can define "Function" parameters to be empty strings to get extra empty boxes. If "UseFunctionInput" is "no", then the graphs are displayed but no function input boxes are created. In this case, empty function definitions can be used to reserve space for functions in loadable examples. (See also the "FunctionCount" parameter.) (You can use Function1 whether or not you use Function. However, to have Function2, you must also have Function1, and so on.) FunctionCountnumber (none) If this parameter is specified, it gives the number of functions that you want to have available for graphing. If it's bigger than the number of "Function" parameters that have been specified, then extra, empty function definitions are added. However, if the number of "Function" parameters is greater, then the value of the "FunctionCount" parameter is ignored. Use this parameter as an easy way to get function slots without specifying a lot of empty param values for "Function2", "Function3",... TwoInputColumnsyes/no no If this is "yes", then the input boxes and parameter sliders at the bottom of the applet will be arranged into two columns, so that they will take up less of the applet's vertical size. FunctionNameString f Specify a name to be used for the labels on function input boxes, such as "f1(x)=", "f2(x)=", ... Parameter,

Parameter1,

Parameter2,

...String (none) These params define parameters whose values appear as sliders in the applet. The data for 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 parameter. 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, then there will be no parameter sliders. (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.) 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 list of zero or more numbers, separated by spaces or commas. Then another semicolon, followed by one or more function definitions separated by yet more semicolons. You can have up to as many function definitions as the number of functions that you specified (using other applet params). If you have fewer definitions, the extra functions will be undefined and their graphs won't appear. (Note that having the numbers before the function definitions is a different format from the other configurable applets.) The format for the numbers is as follows: 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 parameter sliders, in the order in which they were added to the applet. The three numbers in a group give the minimum, maximum, and current value of a slider.