(%i1) load(functs);
(%i2)
wa(M):=nusum(k^2,k,1,M);
(%i3)
wa(10);
(%i4)
wa(M);
(%i5)
yak(A):=divisors(A);
(%i6)
yak(100);
(%i7)
trap(f,a,b,n):=block(
f(x):=f,
return(float((b-a)/n/2*(a+b+2*nusum(subst((b-a)/n*k,x,f(x)),k,0,n-1))))
);
(%i8)
for n:1 thru 10 do print(trap(x^2,0,1,n));
(%i9)
bs(f,a,b,r):=block(
f(x):=f,
c:a,
for i:1 while abs(subst(c,x,f(x)))>r do(
c:(a+b)/2,
if subst(c,x,f(x))=0 then return(float(c)),
if (subst(a,x,f(x)))*(subst(c,x,f(x)))<0 then b:c
else a:c
),
return(float(c))
);
(%i10)
for i:0 thru -10 step -1 do print(bs(x^2-2,1,2,10^i));