The KmPlot Handbook
The KmPlot Handbook
Next

The KmPlot Handbook

Klaus-Dieter Möller

Philip Rodrigues

Conversion to British English: Andrew Coles
Revision 1.0 (2003-09-25)

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.1 or any later version published by the Free Software Foundation; with no Invariant Sections, with no Front-Cover Texts, and with no Back-Cover Texts. A copy of the license is included in the section entitled "GNU Free Documentation License".

KmPlot is a mathematical function plotter for the KDE Desktop.

KmPlot is part of the KDE-EDU Project: http://edu.kde.org/


Chapter 1. Introduction
Introduction
Prev
Next

Chapter 1. Introduction

KmPlot is a mathematical function plotter for the KDE Desktop. It has a powerful built-in parser. You can plot different functions simultaneously and combine them to build new functions.


Examples

KmPlot supports parametric functions and functions in polar coordinates. Several grid modes are supported. Plots may be printed with high precision in the correct scale.

KmPlot also provides some numerical an visual features like:

  • Filling and calculating the area between the plot and the first axis

  • Finding maximum and minimum values

  • Changing function parameters dynamically

  • Plotting derivatives and integral functions.

These features help in learning the relationship between mathematical functions and their graphical representation in a coordinate system.

Prev
Next
Home


Would you like to make a comment or contribute an update to this page?
Send feedback to the KDE Docs Team

Chapter 2. First Steps With KmPlot
First Steps With KmPlot
Prev
Next

Chapter 2. First Steps With KmPlot

Simple Function Plot

In the main toolbar there is a simple text box in which you can enter a function expression. Simply enter:

x^2
and press Enter. This will draw the plot of y=x^2 in the coordinate system. Enter another expression in the text box like
5*sin(x)
and another plot will be added.

Click on one of the lines you have just plotted. Now the cross hair gets the colour of the plot and is attached to the plot. You can use the mouse to move the cross hair along the plot. In the status bar at the bottom of the window the coordinates of the current position is displayed. Note that if the plot touches the x-axis the root will be displayed in the status bar, too.

Click the mouse again and the cross hair will be detached from the plot.

Edit Properties
Edit Properties

Edit Properties

Let us make some changes to the function and change the colour of the plot.

You can edit all functions with the Plot->Edit Plots... menu entry. A dialogue appears which lists all the functions that you have plotted. Notice that KmPlot has automatically found a unique function name for your expressions and completed the expression to a function equation.

Select f(x)=x^2 in the list. A double click or pressing the Edit button will show you a dialogue window. Here you have access to a lot of options. Let us rename the function and move the plot 5 units down. Change the function equation to

parabola(x)=x^2-5

Select another colour for the plot using the Color button. Finally press OK and your changes take effect in the coordinate system.

Note

All changes can be undone until you press OK in the Edit Plots dialogue.



Would you like to make a comment or contribute an update to this page?
Send feedback to the KDE Docs Team

Prev
Next
Home


Would you like to make a comment or contribute an update to this page?
Send feedback to the KDE Docs Team

Chapter 3. Using KmPlot
Using KmPlot
Prev
Next

