%% Script Eg1_1
%% Spherical Surface Area Increase
% The surface area of a sphere having radius r is given by A(r) = 4 \pi r^{2}.  How does the surface area increase given a tiny increase \delta r in in the radius?
% \delta A = 4\pi(r+\delta r)^{2} \;-\; 4 \pi r^{2}\\
% \delta A = 4\pi(2r + \delta r)\cdot \delta r\\
% \delta A = 8\pi r \cdot \delta r
% The first two formulae are exact, the third is an approximation that ignores the (\delta r)^{2} term.
% Acquire and display the input data...

r = 3600% radius in kilometers
fprintf('Sphere radius   = %12.6f kilometers\n',r)
delta_r = 2% increase in millimeters
fprintf('Radius increase = %12.6f millimeters\n\n',delta_r)

% Convert from millimeters to meters...

dr = delta_r/10^6;

% Determine surface area increase...
%% Method 1

delta_A1 = (4*pi*(r + dr)^2 -  4*pi*r^2)*10^6;
fprintf('\n   Method 1: %15.6f square meters\n',delta_A1)

%% Method 2

delta_A2 = (4*pi*(2*r + dr)*dr)*10^6;
fprintf('   Method 2: %15.6f square meters\n',delta_A2)

%% Method 3

delta_A3 = (8*pi*r*dr)*10^6;
fprintf('   Method 3: %15.6f square meters\n',delta_A3)