<?xml version="1.0" ?>
<!DOCTYPE book PUBLIC "-//KDE//DTD DocBook XML V4.5-Based Variant V1.1//EN" "dtd/kdedbx45.dtd" [
  <!ENTITY commands SYSTEM "commands.docbook">

  <!ENTITY MathML "<acronym>MathML</acronym>">
  <!ENTITY % addindex "IGNORE">
  <!ENTITY % English "INCLUDE">
]>

<book id="kalgebra" lang="&language;">

<bookinfo>
<title>The &kalgebra; Handbook</title>

<authorgroup>
<author>
<firstname>Aleix</firstname>
<surname>Pol</surname>
<affiliation>
<address>&Aleix.Pol.mail;</address>
</affiliation>
</author>
<!-- TRANS:ROLES_OF_TRANSLATORS -->
</authorgroup>

<copyright>
<year>2007</year>
<holder>&Aleix.Pol;</holder>
</copyright>

<legalnotice>&FDLNotice;</legalnotice>


<date>2020-12-17</date>
<releaseinfo>Applications 20.12</releaseinfo>

<abstract>
<para>
&kalgebra; is an application that can replace your graphing calculator.
It has numerical, logical, symbolic, and analysis features that let you calculate
mathematical expressions on the calculator and graphically plot the results
in 2D or 3D. &kalgebra; is rooted in the Mathematical Markup Language
(&MathML;); however, one does not need to know &MathML; to use &kalgebra;.
</para>
</abstract>

<keywordset>
<keyword>KDE</keyword>
<keyword>kdeedu</keyword>
<keyword>graph</keyword>
<keyword>mathematics</keyword>
<keyword>2D</keyword>
<keyword>3D</keyword>
<keyword>MathML</keyword>
</keywordset>

</bookinfo>

<chapter id="introduction">
<title>Introduction</title>

<para>
&kalgebra; has numerous features that allow the user to perform all sorts
of mathematical operations and show graphically. At one time, this
program was &MathML; oriented. Now it can be used by anyone with a little
mathematical knowledge to solve simple and advanced problems alike.
</para>
<!--FIXME Ask Burkhard where to put tutorials and if it is worth efforts to do. Example from UB page: https://swiftscythe.blogspot.de/2011/02/how-to-work-with-complex-numbers-in.html-->
<para>
It includes such features as:
</para>


<itemizedlist>
<listitem><para>
A calculator for quick and easy evaluation of math
functions.
</para></listitem>
<listitem><para>
Scripting capability for advanced series of calculations.
</para></listitem>
<listitem><para>
Language capabilities including function definition and syntax autocompletion.
</para></listitem>
<listitem><para>
Calculus functions including symbolic differentiation, vector calculus,
and list manipulation.
</para></listitem>
<listitem><para>
Function plotting with live cursor for graphical root finding and other
types of analysis.
</para></listitem>
<listitem><para>
3D plotting for useful visualization of 3D functions.
</para></listitem>
<listitem><para>
A built-in operator dictionary for quick reference to the many available
functions.
</para></listitem>
</itemizedlist>

<para>
Below is a screenshot of the &kalgebra; application in action:
</para>

<screenshot>
<screeninfo>Here's a screenshot of &kalgebra; main window</screeninfo>
	<mediaobject>
	  <imageobject>
	    <imagedata fileref="kalgebra-main-window.png" format="PNG"/>
	  </imageobject>
	    <textobject>
	    <phrase>&kalgebra; main window</phrase>
	  </textobject>
	</mediaobject>
</screenshot>

<para>
When the user begins a &kalgebra; session, they are presented with a
single window consisting of a <guilabel>Calculator</guilabel> tab,
a <guilabel>2D Graph</guilabel> tab,
a <guilabel>3D Graph</guilabel> tab and a
<guilabel>Dictionary</guilabel> tab. Within each tab, you will find an
input field to enter your functions or calculations, and a display field
which shows the results.
</para>

<para>At any time the user may manage their session with the main menu
<guilabel>Session</guilabel> options:</para>

<variablelist>

<varlistentry>
<term><menuchoice>
<shortcut><keycombo action="simul">&Ctrl;
<keycap>N</keycap></keycombo></shortcut>
<guimenu>Session</guimenu><guimenuitem>New</guimenuitem>
</menuchoice></term>
<listitem><para>Opens a new &kalgebra; window.</para></listitem>
</varlistentry>

