%% Approximates the Arc Length of the curve y = sqrt(16-4x^2} %% on the interval [0,1]. clc format compact format short a=0, b=1, n=10, dx1=(b-a)/n x1=linspace(a,b,n+1) % Break up the interval into n=10 parts y1=2*sqrt(4-x1.^2) % Determines the height at each point x1 dist1 = sqrt(diff(x1).^2+diff(y1).^2) % Computes distances between points format long g arclength1 = sum(dist1) % sums the distances % Alternate method using ds=sqrt(1+(dy/dx)^2)dx, % Where dy/dx = (-2x)/(sqrt(4-x^2)), and ds = sqrt((4+3x^2)/(4-x^2)) format short ds = sqrt((4+3*x1.^2)./(4-x1.^2)) format long g otherarclength1 = dx1*(sum(ds)-(ds(1)+ds(end))/2) abs(arclength1-otherarclength1) exact = 1.1706509330085367745 % The exact answer (to 9 decimals) using elliptic integrals.