Question: For part A, do not use NewtonRoot, instead, use BisectionRoot that I have provided below. Please alter the code which can solve this particular problem.


For part A, do not use NewtonRoot, instead, use BisectionRoot that I have provided below.
Please alter the code which can solve this particular problem.
function Xs=BisectionRoot(fun,a,b)
% fun is an anonymous function % a and b are the range over which the solution Xs exists iter=0; maxiter=1000; % quit after 1000 iterations tol=1e-6; % convergence criterion fa=fun(a); fb=fun(b); if fa*fb>0 Xs=xNS; disp('Error: no solution over interval',xNS) else toli=tol+1; % ensure we enter loop while toli>tol xNS=(a+b)/2; % Bisection % xNS=(a*fb-b*fa)/(fb-fa); % Regula Falsi fxNS=fun(xNS); fprintf('iter %4i, x=%6.5f, f(x)=%9.2e ',iter,xNS,fxNS) if fxNS==0 disp('exact solution found') Xs=xNS; break elseif fa*fxNSmaxiter fprintf('did not converge in %i iterations ',iter) Xs=xNS break end end fprintf('solution is x = %f ',xNS) Xs=xNS; end
3.33 According to Archimedes' principle, the buoyancy force acting on an object that is partially immersed in a fluid is equal to the weight that is displaced by the portion of the object that is submerged. A spherical float with a mass ofm 70kg and a diameter of90 cm is placed in the ocean (density of sea water is approximately p 1030 kg/m3. The height, h, of the portion of the float that is above water can be determined by solving an equation that equates the mass of the float to the mass of the water that is displaced by the portion of the float that is submerged: (3.59) where, for a sphere of radius r, the volume of a cap of depth d is given by d) Write Eq. (3.59) in terms of h and solve for h
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