<varlistentry>
<term><menuchoice>
<shortcut><keycombo action="simul">&Ctrl;&Shift;
<keycap>F</keycap></keycombo></shortcut>
<guimenu>Session</guimenu><guimenuitem>Full Screen Mode</guimenuitem>
</menuchoice></term>
<listitem><para>Toogle full screen mode for &kalgebra; window. The full
screen mode can also be switched on and off using  <inlinemediaobject>
<imageobject> <imagedata fileref="view-fullscreen.png" format="PNG"/>
</imageobject> </inlinemediaobject> button at the top right part of
&kalgebra; window.</para></listitem>
</varlistentry>

<varlistentry>
<term><menuchoice>
<shortcut><keycombo action="simul">&Ctrl;
<keycap>Q</keycap></keycombo></shortcut>
<guimenu>Session</guimenu><guimenuitem>Quit</guimenuitem>
</menuchoice></term>
<listitem><para>Shuts the program down.</para></listitem>
</varlistentry>

</variablelist>

</chapter>

<chapter id="syntax">
<title>Syntax</title>
<para>
&kalgebra; uses an intuitive algebraic syntax for entering user functions,
similar to that used on most modern graphing calculators. This section
lists the fundamental built-in operators available in &kalgebra;. The
author of &kalgebra; modeled this syntax after
<ulink url="http://maxima.sourceforge.net/">Maxima</ulink> and
<ulink url="https://www.maplesoft.com/products/maple/">Maple</ulink> for users
that may be familiar with these programs.
</para>

<para>
For users that are interested in the inner workings of &kalgebra;, user
entered expressions are converted to &MathML; on the backend. A rudimentary
understanding of the capabilities supported by &MathML; will go a long way
toward revealing the inner capabilities of &kalgebra;.
</para>

<para>Here is a list of the available operators we have by now:</para>
<itemizedlist>
<listitem><para><literal>+ - * / </literal>: Addition, subtraction, multiplication and
division.</para> </listitem>
<listitem><para><literal>^, ** </literal>: Power, you can use them both. Also it is possible to use
the unicode <literal>²</literal> characters. Powers are one way to make roots too, you can do it
like: <literal>a**(1/b)</literal></para></listitem>
<listitem><para><literal>-&gt; </literal>: lambda. It is the way to specify one or more free
variables that will be  bound in a function. For example, in the expression,
<userinput>length:=(x,y)->(x*x+y*y)^0.5</userinput>, the lambda operator is used to denote
that <literal>x</literal> and <literal>y</literal> will be bound when the length function is used.
</para></listitem>
<listitem><para><literal>x=a..b </literal>: This is used when we need to delimit a range
(bounded variable+uplimit+downlimit). This means that <literal>x</literal> goes from <literal>a</literal>
to <literal>b</literal>.</para></listitem>
<listitem><para><literal>() </literal>: It is used to specify a higher priority.</para></listitem>
<listitem><para><literal>abc(params) </literal>: Functions. When the parser finds a function, it checks
if <literal>abc</literal> is an operator. If it is, it will be treated as an operator, if it is
not, it will be treated as a user function.</para></listitem>
<listitem><para><literal>:= </literal>: Definition. It is used to define a variable value. You can
do things like <userinput>x:=3</userinput>, <userinput>x:=y</userinput> being <literal>y</literal> defined
or not or <userinput>perimeter:=r->2*pi*r</userinput>.
</para></listitem>
<listitem><para><literal>? </literal>: Piecewise condition definition. Piecewise is the way we can define
conditional operations in &kalgebra;. Put another way, this is a way of
specifying an if, elseif, else condition. If we introduce the condition before the '<literal>?</literal>' it will
use this condition only if it is true, if it finds a '<literal>?</literal>' without any condition, it will
enter in the last instance.
Example: <userinput>piecewise { x=0 ? 0, x=1 ? x+1, ? x**2 }</userinput>
</para></listitem>
<listitem><para><literal>{ } </literal>: &MathML; container. It can be used to define a container. Mainly
useful for working with piecewise.
</para></listitem>
<listitem><para><literal>= &gt; &gt;= &lt; &lt;= </literal>: Value comparators for equal,
greater, greater or equal, less and less or equal respectively.</para></listitem>
</itemizedlist>

