% script calculating and plotting a(n)=(1+1/n)^n, n>0
% N.B. e=exp(1)= limit as n goes to infinity of a(n)
clear % clear all variables already defined
close all % close all the windows with graphs
n=[1:1000]; % we will evaluate a(n) for n from 1 to 1000, so we take
% an array of length 1000
a=(1+1./n).^n; % in another array of length 1000 we store a(n)
% in position n
plot(a,'o') %we plot it
hold on %we say we want to plot again on the same graph
plot([1 1000],[exp(1) exp(1)],'r-') % plot the line y=e
