restart; # Using continued fractions to approximate sqrt(3); Digits:=30; x:=sqrt(3.0); x1:=1/(x-1); x2:=1/(x1-1); x3:=1/(x2-2); # The pattern repeats and is [1,1,2,1,2,1,...] r1:=1; r2:=1+1/1; r3:=1+1/(1+1/2); r4:=1+1/(1+1/(2+1/1)); r5:=1+1/(1+1/(2+1/(1+1/2))); evalf([r1,r2,r3,r4,r5]); # These fractions alternate too big and then too small restart; # Using Newton's method to approximate sqrt(3) f:=x->x^2-3; phi:=unapply(x-f(x)/D(f)(x),x); x1:=phi(1); x2:=phi(x1); x3:=phi(x2); x4:=phi(x3); evalf([x1,x2,x3,x4]); sqrt(3.0); evalf([x1-sqrt(3),x2-sqrt(3),x3-sqrt(3),x4-sqrt(3)]); # These fractions are all larger than sqrt(3) restart; # Using the Taylor series to approximate sqrt(3) S:=n->Sum(binomial(alpha,k)*x^k,k=0..n); alpha:=-1/2; x:=-2/3; r1:=value(S(1)); r2:=value(S(2)); r3:=value(S(3)); r4:=value(S(4)); r10:=value(S(10)); evalf([r1,r2,r3,r4,r10]); # These fractions are all smaller than sqrt(3)