<para>Now you could ask me, why should the user mind about &MathML;? That’s easy.
With this, we can operate with functions like <function>cos()</function>, <function>sin()</function>, any other
trigonometrical functions, <function>sum()</function> or <function>product()</function>. It does not matter what kind it is.
We can use <function>plus()</function>, <function>times()</function> and everything which has its operator. Boolean
functions are implemented as well, so we can do something like <function>or(1,0,0,0,0)</function>.</para>

</chapter>

<chapter id="using-calculator">
<title>Using the Calculator</title>
<para>&kalgebra;'s calculator is useful as a calculator on steroids. The
user may enter expressions for evaluation in <guimenu>Calculate</guimenu>
or <guimenu>Evaluate</guimenu> mode, depending on the <guimenu>Calculator</guimenu>
menu selection.
</para>
<para>
In evaluation mode &kalgebra; simplifies the expression even if it sees an undefined variable.
When in calculation mode &kalgebra;, calculates everything and if it finds an undefined
variable shows an error.
</para>
<para>
In addition to displaying the user entered equations and results in the
Calculator display, all variables that are declared are displayed in a
persistent frame to the right. By double clicking on a variable you will see a
dialog that lets you change their values (just a way to trick the log).
</para>

<para>
The <quote><varname>ans</varname></quote> variable is special, every time you enter an expression, the
<quote><varname>ans</varname></quote> variable value will be changed to the last result.
</para>

<para>The following are example functions that can be entered in
the input field of the calculator window:</para>
<itemizedlist>
<listitem><para><userinput>sin(pi)</userinput></para></listitem>
<listitem><para><userinput>k:=33</userinput></para></listitem>
<listitem><para><userinput>sum(k*x : x=0..10)</userinput></para></listitem>
<listitem><para><userinput>f:=p->p*k</userinput></para></listitem>
<listitem><para><userinput>f(pi)</userinput></para></listitem>
</itemizedlist>

<para>
The following shows a screenshot of the calculator window after entering
the above example expressions:
</para>
<screenshot>
<screeninfo>Screenshot of &kalgebra; calculator window with example expressions</screeninfo>
	<mediaobject>
	  <imageobject>
	    <imagedata fileref="kalgebra-console-window.png" format="PNG"/>
	  </imageobject>
	    <textobject>
	    <phrase>&kalgebra; calculator window</phrase>
	  </textobject>
	</mediaobject>
</screenshot>


<para>A user can control the execution of a series of calculations
using the <guimenu>Calculator</guimenu> menu options:</para>

<variablelist>

<varlistentry>
<term><menuchoice>
<shortcut><keycombo action="simul">&Ctrl;
<keycap>L</keycap></keycombo></shortcut>
<guimenu>Calculator</guimenu><guimenuitem>Load Script...</guimenuitem>
</menuchoice></term>
<listitem><para>Executes the instructions in a file sequentially.
Useful if you want to define some libraries or resume some previous work.</para></listitem>
</varlistentry>

<varlistentry>
<term><menuchoice>
<guimenu>Calculator</guimenu><guisubmenu>Recent Scripts</guisubmenu>
</menuchoice></term>
<listitem><para>Displays a submenu that will allow you to choose the recently executed scripts.</para></listitem>
</varlistentry>

<varlistentry>
<term><menuchoice>
<shortcut><keycombo action="simul">&Ctrl;
<keycap>G</keycap></keycombo></shortcut>
<guimenu>Calculator</guimenu><guimenuitem>Save Script...</guimenuitem>
</menuchoice></term>
<listitem><para>Saves the instructions you have typed since the session began to be able to reuse. Generates text files so it should be easy to fix
using any text editor, like &kate;.</para></listitem>
</varlistentry>

<varlistentry>
<term><menuchoice>
<shortcut><keycombo action="simul">&Ctrl;
<keycap>S</keycap></keycombo></shortcut>
<guimenu>Calculator</guimenu><guimenuitem>Export Log...</guimenuitem>
</menuchoice></term>
<listitem><para>Saves the log with all results into an &HTML; file to be able to print or publish.</para></listitem>
</varlistentry>

<varlistentry>
<term><menuchoice>
<shortcut><keycap>F3</keycap></shortcut>
<guimenu>Calculator</guimenu><guimenuitem>Insert ans...</guimenuitem>
</menuchoice></term>
<listitem><para>Insert the <quote><varname>ans</varname></quote> variable and makes it easier to reuse older values.</para></listitem>
</varlistentry>

