
A = [];
A = [1 2 3; -1 2 4; 5 6 1]
# A =
#
# 1. 2. 3.
# -1. 2. 4.
# 5. 6. 1.
E = [3 4 -1; 2 7 0; 1 -2 -3]
# E =
#
# 3. 4. -1.
# 2. 7. 0.
# 1. -2. -3.
A + E
# ans =
#
# 4. 6. 2.
# 1. 9. 4.
# 6. 4. -2.
E - A
# ans =
#
# 2. 2. -4.
# 3. 5. -4.
# -4. -8. -4.
det(A)
# ans =
#
# -28.
inv(E)
# ans =
#
# 0.75 -0.5 -0.25
# -0.2142857 0.2857143 0.0714286
# 0.3928571 -0.3571429 -0.4642857
eye(2,2)
# ans =
#
# 1. 0.
# 0. 1.
zeros(3,3)
# ans =
#
# 0. 0. 0.
# 0. 0. 0.
# 0. 0. 0.
z = 3+4*%i
# z =
#
# 3. + 4.i
abs(z)
# ans =
#
# 5.
3 + imult(4)
# ans =
#
# 3. + 4.i
F = [1;-5; 6]
# F =
#
# 1.
# -5.
# 6.
roots(F)
# ans =
#
# 3. + 0.i
# 2. + 0.i
Fn+2 = Fn + Fn+1 이런 꼴의 수열을 피보나치 수열이라고 한다.
function y = Fibo(n)
> if n == 1 then y =1;
> elseif n == 2 then y = 1;
> else
> y1= 1; // first term
> y = 1; // second term
> for i = 1:n-2;
> y2 = y; // Earlier term of sequence
> y = y+y1; // New term of sequence
> y1 = y2; // store earlier term in memory
> end
> end
> endfunction
function y = rat(x)
y = (x^3-2*x^2+5*x)/(x^4+x^3-2*x-5)
endfunction
scf(0)
plot(0:0.01:5,rat)
function y = series(n)
y = 0;//initialization
for i =1:n
y = y+i^4
end
endfunction