Mã:
Clear[f, a, b, c, e, x, q, Epxilon];
φ[x_] = Input["Nhap φ(x)"];
a = Input["Nhap a"];
b = Input["Nhap b"];
Epxilon = Input["Nhap vao sai so gan dung Epxilon"]; 
Print["Giai phuong trinh"];
Print["x = ", φ[x]];
Print["Khoang cach li nghiem [", a, ",", b, "]"];
Print["Sai so gan dung Epxilon = ", Epxilon];
(*Phuong phap lap*)
φ1[x_] = D[φ[x], x];
ϵ = 1;
x = (a + b)/2;
t = True;
While[ϵ > Epxilon && t == True,
    	x0 = x;
    	x = φ[x];
    	q = φ1[x];
    	If[x < a || x > b || Abs[q] <= 0 || Abs[q] >= 1, 
      		t = False;
      	];	
    	ϵ = Abs[x - x0]Abs[q /(1 - q)];
    ];
If[t == False,
    		Print["φ[x] khong hoi tu"];
    	,
    		Print["Nghiem x = ", N[x]];
    ];