... hàm f(x) = x3‐10x2 + 5 ta dùng chương trìnhctsecant.mclearall,clcf=inline(ʹx.^3‐10*x.^2+ 5 );[x,ss,xx]=secant(f,0 .5, 1,1e‐4, 50 )§7.PHƯƠNGPHÁPBRENT ... 259 P=Q;Y=feval(f,P);endifabs(p‐P(3))<abs(p‐P(2))R=[P(1)P(3)P(2)];P=R;Y=feval(f,P);end%cactritinhlanmoiP(3)=p;Y(3)=feval(f,P(3));y=Y(3);%dieukiendunglaperr=abs(z);relerr=err/(abs(p)+delta);if(err<delta)|(relerr<delta)|(abs(y)<eps)breakendendĐểgiảiphươngtrìnhsin(x)‐0 .5* x=0tadùng chương trìnhctmuller.mclearall,clcformatlongf=inline(ʹsin(x)‐0 .5* xʹ);x=muller(f,1.8,2.2, 50 )§10.PHƯƠNGPHÁPHALLEYPhéplặpNewtontìmnghiệmcủahàmphươngtrìnhx=g(x)là:′f(x)g(x)=x‐f(x)(1)Tốcđộhộitụtăngđángkểkhihàmcónghiệm ... ,xn)gầnvớinghiệm.Taxâydựnghàmnew4sys()đểthựchiệnthuậttoánnàyfunction[P,iter,err]=new4sys(f,jf,P,max1)%vao‐FlaheptluutrongM‐filef.m%‐JFlamatranjacobiluutrongM‐filejf.m%‐Pvectonghiembandau%‐max1solanlapcucdai%ra‐Plavetonghiem%‐itersolanlapthucte%‐errsaisoY=f(P);fork=1:max1J=jf(P);Q=P‐(J\Yʹ)ʹ;Z=f(Q);err=norm(Q‐P);relerr=err/(norm(Q)+eps);P=Q;Y=Z;iter=k;if(err<eps)|(relerr<eps)|(abs(Y)<eps)breakendend 2 65 Đểgiảihệphươngtrình:22xxy202xy y 3 0⎧+−=⎪⎨+−=⎪⎩tadùng chương trìnhctnew4sys.mclearall,clc formatlong p=[ .5, .5] ; [n,ll,ss]=new4sys(@f,@jf,p, 50 )Nộidungcủaf.m:functionf=f(p)f=[(p(1)^2+p(1)*p(2)‐2),(2*p(1)*p(2)+p(2)^2‐3)];Nộidungcủajf.m:functionjf=jf(p)jf=[(2*p(1)+p(2))p(1)(2*p(1))(2*p(1)+2*p(2))];Tacóthểdùnghàmnew4sys2()đểthựchiệnthuậttoán:functionroot=new4sys2(func,x,maxiter)%PhuongphapNewton‐Raphsondetimnghiem%cuaheptfi(x1,x2,...