Add Function

This dialog box is used to add a function curve to the active plot. The plotted function is built with the common operators *, +, /, -, and ^ (for multiplication, addition, division, subtraction and exponentiation, respectively). A complete set of intrinsic functions are available and these are listed in the muParser section of the chapter on Mathematical Expressions and Scripting.

The first item in the dialog box selects the form of the generator function. The simplest and most common function definition uses the classical cartesian coordinate definition, y=f(x). This is the default. The next two parameters are used to select the X-range to be used for the plot. The last parameter sets the number of data points to be computed in the selected X-range.

Figure 5-4. The Add Function... dialog box: cartesian coordinates.

If the function expression contains terms that are recognizable as constants, e.g.: f(x) = a*x + b, QtiPlot will detect them and display a two column table on the right side of the dialog which contains input spin boxes that simplify setting appropriate values for the detected constants.

Figure 5-5. The Add Function... Dialog Box: Automatic Detection of Constants.

A function can also be defined using a parametric definition. That is, given some variable, t, the (x,y) data points are computed using functions of that variable, x=f(t) and y=g(t).

The first parameter in the dialog box is the name of the parametric variable (here t) followed by the range, the definition of the two functions and the number of data points.

Figure 5-6. The Add Function... dialog box: Parametric Coordinates.

Finally, a polar definition of the function may be used. Given some variable t, then the radius r and angle theta are computed using two functions of that variable, r=f(t) and theta=g(t), in a manner similar to the parametric function case. The (x,y) data points are then computed as x=r*cos(theta) and y=r*sin(theta).

The first parameter in the dialog box is the name of the parametric variable (here t) followed by the range, the definition of the two functions and the number of data points. Note that the angle is in radians. pi is an internally defined constant which can be used in any mathematical expression. For example, you can use 3*pi to define the parameter range.

Figure 5-7. The Add Function... dialog box: Polar Coordinates.