# Using &kmplot;

&kmplot; deals with named functions, which can be specified in terms of Cartesian coordinates (called explicit functions), polar coordinates or as parametric functions. To enter a function, choose Plot Edit Plots... . You can also enter new functions in the Function equation text box in the main &kmplot; window. The text box can handle explicit and polar functions. Each function you enter must have a unique name (&ie;, a name that is not taken by any of the existing functions displayed in the list box). A function name will be automatically generated if you do not specify one.

For more information on &kmplot; functions, see reference.

Here is a screenshot of the &kmplot; welcome window Screenshot

## Function Types

### Explicit Functions

To enter an explicit function (&ie;, a function in the form y=f(x)) into &kmplot;, just enter it in the following form:

    f(x)=expression

Where:

- `f` is the name of the function, and can be any string of letters and numbers you like, provided it does not start with any of the letters x, y or r (since these are used for parametric and polar functions).

- `x` is the x-coordinate, to be used in the expression following the equals sign. It is in fact a dummy variable, so you can use any variable name you like, but the effect will be the same.

- `expression` is the expression to be plotted, given in appropriate syntax for &kmplot;. See math-syntax.

As an example, to draw the graph of y=x2+2x, enter the following into the functions dialogue of &kmplot;:

    f(x)=x^2+2x

### Parametric Functions

Parametric functions are those in which the x and y coordinates are defined by separate functions of another variable, often called t. To enter a parametric function in &kmplot;, follow the procedure as for an explicit function, but prefix the name of the function describing the x-coordinate with the letter x, and the function describing the y-coordinate with the letter y. As with explicit functions, you may use any variable name you wish for the parameter. To draw a parametric function, you must go to Functions New Parametric Plot.... A function name will be created automatic if you do not specify one.

As an example, suppose you want to draw a circle, which has parametric equations x=sin(t), y=cos(t). In the &kmplot; functions dialogue, do the following:

1. Open the parametric plot dialogue with Plot New Parametric Plot... .

2. Enter a name for the function, say, `circle`, in the Name box. The names of the x and y functions change to match this name: the x function becomes xcircle(t) and the y function becomes ycircle(t).

3. In the x and y boxes, enter the appropriate equations, &ie;, xcircle(t)=`sin(t)` and ycircle(t)=`cos(t)`.

Click on OK and the function will be drawn.

You can set some further options for the plot in this dialogue:

Hide

- If this option is selected, the plot is not drawn, but &kmplot; remembers the function definition, so you can use it to define other functions.

Custom Plot Range

- If this option is selected, you can change the maximum and minimum values of the parameter t for which the function is plotted using the min and max boxes.

Line width

- With this option you can set the width of the line drawn on the plot area, in units of 0.1mm.

Colour

- Click on the colour box and pick a colour in the dialogue that appears. The line on the plot will be drawn in this colour.

### Entering Functions in Polar Coordinates

Polar coordinates represent a point by its distance from the origin (usually called r), and the angle a line from the origin to the point makes with the x-axis (usually represented by the Greek letter theta). To enter functions in polar coordinates, use the menu entry Plot New Polar Plot... . In the box labelled r, complete the function definition, including the name of the theta variable you want to use, ⪚, to draw the Archimedes' spiral r=theta, enter:

    (theta)=theta

so that the whole line reads r(theta)=theta. Note that you can use any name for the theta variable, so r(foo)=foo would have produced exactly the same output.

## Combining Functions

Functions can be combined to produce new ones. Simply enter the functions after the equals sign in an expression as if the functions were variables. For example, if you have defined functions f(x) and g(x), you can plot the sum of f and g with:

    sum(x)=f(x)+g(x)

Note that you can only combine functions of the same type, ⪚ an explicit function cannot be combined with a polar function.

## Changing the appearance of functions

To change the appearance of a function's graph on the main plot window, select the function in the Edit Plots dialogue, and click on the Edit button. In the dialogue which appears, you can change the line width in the text box, and the colour of the function's graph by clicking on the colour button at the bottom. If you are editing an explicit function, you will see a dialogue with three tabs. In the first one you specify the equation of the function. The Derivatives tab lets you draw the first and second derivative to the function. With the Integral tab you can draw the integral of the function which is calculated using Euler's method.

Another way to edit a function is to right click on the graph. In the popup menu that appears, choose Edit

For more information on the popup menu, see popupmenu.

## Popup menu

When right-clicking on a plot function or a single-point parametric plot function a popup menu will appear. In the menu there are seven items available:

Hide

- Hides the selected graph. Other plots of the graph's function will still be shown.

Remove

- Removes the function. All its graphs will disappear.

Edit

- Shows the editor dialogue for the selected function.

For plot functions the following four items are also available:

Get y-value

- Opens a dialogue in which you can find the y-value corresponding to a specific x-value. The selected graph will be highlighted in the dialogue. Enter an x value in the X box, and click on Find (or press &Enter;). The corresponding y value will be shown under Y.

Search for Minimum Value

- Find the minimum value of the graph in a specified range. The selected graph will be highlighted in the dialogue that appears. Enter the lower and upper boundaries of the region in which you want to search for a minimum, and click Find. The x and y values at the minimum will be shown.

Search for Maximum Value

- This is the same as Search for minimum value above, but finds maximum values instead of minima.

Area Under Graph

- Draws the area between the graph and the x-axis. The selected graph will be highlighted in the new dialogue that appears. For more information on the Search for Area Under Graph-feature, see a-tools-menu.