Sunday, December 13, 2009
Saturday, December 5, 2009
Constants
- e -- the base of natural logarithms
- pi -- the ratio of the circumference of a circle to its diameter
- Inf, inf -- infinity (∞)
- true, false -- boolean or logical truth values
octave:36> e
ans = 2.7183
octave:37> pi
ans = 3.1416
octave:38> inf
ans = Inf
octave:39> Inf
ans = Inf
octave:40> zero
octave:40>error: `zero' undefined near line 40 column 1
true
ans = 1
octave:41> false
ans = 0
octave:42>
Well, off the topic, we made a new discovery, observe the commands 40, 40 and 41.
"What!! It shud have been 40,41,42 right??"
Yes, indeed, but it means that the line numbers are allotted only to "successful commands", and not the ones resulting in error..... :)
Assignment and variables
There is no limitation of length to variable names, and are case is sIGnIfiCaNt.
i.e.
octave:30> apple=10;
octave:31> ApplE=90;
octave:32> apple + ApplE
ans = 100
In Octave a variable can take many different types of values; for example, it can take a numerical (real or complex) value, it can be a vector, or a matrix, or it can be a string (that is, a sequence of symbols).
A string is always placed between quote signs "..." so that Octave will know when the string starts and when it ends. The same variable can, at different times, hold each of these values. Lets see:
octave:34> first = "second"
first = second
octave:35> first
first = second
Friday, December 4, 2009
Elementary Mathematics
Ok, lets pitch up with some basic calcs :
Oh yes, the octave:> thingy is the "prompt"....
octave:> 1 +1
ans = 2
octave:> 1+100;
octave:>
"Hey, hey hey .... hold your cats right there bro. Ok that 1+1 printed the ans as 2, but what about that 1 +100 calculation?? It didnt print... oh !! bugs right??"
Okay,
We may prevent octave from outputting results to the terminal by appending our commands with the semicolon “;”.
and if you want the results of your command to display ,do not append your command with a semicolon .
So going forward , we may try out some combinations like :
octave:21> 2 * 3
ans = 6
octave:22> 9 - 45
ans = -36
octave:23> 67 * 20
ans = 1340
octave:24> 23 ^ 15
ans = 2.6664e+20
octave:25>
Oh, those :21, :22s are the command numbers actually :):) ( i guess so :) )
Starting and Exiting Octave
Installing Octave
On a Fedora machine powered with Internet,just like the one I have, log into terminal (... hmmm.. the command prompt for Linux...eh !! ), sudo using the command
> su
followed by your password,
> yum -y install qtoctave
.. ta da... !!
you will have octave as well as its GUI named QTOctave available for exploring.
Hmmm... I should have placed a post regarding yum, Synaptic Package manager, and building of .tar files... but then why is Internet for??.... ha ha !!