GNU Octave, version 2.0.16 (i386-pc-linux-gnu).
Copyright (C) 1996, 1997, 1998, 1999, 2000 John W. Eaton.
This is free software with ABSOLUTELY NO WARRANTY.
For details, type `warranty'.
octave> x=2
x = 2
octave> x
x = 2
octave> x;
octave> x=[1 2 3]
x =
1 2 3
octave> x'
ans =
1
2
3
octave> A=[1 2 3; 4 5 6; 7 8 9]
A =
1 2 3
4 5 6
7 8 9
octave> A'
ans =
1 4 7
2 5 8
3 6 9
octave> A=rand(3)
A =
0.188427 0.506368 0.499963
0.055391 0.977490 0.342723
0.735019 0.301271 0.725313
octave> b=rand(3,1)
b =
0.083430
0.774729
0.539715
octave> x=inv(A)*b
x =
2.2191
1.3980
-2.0854
octave> A\b
ans =
2.2191
1.3980
-2.0854
octave> A*x-b
ans =
-1.9429e-16
-3.3307e-16
-1.1102e-16
octave> v=[1 2 3]'
v =
1
2
3
octave> v+1
ans =
2
3
4
octave> v*3
ans =
3
6
9
octave> sum(v)
ans = 6
octave> sum(A)
ans =
0.97884 1.78513 1.56800
octave> sum(sum(A))
ans = 4.3320
octave> 1:3
ans =
1 2 3
octave> ones(3,1)
ans =
1
1
1
octave> A=ones(3,1)*(1:3)
A =
1 2 3
1 2 3
1 2 3
octave> A .* A'
ans =
1 2 3
2 4 6
3 6 9
octave> rem(A,A')
ans =
0 0 0
1 0 1
1 2 0
octave> rem(A,A')==0
ans =
1 1 1
0 1 0
0 0 1
octave> sum(rem(A,A')==0)
ans =
1 2 2
octave> sum(rem(A,A')==0)==2
ans =
0 1 1
octave> find(sum(rem(A,A')==0)==2)
ans =
2 3
octave> A=ones(100,1)*(1:100);
octave> find(sum(rem(A,A')==0)==2)
ans =
Columns 1 through 16:
2 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53
Columns 17 through 25:
59 61 67 71 73 79 83 89 97
octave> x
x =
2.2191
1.3980
-2.0854
octave> x' * x
ans = 11.227
octave> x * x'
ans =
4.9244 3.1022 -4.6276
3.1022 1.9543 -2.9153
-4.6276 -2.9153 4.3487
octave> x .* x
ans =
4.9244
1.9543
4.3487
octave> for i=1:10; v(i)=i*i; end
octave> v
v =
1
4
9
16
25
36
49
64
81
100
octave> B = [1 2 3; 4 5 6; 7 8 9]
B =
1 2 3
4 5 6
7 8 9
octave> B(1,1)
ans = 1
octave> B(3,3)
ans = 9
octave> rows(B)
ans = 3
octave> columns(B)
ans = 3
octave> x
x =
2.2191
1.3980
-2.0854
octave> rows(x)
ans = 3
octave> columns(x)
ans = 1
octave> x=1:100;
octave> plot(x,x.*x)
octave>