function [ t_star ] = part2( s ) %Project2_part2 %total arc length if s ==0 s=1e-14; end tal = 2.495246747533084; % = TOL = 1e-10; %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-5; 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 t_star=(a+b)/2; %new midpoint is best estimate Arc_length_over_partial = adapquad(f_t,0,t_star,tol)/tal; t_star; s; end