%Project2_part2 %total arc length tal = 2.495246747676093; % Total arc length TOL = 1e-3; s = input('input the fraction of the curve you would like to know the time value for: '); % Bisection Method % Predefine the begining values for a and b a=0; b=1; tol=1e-6; fa = adapquad(f_t,0,a,tol) - s*tal; fb = adapquad(f_t,0,b,tol) - s*tal; %function t_star = bisect(f,a,b,tol) if sign(fa)*sign(fb) >= 0 error('f(a)f(b)<0 not satisfied!') %ceases execution end fa=adapquad(f_t,0,a,tol) - s*tal; fb=adapquad(f_t,0,b,tol) - s*tal; while (b-a)/2>tol c=(a+b)/2; fc=adapquad(f_t,0,c,tol) - s*tal; if fc == 0 %c is a solution, done break end if sign(fc)*sign(fa)<0 %a and c make the new interval b=c;fb=fc; else %c and b make the new interval a=c;fa=fc; end end time=(a+b)/2; %new midpoint is best estimate Arc_length = adapquad(f_t,0,time,tol) Arc_length_over_total = adapquad(f_t,0,time,tol)/tal time