Getting started with KAlgebra: Difference between revisions

From KDE UserBase Wiki
No edit summary
No edit summary
Line 8: Line 8:


:<pre>
:<pre>
::2+2  
===
::'''2+2''' ===
 
</pre>
</pre>
<br>  
===  ===
Then type Return and KAlgebra will show you the result. So far it's easy.  
 
However, KAlgebra is much more powerful than that, it started as a simple calculator, but now it's almost a CAS. You can define variables this way:  
 
<br> Then type Return and KAlgebra will show you the result. So far it's easy. However, KAlgebra is much more powerful than that, it started as a simple calculator, but now it's almost a CAS. You can define variables this way:  
 
:<pre>
:<pre>
::k:=3  
===
::'''k:=3 '''
===
 
</pre>
</pre>
<br>  
===  ===
And use them normally:  
 
 
<br> And use them normally:  
 
:<pre>
:<pre>
::k*4  
===
::'''k*4 '''
===
 
</pre>
</pre>
<br>  
===  ===
And that will give you the result: 12 You can also define functions:  
 
 
<br> And that will give you the result: 12 You can also define functions:  
 
:<pre>
:<pre>
::f:=x-&gt;x^2  
==
::'''f:=x-&gt;x^2 '''
==
 
</pre>
</pre>
<br>  
 
And then use them:  
<br> And then use them:  
 
:<pre>
:<pre>
::f(3)  
===
::'''f(3) '''
===
 
</pre>
</pre>
<br>  
 
Which should return 9. You can define a function with as many variables as you want:  
<br> Which should return 9. You can define a function with as many variables as you want:  
 
:<pre>
:<pre>
::g:=(x,y)-&gt;x*y  
===
::'''g:=(x,y)-&gt;x*y '''
===
 
</pre>
</pre>
<br>  
 
The possibilities of defining functions are endless if you combine this withe the piecewise. Let's define the factor function:  
<br> The possibilities of defining functions are endless if you combine this withe the piecewise. Let's define the factor function:  
 
::fact:=n-&gt;piecewise { n=0&nbsp;? 1, n=1&nbsp;? 1,&nbsp;? n*fact(n-1) }
::fact:=n-&gt;piecewise { n=0&nbsp;? 1, n=1&nbsp;? 1,&nbsp;? n*fact(n-1) }
Yes! KAlgebra supports recursive functions. Give some values to n, to test it.  
Yes! KAlgebra supports recursive functions. Give some values to n, to test it.  
:<pre>
:<pre>
::fact(5)  
===
<br>
::'''fact(5)  
''' ===
 
</pre>
 
&lt;br&gt;
 
::fact(3)
::fact(3)
</pre>
 
<br>
<br> KAlgebra has recently started support for symbolic operations, to check it out, just type:  
KAlgebra has recently started support for symbolic operations, to check it out, just type:  
 
:<pre>
:<pre>
===
::x+x+x+x  
::x+x+x+x  
===
</pre>
</pre>
<br>  
 
or
<br> or
 
:<pre>
:<pre>
===
::x*x  
::x*x  
===
</pre>
</pre>
<br>  
 
It doesn't work on some complex structures, though. Only basic support so far.  
<br> It doesn't work on some complex structures, though. Only basic support so far. Moreover, KAlgebra has support for differentiation. An example of the syntax:  
Moreover, KAlgebra has support for differentiation. An example of the syntax:  
 
:<pre>
:<pre>
===
::diff(x^2:x)  
::diff(x^2:x)  
===
</pre>
</pre>
<br>  
 
If you have used KAlgebra, you will have noticed the syntax completion support, which is very helpful.  
<br> If you have used KAlgebra, you will have noticed the syntax completion support, which is very helpful. Another resource that can be useful to learn more about KAlgebra comes with KAlgebra: The Dictionary tab It contains examples of every function supported by KAlgebra. Maybe the best way to learn how to do things with KAlgebra.  
Another resource that can be useful to learn more about KAlgebra comes with KAlgebra: The Dictionary tab  
 
It contains examples of every function supported by KAlgebra. Maybe the best way to learn how to do things with KAlgebra.  
[[Category:Education]]
[[Category:Education]]

Revision as of 16:00, 9 April 2010

KAlgebra is a calculator with symbolic and analysis features that lets you plot 2D and 3D functions as well as to easily calculate mathematical expressions.

The Console Tab

When you first open KAlgebra a blank window shows up, this is the main work area for calculus.

Let's get started with a little example of how KAlgebra works, just type:

===

'''2+2''' ===


Then type Return and KAlgebra will show you the result. So far it's easy. However, KAlgebra is much more powerful than that, it started as a simple calculator, but now it's almost a CAS. You can define variables this way:

===

'''k:=3 '''
===


And use them normally:

===

'''k*4 '''
===


And that will give you the result: 12 You can also define functions:

==

'''f:=x->x^2 '''
==


And then use them:

===

'''f(3) '''
===


Which should return 9. You can define a function with as many variables as you want:

===

'''g:=(x,y)->x*y '''
===


The possibilities of defining functions are endless if you combine this withe the piecewise. Let's define the factor function:

fact:=n->piecewise { n=0 ? 1, n=1 ? 1, ? n*fact(n-1) }

Yes! KAlgebra supports recursive functions. Give some values to n, to test it.

===

'''fact(5)

''' ===

<br>

fact(3)


KAlgebra has recently started support for symbolic operations, to check it out, just type:

===

x+x+x+x
===


or

===

x*x
===


It doesn't work on some complex structures, though. Only basic support so far. Moreover, KAlgebra has support for differentiation. An example of the syntax:

===

diff(x^2:x)
===


If you have used KAlgebra, you will have noticed the syntax completion support, which is very helpful. Another resource that can be useful to learn more about KAlgebra comes with KAlgebra: The Dictionary tab It contains examples of every function supported by KAlgebra. Maybe the best way to learn how to do things with KAlgebra.