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 ->. 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 (that is,, 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 Chapter 5, KmPlot Reference.
To enter an explicit function (that is,, 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 the section called “Mathematical Syntax”.
As an example, to draw the graph of y=x2+2x, enter the following into the functions dialog of KmPlot:
f(x)=x^2+2x
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 . 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 dialog, do the following:
Open the parametric plot dialog with ->.
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).
In the x and y boxes, enter the appropriate equations, that is,,
xcircle(t)=sin(t)
and
ycircle(t)=cos(t)
.
You can set some further options for the plot in this dialog:
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.
If this options are 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.
With this option you can set the width of the line drawn on the plot area, in units of 0.1mm.
Click on the color box and pick a color in the dialog that appears. The line on the plot will be drawn in this color.
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 ->. In the box labeled r, complete the function definition, including the name of the theta variable you want to use, for example,, 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.
Would you like to comment or contribute an update to this page?
Send feedback to the TDE Development Team