function GalerkinovaMetoda(n)

x = 0:0.01:1;
u = -0.5*x.^2;

A = zeros(n,n);
b = zeros(n,1);
for i=1:n
    for j=1:n
        A(i,j) = i*j/(i+j-1);
    end
    b(i) = -i/(i+1);
end
alfa = A\b;
cond(A)

un = x; un(:) = 0;
for j=1:n
    un = un + alfa(j)*x.^j;
end

plot(x,u,'r',x,un,'b')