1: 

N = 100;
SUM = 0.0;
MULT = 1;

for i = 1:N;
SUM = SUM+i;
end

for i = 1:N;
MULT = MULT*i;
end

2: Lagrange polynominal

% initilization

x = [2,2.5,4];
fx = 1./x;

N = length(x);
fval = 0.0; % initialize the polynominal value at x0
x0 = 3;

for k = 1:N;

% for fixed k, calculate Lnk

LNK = 1;
for j = 1:N;

if (j ~= k)
LNK = LNK*(x0-x(j))/(x(k)-x(j));
end

end 

% sum Lnk*fx(k) to the fval
fval = fval+LNK*fx(k);

end 

Review of some operators

3: relational and logical operators

Operator     description

<             less than
<=            less than or equal to
>             greater than
>=            greater than or equal to
==            equal to
~             not equal to

&             and
|             or
~             not

4: arithmatic operations

operation             symbol           Example

addition                +                5+3
subtraction             -                23-12
multiplication          *                pi*0.85
division                / or \           56/8 = 8\56
power                  ^                 5^2

5: array operations

Illustrative data 
a = [a1 a2 ... aN],  b = [b1 b2 .... bN], c = {a scalar}

scalar addition            a+c = [a1+c a2+c .... aN+c]
scalar multiplication      a*c = [a1*c a2*c .... aN*c]
array addition             a+b = [a1+b1 a2+b2 .... aN+bN]
array multiplication       a.*b = [a1*b1 a2*b2 .... aN*bN]
array right division       a./b = [a1/b1 a2/b2 .... aN/bN]
array left division        a.\b = [a1\b1 a2\b2 .... aN\bN]
array powers               a.^c = [a1^c a2^c .... aN^c]
                           c.^a = [c^a1 c^a2 .... c^aN]
                           a.^b = [a1^b1 a2^b2 ... aN^bN]
