moved kdeaccessibility kdeaddons kdeadmin kdeartwork kdebindings kdeedu kdegames...
[kdeedu.git] / doc / kmplot / using.docbook
blobdcca9388fc55bdf518fcece6dfebac642786ce28
1 <chapter id="using-kmplot">
2 <title>Using &kmplot;</title>
4 <para>&kmplot; deals with named functions, which can be specified in
5 terms of Cartesian coordinates (called <quote>explicit
6 functions</quote>), polar coordinates or as parametric functions. To
7 enter a function, choose
8 <menuchoice><guimenu>Plot</guimenu><guimenuitem>Edit
9 Plots...</guimenuitem> </menuchoice>. You can also enter new functions
10 in the <guilabel>Function equation</guilabel> text box in the main
11 &kmplot; window. The text box can handle explicit and polar
12 functions. Each function you enter must have a unique name (&ie;, a
13 name that is not taken by any of the existing functions displayed in
14 the list box). A function name will be automatically generated if you
15 do not specify one.</para>
17 <para>For more information on &kmplot; functions, see <xref
18 linkend="reference"/>.
19 </para>
21 <screenshot>
22 <screeninfo>Here is a screenshot of the &kmplot; welcome window</screeninfo>
23         <mediaobject>
24           <imageobject>
25             <imagedata fileref="main.png" format="PNG"/>
26           </imageobject>
27           <textobject>
28             <phrase>Screenshot</phrase>
29           </textobject>
30         </mediaobject>
31 </screenshot>
33 <sect1 id="function-types">
34 <title>Function Types</title>
36 <sect2 id="explicit-functions">
37 <title>Explicit Functions</title>
38 <para>To enter an explicit function (&ie;, a function in the form y=f(x)) into &kmplot;, just enter it in the
39 following form:
40 <screen>
41 <userinput><replaceable>f</replaceable>(<replaceable>x</replaceable>)=<replaceable>expression</replaceable></userinput>
42 </screen>
43 Where:
44 <itemizedlist>
45 <listitem><para>
46  <replaceable>f</replaceable> is the name of the function, and can be any
47 string of letters and numbers you like, provided it does not start with any of
48 the letters x, y or r (since these are used for parametric and polar
49 functions).</para>
50 </listitem>
52 <listitem><para>
53 <replaceable>x</replaceable> is the x-coordinate, to be used in the expression
54 following the equals sign. It is in fact a dummy variable, so you can use any
55 variable name you like, but the effect will be the same.</para>
56 </listitem>
58 <listitem>
59 <para><replaceable>expression</replaceable> is the expression to be plotted,
60 given in appropriate syntax for &kmplot;. See <xref linkend="math-syntax"/>.
61 </para>
62 </listitem>
64 </itemizedlist>
65 </para>
66 <para>As an example, to draw the graph of y=x<superscript>2</superscript>+2x,
67 enter the following into the functions dialog of &kmplot;:
68 <screen>
69 f(x)=x^2+2x
70 </screen>
71 </para>
72 </sect2>
74 <sect2 id="parametric-functions">
75 <title>Parametric Functions</title>
76 <para>Parametric functions are those in which the x and y coordinates are
77 defined by separate functions of another variable, often called t. To enter a
78 parametric function in &kmplot;, follow the procedure as for an explicit
79 function, but prefix the name of the function describing the x-coordinate with
80 the letter x, and the function describing the y-coordinate with the letter
81 y. As with explicit functions, you may use any variable name you wish for the
82 parameter. To draw a parametric function, you must go to <guimenu>Functions</guimenu><guimenuitem>New Parametric Plot...</guimenuitem>. A function name will be created automatic if you do not specify one.</para>
83 <para>As an example, suppose you want to draw a circle, which has parametric
84 equations x=sin(t), y=cos(t). In the &kmplot; functions dialog, do the
85 following:
86 <orderedlist>
87 <listitem><para>Open the parametric plot dialog with
88 <menuchoice><guimenu>Plot</guimenu><guimenuitem>New Parametric Plot...</guimenuitem>
89 </menuchoice>.</para>
90 </listitem>
91 <listitem><para>Enter a name for the function, say,
92 <userinput>circle</userinput>, in the <guilabel>Name</guilabel>
93 box. The names of the x and y functions change to match this name: the
94 x function becomes <guilabel>xcircle(t)</guilabel> and the y function
95 becomes <guilabel>ycircle(t)</guilabel>.</para>
96 </listitem>
97 <listitem>
98 <para>In the x and y boxes, enter the appropriate equations, &ie;,
99 <guilabel>xcircle(t)=</guilabel><userinput>sin(t)</userinput> and
100 <guilabel>ycircle(t)=</guilabel><userinput>cos(t)</userinput>.</para>
101 </listitem>
102 </orderedlist>
103 Click on <guibutton>OK</guibutton> and the function will be drawn.
104 </para>
105 <para>You can set some further options for the plot in this dialog:
106 <variablelist>
108 <varlistentry>
109 <term><guilabel>Hide</guilabel></term>
110 <listitem>
111 <para>If this option is selected, the plot is not drawn, but &kmplot;
112 remembers the function definition, so you can use it to define other
113 functions.</para>
114 </listitem>
115 </varlistentry>
117 <varlistentry>
118 <term><guilabel>Custom Plot Range</guilabel></term>
119 <listitem>
120 <para>If this option is selected, you can change the maximum and
121 minimum values of the parameter t for which the function is plotted
122 using the <guilabel>min</guilabel> and <guilabel>max</guilabel>
123 boxes.</para>
124 </listitem>
125 </varlistentry>
127 <varlistentry>
128 <term><guilabel>Line width</guilabel></term>
129 <listitem>
130 <para>With this option you can set the width of the line drawn on the
131 plot area, in units of 0.1mm.</para>
132 </listitem>
133 </varlistentry>
135 <varlistentry>
136 <term><guilabel>Color</guilabel></term>
137 <listitem>
138 <para>Click on the color box and pick a color in the dialog that
139 appears. The line on the plot will be drawn in this color.</para>
140 </listitem>
141 </varlistentry>
142 </variablelist>
143 </para>
144 </sect2>
146 <sect2 id="polar-functions">
147 <title>Entering Functions in Polar Coordinates</title>
149 <para>Polar coordinates represent a point by its distance from the origin
150 (usually called r), and the angle a line from the origin to the point makes
151 with the x-axis (usually represented by the Greek letter theta). To enter
152 functions in polar coordinates, use the menu entry
153 <menuchoice><guimenu>Plot</guimenu><guimenuitem>New Polar Plot...</guimenuitem>
154 </menuchoice>. In the box labeled <guilabel>r</guilabel>, complete the
155 function definition, including the name of the theta variable you want
156 to use, &eg;, to draw the Archimedes' spiral r=theta, enter:
157 <screen>
158 <userinput>
159 (theta)=theta
160 </userinput>
161 </screen>
162 so that the whole line reads <quote>r(theta)=theta</quote>. Note that
163 you can use any name for the theta variable, so
164 <quote>r(foo)=foo</quote> would have produced exactly the same output.
165 </para>
167 </sect2>
169 </sect1>
171 <sect1 id="combining-functions">
172 <title>Combining Functions</title>
173 <para>Functions can be combined to produce new ones. Simply enter the functions
174 after the equals sign in an expression as if the functions were variables. For
175 example, if you have defined functions f(x) and g(x), you can plot the sum of f
176 and g with:
177 <screen>
178 <userinput>
179 sum(x)=f(x)+g(x)
180 </userinput>
181 </screen>
182 </para>
183 <para>Note that you can only combine functions of the same type, &eg; an
184 explicit function cannot be combined with a polar function.</para>
185 </sect1>
187 <sect1 id="function-appearance">
188 <title>Changing the appearance of functions</title>
190 <para>To change the appearance of a function's graph on the main plot
191 window, select the function in the <guilabel>Edit Plots</guilabel>
192 dialog, and click on the <guibutton>Edit</guibutton> button. In the
193 dialog which appears, you can change the line width in the text box,
194 and the color of the function's graph by clicking on the color button
195 at the bottom. If you are editing an explicit function, you will see a
196 dialog with three tabs. In the first one you specify the equation of
197 the function. The <guilabel>Derivatives</guilabel> tab lets you draw
198 the first and second derivative to the function. With the
199 <guilabel>Integral</guilabel> tab you can draw the integral of the
200 function which is calculated using Euler's method. </para>
201 <para>Another way to edit a function is to right click on the
202 graph. In the popup menu that appears, choose
203 <guibutton>Edit</guibutton></para>
205 <para>For more information on the popup menu, see <xref
206 linkend="popupmenu"/>.
207 </para>
208 </sect1>
210 <sect1 id="popupmenu">
211 <title>Popup menu</title>
213 <para>When right-clicking on a plot function or a single-point parametric plot function a popup menu will appear.
214 In the menu there are seven items available:</para>
216 <variablelist>
217 <varlistentry>
218 <term><menuchoice><guimenuitem>Hide</guimenuitem>
219 </menuchoice></term>
220 <listitem>
221 <para>Hides the selected graph. Other plots of the graph's function will still be shown.</para>
222 </listitem>
223 </varlistentry>
225 <varlistentry>
226 <term><menuchoice><guimenuitem>Remove</guimenuitem>
227 </menuchoice></term>
228 <listitem>
229 <para>Removes the function. All its graphs will disappear.</para>
230 </listitem>
231 </varlistentry>
233 <varlistentry>
234 <term><menuchoice><guimenuitem>Edit</guimenuitem>
235 </menuchoice></term>
236 <listitem>
237 <para>Shows the editor dialog for the selected function.</para>
238 </listitem>
239 </varlistentry>
240 </variablelist>
242 <para>For plot functions the following four items are also available:</para>
244 <variablelist>
245 <varlistentry>
246 <term><menuchoice><guimenuitem>Get y-value</guimenuitem>
247 </menuchoice></term>
248 <listitem>
249 <para>Opens a dialog in which you can find the y-value corresponding to
250 a specific x-value. The selected graph will be highlighted in the
251 dialog. Enter an x value in the <guilabel>X</guilabel> box, and click
252 on <guibutton>Find</guibutton> (or press &Enter;). The corresponding y
253 value will be shown under <guilabel>Y</guilabel>.
254 </para>
255 </listitem>
256 </varlistentry>
258 <varlistentry>
259 <term><menuchoice><guimenuitem>Search for Minimum Value</guimenuitem>
260 </menuchoice></term>
261 <listitem>
262 <para>Find the minimum value of the graph in a specified range. The
263 selected graph will be highlighted in the dialog that appears. Enter
264 the lower and upper boundaries of the region in which you want to
265 search for a minimum, and click <guibutton>Find</guibutton>. The x and
266 y values at the minimum will be shown.</para>
267 </listitem>
268 </varlistentry>
270 <varlistentry>
271 <term><menuchoice><guimenuitem>Search for Maximum Value</guimenuitem>
272 </menuchoice></term>
273 <listitem>
274 <para>This is the same as <guimenuitem>Search for minimum
275 value</guimenuitem> above, but finds maximum values instead of minima. </para>
276 </listitem>
277 </varlistentry>
279 <varlistentry>
280 <term><menuchoice><guimenuitem>Area Under Graph</guimenuitem>
281 </menuchoice></term>
282 <listitem>
283 <para>Draws the area between the graph and the x-axis. The selected
284 graph will be highlighted in the new dialog that appears. For more
285 information on the Search for Area Under Graph-feature, see <xref
286 linkend="a-tools-menu"/>.</para>
287 </listitem>
288 </varlistentry>
289 </variablelist>
292 </sect1>
295 </chapter>
296 <!--
297 Local Variables:
298 mode: sgml
299 sgml-minimize-attributes:nil
300 sgml-general-insert-case:lower
301 sgml-indent-step:0
302 sgml-indent-data:nil
303 sgml-parent-document:("index.docbook" "BOOK" "CHAPTER")
304 End: