docs.kde.org
Using KmPlot
Prev
Next

Chapter 3. Using KmPlot

Table of Contents

Function Types
Cartesian Functions
Parametric Functions
Functions in Polar Coordinates
Implicit Functions
Differential Functions
Combining Functions
Changing the appearance of functions
Popup menu

KmPlot deals with several different types of functions, which can be written in function form or as an equation:

All the equation entry boxes come with a button on the right. Clicking this invokes the advanced Equation Editor dialog, which provides:


Screenshot

Function Types

Cartesian 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.

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

  • expression is the expression to be plotted, given in the appropriate syntax for KmPlot. See the section called “Mathematical Syntax”.

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 a Cartesian function for each of the x and y functions. As with Cartesian functions, you may use any variable name you wish for the parameter.

As an example, suppose you want to draw a circle, which has parametric equations x = sin(t), y = cos(t). After creating a parametric plot, enter the appropriate equations in the x and y boxes, i.e., f_x(t)=sin(t) and f_y(t)=cos(t).

You can set some further options for the plot in the function editor:

Min, Max

These options control the range of the parameter t for which the function is plotted.

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, click the Create button and select Polar Plot from the list. In the definition box, complete the function definition, including the name of the theta variable you want to use, e.g., to draw the Archimedes' spiral r = θ, enter:

r(θ) = θ

. Note that you can use any name for the theta variable, so “r(t) = t” or “f(x) = x” will produce exactly the same output.

Implicit Functions

An implicit expression relates the x and y coordinates as an equality. To create a circle, for example, click the Create button and select Implicit Plot from the list. Then, enter into the equation box (below the function name box) the following:

x^2 + y^2 = 25

Differential Functions

KmPlot can plot explicit differential equations. These are equations of the form y(n) = F(x,y',y'',...,y(n−1)), where yk is the kth derivative of y(x). KmPlot can only interpret the derivative order as the number of primes following the function name. To draw a sinusoidal curve, for example, you would use the differential equation y'' = − y oder f''(x) = −f.

However, a differential equation on its own isn't enough to determine a plot. Each curve in the diagram is generated by a combination of the differential equation and the initial conditions. You can edit the initial conditions by clicking on the Initial Conditions tab when a differential equation is selected. The number of columns provided for editing the initial conditions is dependent on the order of the differential equation.

You can set some further options for the plot in the function editor:

Step

The step value in the precision box is used in numerically solving the differential equation (using the Runge Kutta method). Its value is the maximum step size used; a smaller step size may be used if part of the differential plot is zoomed in close enough.

Prev
Next
Home


docs.kde.org