As a Calculator
The easiest way to get started, is to use Octave as a calculator.
At the bottom of the terminal there is a command prompt >>
followed by an input bar, this is where you enter the commands. After entering
a command you press enter and the output will appear above the input bar. You can view the commands
you have written in the Command List.

The arithmetic operators are:
+ - * / ^(to the power of) There are predefined constants in Octave, some of them are listed below:
pi,e,iInf(infinity)
NaN(not a number)
- Make a wild guess!
- Operations yielding numbers larger than the maximum
floating point will give this answer - Operations that can not be defined in any reasonably
way will give this answer
There are also a number of predefined mathematical functions in Octave, some of them are listed below:
sin, cos, tanasin, acos, atanexp, log, log10
sqrtabsround, floor, ceilrem
- Trigonometric functions in radians
- Inverse trigonometric functions
- Exponential function, natural logarithm, logarithm to
the base 10 - Square root
- Absolute value
- Round to nearest integer, round down, round up
- Remainder when doing integer division
Showing more decimals
You can show more decimals by typing format long. Go back to showing
few decimals by typing format short.
Exercise 1
Calculate following expressions
ans = 2.8854ans = 0.0066932ans = 1.4819
Exercise 2
Guess the output of following commands, then check the answers given by Octave
1/0 0/0 tan(pi/2)inf+inf inf-inf inf/inf inf*infnan+2 nan+nan
by Malin Christersson under a Creative Commons Attribution-Noncommercial-Share Alike 2.5 Sweden License


