# &kmplot; Reference

## Function Syntax

Some syntax rules must be complied with:

    name(var1[, var2])=term [;extensions]

name

- The function name. If the first character is r the parser assumes that you are using polar coordinates. If the first character is x (for instance xfunc) the parser expects a second function with a leading y (here yfunc) to define the function in parametric form.

var1

- The function's variable

var2

- The function group parameter. It must be separated from the function's variable by a comma. You can use the group parameter to, for example, plot a number of graphs from one function. See the P option under func-extension.

term

- The expression defining the function.

## Predefined Function Names and Constants

All the predefined functions and constants that &kmplot; knows can be shown by selecting Help Names . They are:

sqr, sqrt

- Return the square and square root of a number, respectively.

exp, ln

- Return the exponential and natural logarithm of a number, respectively.

log

- Returns the logarithm to base 10 of a number.

sin, arcsin

- Return the sine and inverse sine of a number, respectively. Note that the argument to sin and the return value of arcsin are in radians.

cos, arccos

- Return the cosine and inverse cosine of a number, respectively. Also in radians.

tan, arctan

- Return the tangent and inverse tangent of a number, respectively. Also in radians.

sinh, arcsinh

- Return the hyperbolic sine and inverse hyperbolic sine of a number, respectively.

cosh, arccosh

- Return the hyperbolic cosine and inverse hyperbolic cosine of a number, respectively.

tanh, arctanh

- Return the hyperbolic tangent and inverse hyperbolic tangent of a number, respectively.

sin, arcsin

- Return the sine and inverse sine of a number, respectively. Note that the argument to sin and the return value of arcsin are in radians.

cos, arccos

- Return the cosine and inverse cosine of a number, respectively. Also in radians.

pi, e

- Constants representing &pgr; (3.14159...) and e (2.71828...), respectively.

These functions and constants and even all user defined functions can be used to determine the axes settings as well. See the-axes-tab.

## Extensions

An extension for a function is specified by entering a semicolon, followed by the extension, after the function definition. For example:

    f(x)=x^2; A1

will show the graph y=x2 with its first derivative. Supported extensions are described below:

N

- The function will be stored but not be drawn. So it can be used like any other user defined or predefined function.

A1

- The graph of the derivative of the function will be drawn additionally with the same color but less line width. This extension has no effect on functions defined in parametric form.

A2

- The graph of the second derivative of the function will be drawn additionally with the same color but less line width. This extension has no effect on functions defined in parametric form.

D[a,b]

- Sets the domain for which the function will be displayed. For parametric functions, this is the domain that the parameter takes, and only needs to be specified for the x function.

P[a{,b...}]

- Give a set of values of a group parameter for which the function should be displayed. For example: `f(x,k)=k*x;P[1,2,3]` will plot the functions f(x)=x, f(x)=2*x and f(x)=3*x. You can also use functions as the arguments to the P option.

## Mathematical Syntax

&kmplot; uses a common way of expressing mathematical functions, so you should have no trouble working it out. The operators &kmplot; understands are, in order of decreasing precedence:

^

- The caret symbol performs exponentiation. ⪚, `2^4` returns 16.

*, /

- The asterisk and slash symbols perform multiplication and division . ⪚, `3*4/2` returns 6.

+, -

- The plus and minus symbols perform addition and subtraction. ⪚, `1+3-2` returns 2.

Note the precedence, which means that if parentheses are not used, exponentiation is performed before multiplication/division, which is performed before addition/subtraction. So `1+2*4^2` returns 33, and not, say 144. To override this, use parentheses. To use the above example, `((1+2)*4)^2` will return 144.

## Plotting Area

By default, explicitly given functions are plotted for the whole of the visible part of the x-axis. (See func-extension to change this for individual functions.) For every pixel on the x-axis &kmplot; calculates a function value. If the plotting area contains the resulting point it is connected to the last drawn point by a line.

Parametric functions are plotted for parameter values from 0 upto 2&pgr;. This range can also be set using the D extension (see func-extension).

## Cross Hair Cursor

While the mouse cursor is over the plotting area the cursor changes to a cross hair. The current coordinates can be seen at the intersections with the coordinate axes and also in the status bar at the bottom of the main window.

You can trace a function's values more precisely by clicking onto or next to a graph. The cross hair then will be caught and be colored in the same color as the graph. A second click anywhere in the window will leave this trace mode.

Note that tracing is only possible with explicitly given functions. The coordinates are always displayed according to a cartesian system of coordinates. Neither parametric functions, nor functions given in polar coordinates, nor derivatives can be traced in this way.