۲۹۰
function a(n)
a = (1 + 1/n)^n
end function
function convergent(tol, max.no.iterations)
do
count 1
term = a(count)
next.term = a(count + 1)
conv = abs(term-next.term) < tol
print count; term, conv
term = next.term
count
loop until
if conv
count + 1
count > max.no.iterations or conv
then
limit = next.term
print "possibly the limit is"; limit
else
print "nothing so far suggests convergence"
end if
convergent = conv
end function
input tol, m
a = convergent(tol, m ) end
? .01,20
1
2
0
2.25
2.37037
3456789
2.441406 0
2.48832 0
2.521626 0
2.5465
0
2.565785 0
2.581175 0
ج٢ ص٢٩٠