<varlistentry>
<term><menuchoice>
<guimenu>Calculator</guimenu><guimenuitem>Calculate</guimenuitem>
</menuchoice></term>
<listitem><para>A radio button to set the <guilabel>Execution Mode</guilabel> to calculation.</para></listitem>
</varlistentry>

<varlistentry>
<term><menuchoice>
<guimenu>Calculator</guimenu><guimenuitem>Evaluate</guimenuitem>
</menuchoice></term>
<listitem><para>A radio button to set the <guilabel>Execution Mode</guilabel> to evaluation.</para></listitem>
</varlistentry>

</variablelist>
</chapter>

<chapter id="two-D-graphs">
<title>2D Graphs</title>
<para>To add a new 2D graph on &kalgebra;, select the <guilabel>2D
Graph</guilabel> tab and click the <guilabel>Add</guilabel> tab to add
a new function. Your focus will go to an input text box where you can
type your function.</para>

<sect1 id="two-D-syntax">
<title>Syntax</title>
<para>If you want to use a typical <function>f(x)</function> function it is not
necessary to specify it, but if you want a <function>f(y)</function> or a polar
function, you will have to add <literal>y-&gt;</literal> and <literal>q-&gt;</literal>
as the bounded variables.</para>

<para>Examples:</para>
<itemizedlist>
<listitem><para><userinput>sin(x)</userinput></para></listitem>
<listitem><para><userinput>x²</userinput></para></listitem>
<listitem><para><userinput>y->sin(y)</userinput></para></listitem>
<listitem><para><userinput>q->3*sin(7*q)</userinput></para></listitem>
<listitem><para><userinput>t->vector{sin t, t**2}</userinput></para></listitem>
</itemizedlist>
<para>If you have entered the function click on the <guibutton>OK</guibutton> button to display the graph in the main window.</para>

</sect1>

<sect1 id="two-D-features">
<title>Features</title>
<para>You can set several graphs on the same view. Just use the <guilabel>Add</guilabel> button when
you are in List mode. You can set each graph its own color.</para>

<para>The view can be zoomed and moved with the mouse. Using the wheel
you can zoom in and out. You can also select an area with the &LMB; and this
area will be zoomed in. Move the view with the keyboard arrow keys.</para>

<note>
 <para>The viewport of 2D graphs can be explicitly defined using the <guilabel>Viewport</guilabel> tab on a <guilabel>2D Graph</guilabel> tab.</para>
</note>
 
<para>In the <guilabel>List</guilabel> tab at the bottom right part, you can open an <guilabel>Editing</guilabel> tab to edit or remove a function with double-click and check or uncheck the check box next to the function name to show or hide it.</para>
<para>In the <guimenu>2D Graph</guimenu> menu you find these options:</para>
<itemizedlist>
<listitem><para><guimenuitem>Grid</guimenuitem>: Show or hide the grid</para></listitem>
<listitem><para><guimenuitem>Keep Aspect Ratio</guimenuitem>: Keep the aspect ratio while zooming</para></listitem>
<listitem><para><guimenuitem>Save</guimenuitem>: Save (<keycombo action="simul">&Ctrl;
<keycap>S</keycap></keycombo>) the graph as image file</para></listitem>
<listitem><para><guimenuitem>Zoom in/out</guimenuitem>: Zoom in (<keycombo action="simul">&Ctrl;
<keycap>+</keycap></keycombo>) and zoom out (<keycombo action="simul">&Ctrl;
<keycap>-</keycap></keycombo>)</para></listitem>
<listitem><para><guimenuitem>Actual Size</guimenuitem>: Reset the view to the original zoom</para></listitem>
<listitem><para><guilabel>Resolution</guilabel>: Followed by a list of radio buttons to select a resolution for the graphs</para></listitem>
</itemizedlist>

<para>
   Below is a screenshot of a user who's cursor is at the rightmost root
   of the function, <function>sin(1/x)</function>. The user who graphed
   it used very fine resolution to make this graph (as it oscillates at
   higher and higher frequency near the origin). There is also a live
   cursor feature where whenever you move your cursor over a spot, it
   shows you the <literal>x</literal> and <literal>y</literal> values in
   the bottom left corner of the screen. A live <quote>tangent line</quote>
   is plotted on the function at the live cursor location.
 </para>

<screenshot>
<screeninfo>Here's a screenshot of &kalgebra; 2D Graph window</screeninfo>
	<mediaobject>
	  <imageobject>
	    <imagedata fileref="kalgebra-2dgraph-window.png" format="PNG"/>
	  </imageobject>
	    <textobject>
	    <phrase>&kalgebra; 2D Graph window</phrase>
	  </textobject>
	</mediaobject>
