|
Online-Utility.org
Utilities for Online Operating System
|
|
Small tutorial for online access to Octave
More information at :
Octave
main page at gnu.org
First steps
You are allowed to type your formulae and calculation program in text
area provided.
Try with something simple i.e. type 3/7 inside it and click "GO".
If you put ; after your commands you will not get the answer for that
command. The output of the preceding command will be suppresed , try :
x = 2+3
y= x * 5;
z=x^y
you should get the result as :
octave> x = 2+3
x = 5
octave> y= x * 5;
octave> z=x^y
z = 2.9802e+17
You are allowed to use standard math constants like pi, e, true, false,
etc. in your formulaes.
If you need more decimal digits (more significancy) for the output try
to put
format long.
If you just need two decimal digits of your computation put
format bank in the given
text area.
Matrices and arrays
You can declare them as follows :
octave> b = [ 3; 5; 1 ]
b =
3
5
1
octave> A = [ 1, 1, 2; 3, 5, 8; 13, 21, 34 ]
A =
1 1 2
3 5 8
13 21 34
To calculate transpose of the matrix by using ' operator like A' :
octave> A'
ans =
1 3 13
1 5 21
2 8 34
Linear equation
To solve the set of linear equations a
x
= b
,
use the left division operator, `\':
A \ b
The code above will produce in output the solvation of the linear
equation
octave> A / b
ans =
0.28571
1.20000
5.08571
Complex numbers
To specify complex constants, you can write an expression of the form
3 + 4i
3.0 + 4.0i
0.3e1 + 40e-1i
Squares and square roots
^ is operator for calculating squares, and sqrt for calculate square
root, i.e. you can use :
sqrt (x^2 + y^2)
to check Pitagoras theorem :)
More operators and functions
You can use C style comparison operators like ==, <, <=, <>
(this is not C style operator) and symilar. Try some of them.
Also C style incremental operators are supported : ++ and --. x++
means x=x+1
ceil (
x)
returns the smallest
integer not
less than
x.
exp (
x)
- Compute the exponential
of
x
gcd (
a1, ...
)
-
compute the greatest common divisor
log (
x)
- Compute the natural logarithm
for each element of
x
sign (
x)
- Compute the
signum
function
Trigonometry functions like cos, sin, tan, cos, acos, atan are
supported.
Hyperbolic functions like tanh, cosh, sinh, atanh, asech are supported.
For multiplying two polynoms use
conv (
a, b)
- Convolve
two vectors
For deviding two polynoms use
deconv (
y, a)
- Deconvolve
two vectors
roots (
v) - finds root of polynomial
polyout (
c, x)
- Write formatted
polynomial
c(x) = c(1) * x^n + ... + c(n) x + c(n+1)
More info
For more information about topics above and about differential equations,
optimization (linear, nelinear programming), statistics, financial
functions and more consult
Octave
manual at GNU.org