Chapter 3. 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 (i.e., 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.


Screenshot

Function Types

Explicit Functions

To enter an explicit function (i.e., 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 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 FunctionsNew 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, i.e., 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, e.g., 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
Combining Functions

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, e.g. an explicit function cannot be combined with a polar function.



Would you like to make a comment or contribute an update to this page?
Send feedback to the KDE Docs Team

Changing the appearance of functions
Changing the appearance of functions

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 the section called “Popup menu”.



Would you like to make a comment or contribute an update to this page?
Send feedback to the KDE Docs Team

Popup menu
Popup menu

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 the section called “The Tools Menu”.



Would you like to make a comment or contribute an update to this page?
Send feedback to the KDE Docs Team

Prev
Next
Home


Would you like to make a comment or contribute an update to this page?
Send feedback to the KDE Docs Team

Chapter 4. Configuring KmPlot
Configuring KmPlot
Prev
Next

Chapter 4. Configuring KmPlot

To access the KmPlot configuration dialogue, select Settings->Configure KmPlot.... A number of settings can also be changed from options in the Edit menu, as well.

Note

Settings changed in the KmPlot configuration dialogue become the default for KmPlot, and only take effect when a new plot is started. Settings changed in the View menu take effect immediately, but do not persist after KmPlot is exited.

General Configuration

Here you can set global settings which automatic will be saved when you exit KmPlot. In the first tab you can set calculation-precision, angle-mode (radians and degrees), background colour and zoom in and zoom out factors.

The second tab let you define you own constants. KmPlot saves the constains in the same file as KCalc does. That means you can create a constant in KmPlot, close the program and load it in KCalc and vice versa. KmPlot only supports constant names that consist one capital character and if you in KCalc define a constant name that is not one character, the name will be truncated. E.g, if you already have the constants "apple" and "bananas" in KCalc, they will be renamed to "A" and "B" in KmPlot.


Screenshot
Colours Configuration
Colours Configuration

Colours Configuration

In the Coords tab of the Colours configuration option, you can change the colours of the axes and grid of the main KmPlot area.

In the Functions tab, you can change the colours used for the graphs of the ten functions allowed in KmPlot.



Would you like to make a comment or contribute an update to this page?
Send feedback to the KDE Docs Team

Coords Configuration
Coords Configuration

Coords Configuration

The Axes Configuration

X-Axis

Sets the range for the x-axis scale. You can choose one of the predefined ranges, or select Custom to make your own. Note that in the Custom boxes, you can use the predefined functions and constants (see the section called “Predefined Function Names and Constants”) as the extremes of the range (e.g., set min: to 2*pi). You can even use functions you have defined to set the extremes of the axis range. For example, if you have defined a function f(x)=x^2, you could set min: to f(3), which would make the lower end of the range equal to 9.

Y-Axis

Sets the range for the y-axis. See “X-Axis” above.

Axes line width

Sets the width of the lines representing the axes.

Tic width

Sets the width of the lines representing tics on the axes.

Tic length

Sets the length of the lines representing tics on the axes.

Labels

If checked, the names (x, y) of the axes are shown on the plot.

The Grid Configuration

You can set the Grid Style to one of four options:

No Grid

No gridlines are drawn on the plot area

Lines

Straight lines form a grid of squares on the plot area.

Crosses

Crosses are drawn to indicate points where x and y have integer values (e.g., (1,1), (4,2) etc.).

Polar Grid

Lines of constant radius and of constant angle are drawn on the plot area.

The Line width option is used to set the width of the lines of the grid.

The Fonts Configuration

Header table sets the font for the information table shown in KmPlot printouts, and Axes labels sets the font used for all labels on the axes in the plot area.



Would you like to make a comment or contribute an update to this page?
Send feedback to the KDE Docs Team

Scaling Configuration
Scaling Configuration

Scaling Configuration

For each axis, you can set the Scaling and Printing of one tic. The Scaling option selects how many units apart the axis tics will be (and therefore, how far apart grid lines will be drawn), and the Printing option selects the length of one tic when displayed on the screen or printed. In this way, these options can be used to change the size of the graph on screen or on a page: For example, doubling the Printing setting whilst keeping the Scaling setting the same will result in the graph doubling in in height or width.



Would you like to make a comment or contribute an update to this page?
Send feedback to the KDE Docs Team

Prev
Next
Home


Would you like to make a comment or contribute an update to this page?
Send feedback to the KDE Docs Team

Chapter 5. KmPlot Reference
KmPlot Reference
Prev
Next

Chapter 5. 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. The parameter values can be selected manually or you can choose to have a slider bar that controls one parameter. By changing the value of the slider the value parameter will be changed. The slider can be set to an integer between 0 and 100.

term

The expression defining the function.

Predefined Function Names and Constants
Predefined Function Names and Constants

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 π (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 section called “The Axes Configuration”.



Would you like to make a comment or contribute an update to this page?
Send feedback to the KDE Docs Team

Mathematical Syntax
Mathematical Syntax

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. e.g., 2^4 returns 16.

*, /

The asterisk and slash symbols perform multiplication and division . e.g., 3*4/2 returns 6.

+, -

The plus and minus symbols perform addition and subtraction. e.g., 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.



Would you like to make a comment or contribute an update to this page?
Send feedback to the KDE Docs Team

Plotting Area
Plotting Area

Plotting Area

By default, explicitly given functions are plotted for the whole of the visible part of the x-axis. You can specify an other range in the edit-dialogue for the function. 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 up to 2π. You can set the plotting range in the dialogue for the function too.



Would you like to make a comment or contribute an update to this page?
Send feedback to the KDE Docs Team

Cross Hair Cursor
Cross Hair Cursor

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 selected function is shown in the statusbar in the right column. The cross hair then will be caught and be coloured in the same colour as the graph. If the graph has the same colour as the background colour, the cross hair will have the inverted colour of the background. When moving the mouse or pressing the keys Left or Right the cross hair will follow the function and you see the current x- and y-value. If the cross hair is close to y-axis, the root-value is shown in the statusbar. You can switch function with the Up and Down keys. A second click anywhere in the window or pressing any non-navigating key 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 non-single-point parametric functions nor functions given in polar coordinates can be traced in this way.



Would you like to make a comment or contribute an update to this page?
Send feedback to the KDE Docs Team

Prev
Next
Home


Would you like to make a comment or contribute an update to this page?
Send feedback to the KDE Docs Team

Chapter 6. Command Reference
Command Reference
Prev
Next

Chapter 6. Command Reference

The File Menu

File->New (Ctrl+N)

Starts a new Plot by clearing the coordinate system and resetting the function parser.

File->Open... (Ctrl+O)

Opens an existing document.

File->Save (Ctrl+S)

Saves the document.

File->Save As...

Saves the document under another name.

File->Print... (Ctrl+P)

Sends the plot to a printer or file.

File->Quit (Ctrl+Q)

Exits KmPlot.

The Edit Menu
The Edit Menu

The Edit Menu

Edit->Colours...

Displays the Colour Settings dialogue box. See Chapter 4, Configuring KmPlot.

Edit->Coordinate System...

Displays the Coordinate System dialogue box. See Chapter 4, Configuring KmPlot.

Edit->Scaling...

Displays the Scaling Settings dialogue box. See Chapter 4, Configuring KmPlot.

Edit->Fonts...

Displays the Font Settings dialogue box. See Chapter 4, Configuring KmPlot.

Edit->Coordinate System I

Show both positive and negative x- and y-values on the grid.

Edit->Coordinate System II

Show positive and negative y-values, but positive x-values only

Edit->Coordinate System III

Show only positive x- and y-values.



Would you like to make a comment or contribute an update to this page?
Send feedback to the KDE Docs Team

The Plot Menu
The Plot Menu

The Plot Menu

Functions->New Function Plot...

Opens the dialogue for creating a new function plot. See Chapter 3, Using KmPlot.

Functions->New Parametric Plot...

Opens the dialogue for creating a new parametric plot. See Chapter 3, Using KmPlot.

Functions->New Polar Plot...

Opens the dialogue for creating a new polar plot. See Chapter 3, Using KmPlot.

Functions->Edit Plots...

Displays the functions dialogue. There you can add, edit and remove functions. See Chapter 3, Using KmPlot.



Would you like to make a comment or contribute an update to this page?
Send feedback to the KDE Docs Team

The Zoom Menu
The Zoom Menu

The Zoom Menu

The first five items in the menu change zoom-mode.

Zoom->No Zoom

Disable the zoom-mode.

Zoom->Zoom rectangular

Let the user draw a rectangle. The minimum and maximum values will be set to the coordinates of the rectangle.

Zoom->Zoom in

The minimum and maximum values will come closer to each other and the selected point in the graph will be centred.

Zoom->Zoom out

The minimum and maximum values will be more separated from each other and the selected point in the graph will be centred.

Zoom->Centre a point

The selected point in the graph will be centred.

Zoom->Fit widget to trigonometric functions

The scale will be adapted to trigonometric functions. This works both for radians and degrees.



Would you like to make a comment or contribute an update to this page?
Send feedback to the KDE Docs Team

The Settings Menu
The Settings Menu

The Settings Menu

Settings->Show Toolbar

Toggle on and off the display of the toolbar. The default is on.

Settings->Show Statusbar

Toggle on and off the display of the statusbar at the bottom of the KmPlot main window. The default is on.

Settings->Configure Shortcuts...

Personalise the keybindings for KmPlot.

Settings->Configure Toolbars...

Personalise the toolbars for KmPlot.

Settings->Configure KmPlot

Customise KmPlot. The options available to you are described in Chapter 4, Configuring KmPlot.



Would you like to make a comment or contribute an update to this page?
Send feedback to the KDE Docs Team

The Tools Menu
The Tools Menu

The Tools Menu

This menu constains some tools for the functions that can be useful:

Tools->Get y-value

Let the user get the y-value from a specific x-value. At the moment, only plot functions are supported. Type a value or expression in the textbox under "X:". In the list below all the available functions are shown. Press the "Calculate" button to find the function's y-value. The result will be shown in the y-value box.



Would you like to make a comment or contribute an update to this page?
Send feedback to the KDE Docs Team

The Help Menu
The Help Menu

The Help Menu

KmPlot has a standard KDE Help as described below, with one addition:

Help->Names...

Opens a window with a list of the predefined function names and constants that KmPlot knows.

The standard KDE Help entries are:

Help->Contents... (F1)

Invokes the KDE Help system starting at the KmPlot help pages. (this document).

Help->What's This? (Shift+F1)

Changes the mouse cursor to a combination arrow and question mark. Clicking on items within KmPlot will open a help window (if one exists for the particular item) explaining the item's function.

Help->Report Bug...

Opens the Bug report dialogue where you can report a bug or request a “wishlist” feature.

Help->About KmPlot

This will display version and author information.

Help->About KDE

This displays the KDE version and other basic information.



Would you like to make a comment or contribute an update to this page?
Send feedback to the KDE Docs Team

Prev
Next
Home


Would you like to make a comment or contribute an update to this page?
Send feedback to the KDE Docs Team

Chapter 7. Developer's Guide to KmPlot
Developer's Guide to KmPlot
Prev
Next

Chapter 7. Developer's Guide to KmPlot

If you want to contribute to KmPlot feel free to send a mail to or

Prev
Next
Home


Would you like to make a comment or contribute an update to this page?
Send feedback to the KDE Docs Team

Chapter 8. Credits and Licence
Credits and Licence
Prev
Next

Chapter 8. Credits and Licence

KmPlot

Program copyright 2000-2002 Klaus-Dieter Möller

Contributors

  • CVS: Robert Gogolok

  • Porting GUI to KDE 3 and Translating: Matthias Messmer

  • Various improvements: Fredrik Edemar

Documentation copyright 2000--2002 by Klaus-Dieter Möller .

Documentation extended and updated for KDE 3.2 by Philip Rodrigues .

Documentation extended and updated for KDE 3.3 by Philip Rodrigues and Fredrik Edemar .

Andrew Coles

This documentation is licensed under the terms of the GNU Free Documentation License.

This program is licensed under the terms of the GNU General Public License.

Prev
Next
Home


Would you like to make a comment or contribute an update to this page?
Send feedback to the KDE Docs Team

Appendix A. Installation
Installation
Prev

Appendix A. Installation

KmPlot is part of the KDE project http://www.kde.org/.

KmPlot can be found in the kdeedu package on ftp://ftp.kde.org/pub/kde/, the main FTP site of the KDE project.



KmPlot is part of the KDE EDU Project: http://edu.kde.org/

KmPlot has its own homepage on SourceForge. You can also find archives of older versions of KmPlot there, for example, for KDE 2.x

In order to compile and install KmPlot on your system, type the following in the base directory of the KmPlot distribution:

% ./configure
% make
% make install

Since KmPlot uses autoconf and automake you should have no trouble compiling it. Should you run into problems please report them to the KDE mailing lists.

Prev
Home


Would you like to make a comment or contribute an update to this page?
Send feedback to the KDE Docs Team

Next
 


Would you like to make a comment or contribute an update to this page?
Send feedback to the KDE Docs Team