</screenshot>


</sect1>

</chapter>

<chapter id="three-D-graphs">
<title>3D Graphs</title>

<para>To draw a 3D graph with &kalgebra; select the <guilabel>3D Graph</guilabel> tab
and you will see an input field at the bottom where you will type your function.
<literal>Z</literal> cannot be defined yet. For the moment &kalgebra; only supports
3D graphs explicitly dependent only on the <literal>x</literal> and <literal>y</literal>,
such as <userinput>(x,y)->x*y</userinput>, where <userinput>z=x*y</userinput>.
</para>

<para>Examples:</para>
<itemizedlist>
<listitem><para><userinput>(x,y)->sin(x)*sin(y)</userinput></para></listitem>
<listitem><para><userinput>(x,y)->x/y</userinput></para></listitem>
</itemizedlist>

<para>The view can be zoomed and moved with the mouse. Using the wheel
you can zoom in and out. Hold the &LMB; and move the mouse to rotate the graph.</para>

<para>The &Left; and &Right; arrow keys rotate the graph around the <literal>z</literal> axis, the &Up; and &Down; arrow keys rotate around the horizontal axis of the view. Press <keycap>W</keycap> to zoom in the plot and <keycap>S</keycap> to zoom it out.</para>

<para>In the <guimenu>3D Graph</guimenu> menu you find these options:</para>
<itemizedlist>
<!-- not in master for 4.11
<listitem><para>Enable or disable transparency in the 3D Graph menu</para></listitem>
-->
<listitem><para><guimenuitem>Save</guimenuitem>: Save (<keycombo action="simul">&Ctrl;
<keycap>S</keycap></keycombo>) the graph as image file or supported document</para></listitem>
<listitem><para><guimenuitem>Reset View</guimenuitem>: Reset the view to the original zoom in the <guimenu>3D Graph</guimenu> menu</para></listitem>
<listitem><para>You can draw the graphs with <guimenuitem>Dots</guimenuitem>, <guimenuitem>Lines</guimenuitem> or <guimenuitem>Solid</guimenuitem> styles in the <guimenu>3D Graph</guimenu> menu</para></listitem>
</itemizedlist>

<para>
Below is a screenshot of the so-called <quote>sombrero</quote> function. This particular
graph is shown using the 3D graph line-style.
</para>

<screenshot>
<screeninfo>Here's a screenshot of &kalgebra; 3D Graph window</screeninfo>
	<mediaobject>
	  <imageobject>
	    <imagedata fileref="kalgebra-3dgraph-window.png" format="PNG"/>
	  </imageobject>
	    <textobject>
	    <phrase>&kalgebra; 3D Graph window</phrase>
	  </textobject>
	</mediaobject>
</screenshot>

</chapter>

<chapter id="dictionary">
<title>Dictionary</title>

<para>
  The dictionary provides a list of all &kalgebra; built in functions. It can be
used to find the definition of an operation and its input parameters. It's a useful
place to go to find the many capabilities of &kalgebra;.
</para>

 <para>
   Below is a screenshot of the &kalgebra; dictionary lookup of the cosine function.
 </para>

<screenshot>
<screeninfo>Here's a screenshot of the &kalgebra; dictionary window</screeninfo>
	<mediaobject>
	  <imageobject>
	    <imagedata fileref="kalgebra-dictionary-window.png" format="PNG"/>
	  </imageobject>
	    <textobject>
	    <phrase>&kalgebra; dictionary window</phrase>
	  </textobject>
	</mediaobject>
</screenshot>


</chapter>

&commands;

<chapter id="credits">
<title>Credits and License</title>

<itemizedlist>
<listitem><para>Program copyright 2005-2009 &Aleix.Pol;</para>
</listitem>
</itemizedlist>

<para>
Documentation copyright 2007 &Aleix.Pol; &Aleix.Pol.mail;
</para>

<!-- TRANS:CREDIT_FOR_TRANSLATORS -->
&underFDL;               <!-- FDL: do not remove -->
&underGPL;        	 <!-- GPL License -->

</chapter>

&documentation.index;
</book>

<!--
Local Variables:
mode: sgml
sgml-minimize-attributes:nil
sgml-general-insert-case:lower
sgml-indent-step:0
sgml-indent-data:nil
End:
-->
