format long x = 0.6; f = @(x) cos(0.6); while (abs(f(x)-x) >= 10^(-10)) x = f(x); end L(1:4) = 1; X = [0.6 0.7 0.8 0.9]; ans = 0; for(i = 1 : 4) for(j = 1 : 4) if(i != j) L(i) = L(i) * (x-X(j))/(X(i)-X(j)); end end ans = ans + L(i)*f(X(i)); end x ans