Forpersonaluseonlyinstudyandresearch;notforcommercialuse薃1.秦九韶算法膅利用秦九韶算法简化求多项式1110nnnnxaxayxaa的值的运算式,并写程序计算多项式42352xyxx在1x点处的值。艿1.2秦九韶算法简化多项式芇计算多项式1110nnnnxaxayxaa的值:莅1.直接计算iixa,逐项相加,共需要加法和乘法的次数为n次、2)1(nn次;袃2.用秦九韶算法简化,则y=(…0121)...))(axaxaxaxannn,从内到外逐步计算一次多项式的值,共需要加法和乘法的次数各为n次。荿2.牛顿法及基于牛顿算法下的Steffensen加速法蚇分别用牛顿法,及基于牛顿算法下的Steffensen加速法(1)(2)肇求ln(x+sinx)=0的根。初值x0分别取0.1,1,1.5,2,4进行计算。(3)(4)蚂求sinx=0的根。初值x0分别取1,1.4,1.6,1.8,3进行计算。葿分析其中遇到的现象与问题。肈2.1问题分析蒅牛顿法是一种迭代法,是求方程根的重要方法之一,通过使用函数f(x)在近似根0x附近的一阶泰勒多项式近似表示来寻找方程的根,在方程f(x)=0的单根附近具有平方收敛。其迭代公式为:蒁Steffensen加速法公式:蕿2.2求ln(x+sinx)=0的根葿2.2.2Steffensen加速法膇2.2.3结果及分析蒄初值蚈牛顿法结果(循环次数)薆Steffensen加速法结果(循环次数)蚅0.1芃0.94(7)螈-2.6羇0.2莇0.94(6)肂0.94(5)肂0.5莈0.94(4)袅0.94(3)肅1膂0.94(6)蝿0.94(5)薇1.5袄溢出节1.5膀2羄溢出薂2莂4莆溢出螆4莁(误差限为20e)蒂2.3求sinx=0的根螇2.3.1牛顿法膄2.3.2Steffensen加速法莄2.3.3结果及分析蒂初值膈牛顿法结果(循环次数)袆Steffensen加速法结果(循环次数)膃1薁溢出蕿0莄1.4羂3.14(7)蚁-3.1(4)蚆1.6肆31.58965(8)蚁25.(6)螁1.8肇6.283(4)蒄6.7(3)螄3袁3.330048(3)蒈3.4(3)芆3.数值积分蒃(1)实际验证梯形求积公式、Simpson求积公式、Newton-Cotes求积公式的代数精度。羁(2)针对下述三个函数和积分区间[a,b],实验观察梯形求积公式、Simpson求积公式和Newton-Cotes求积公式的复化求积公式的实际计算效果。衿y=exp(-x.^2).*sin(10*x)+4;a=1;b=3;蚃y=sin(5*x)./x.^3;a=2*pi;b=4*pi;芁y=sin(5*x)./x.^3;a=2*pi;b=9.4248;肁复化梯形求积公式:艿复化Simpson求积公式:莅复化Cotes求积公式:芄3.2.1函数一肁y=exp(-x.^2).*sin(10*x)+4;a=1;b=3;莆区间分段数n膇肃膁螇10薅7.4袂7.102芀7.1335膈50芇7.9蚁7.200莀7.2801蕿100螅7.1蚄7.338蒀7.2794螆500蒇7.6蒃7.278薀7.2794膇1000羅7.9膂7.279蚀……薈……蚆……芅……蚀……羈10000肄7.2羃7.279螀……荿3.2.2函数二螆y=sin(5*x)./x.^3;a=2*pi;b=4*pi;螂区间分段数n袀蒆芄薁10罿/袇0.00006羆0.0003薄50聿0.00045芈0.00049蒄0.0005莃100腿0.00023虿0.000103膆0.00048肂500腿0.00095肀0.000878薃0.0005115膅1000艿0.0009芇0.000534莅……袃……荿……蚇……肇……蚂10000葿0.00049肈0.0005115蒅……蒁3.2.3函数三蕿y=sin(5*x)./x.^3;a=2*pi;b=9.4248;葿图3.3.3膇区间分段数n蒄蚈薆蚅10芃0.000810435螈0.001036687羇0.00莇50肂0.00肂0.005莈0.001524袅100肅0.005膂0.00蝿0.001571薇500袄0.005节0.00膀……羄1000薂0.0025莂0.00莆……螆……莁……蒂……螇……膄10000莄0.0001蒂0.001571膈……袆附录膃1.#includeiostream薁usingnamespacestd;蕿voidmain()莄{inta[5]={-2,-1,5,0,3};羂intx,y,k,t=3;蚁coutx=;蚆cinx;肆for(k=3;k=0;k--)蚁{t=x*t+a[k];螁y=t;}肇couty=yendl;}蒄2.-1-(1)牛顿法螄#includeiostream.h袁#includestdio.h蒈#includemath.h芆voidmain()蒃{longdoublex0,x,n=0,w,t;羁cout初始值x0=;衿cinx0;蚃w=exp(-6);芁while(fabs(x-x0)w)肁{x=x0;艿t=(1+cos(x0))/(x0+sin(x0));莅x0-=log(x0+sin(x0))/t;芄n+=1;}肁cout一共循环n次endl;莆cout.precision(10);膇cout解得x=x0endl;}肃2-1-(2)膁#includeiostream.h螇#includestdio.h薅#includemath.h袂voidmain()芀{longdoublex0,x,n=0,w,y,z;膈cout初始值x0=;芇cinx0;蚁w=exp(-20);莀while(fabs(x-x0)w)蕿{x=x0;螅y=x0-(x0+sin(x0))*log(x0+sin(x0))/(1+cos(x0));蚄z=y-(y+sin(y))*log(y+sin(y))/(1+cos(y));蒀x0-=(y-x0)*(y-x0)/(z-2*y+x0);螆n+=1;}蒇cout一共循环n次endl;蒃cout.precision(10);薀cout解得x=xendl;}膇2-2-(1)牛顿法羅#includeiostream.h膂#includestdio.h蚀#includemath.h薈voidmain()蚆{longdoublex0,x,n=0,w;芅cout初始值x0=;蚀cinx0;羈w=exp(-18);肄while(fabs(x-x0)w)羃{x=x0;螀x0-=sin(x0)/cos(x0);荿n+=1;}螆cout一共循环n次endl;螂cout.precision(15);袀cout解得x=xendl;}蒆2-2-(2)芄#includeiostream.h薁#includestdio.h罿#includemath.h袇voidmain()羆{longdoublex0,x,n=0,w,y,z;薄cout初始值x0=;聿cinx0;芈w=exp(-18);蒄while(fabs(x-x0)w)莃{x=x0;腿y=x0-sin(x0)/cos(x0);虿z=y-sin(y)/cos(y);膆x0-=(y-x0)*(y-x0)/(z-2*y+x0);肂n+=1;}腿cout一共循环n次endl;肀cout.precision(10);薃cout解得x=xendl;}膅3-1-1艿#includeiostream.h芇#includestdio.h莅#includemath.h袃voidmain()荿{longdoublea=1,b=3,h,x=1,T1=0,T;蚇intn=50,k;肇h=(b-a)/n;蚂T=exp(-a*a)*sin(10*a)+4+exp(-b*b)*sin(10*b)+4;葿for(k=1;kn;k++)肈{x+=h;蒅T1+=exp(-x*x)*sin(10*x)+4;蒁coutT1endl;}蕿T=(T+2*T1)*h/2;cout.precision(10);cout运用复化梯形公式求解得Tendl;}3-1-2#includeiostream.h#includestdio.h#includemath.hvoidmain(){longdoublea=1,b=3,h,x1,x2,S1=0,S2,S;intk,n=20;h=(b-a)/n;x1=a;x2=a+h/2;S=exp(-a*a)*sin(10*a)+4+exp(-b*b)*sin(10*b)+4;S2=exp(-x2*x2)*sin(10*x2)+4;for(k=1;kn;k++){x1+=h;x2+=h;S1+=exp(-x1*x1)*sin(10*x1)+4;S2+=exp(-x2*x2)*sin(10*x2)+4;}S=(S+2*S1+4*S2)*h/6;cout.precision(15);cout运用复化Simpson公式求解得Sendl;}3-1-3#includeiostream.h#includestdio.h#includemath.hvoidmain(){longdoublea=1,b=3,h,x1,x2,x3,x4,C1=0,C2,C3,C4,C;intk,n=20;h=(b-a)/n;x1=a;x2=a+h/4;x3=a+h/2;x4=a+3*h/4;C=exp(-a*a)*sin(10*a)+4+exp(-b*b)*sin(10*b)+4;C2=exp(-x2*x2)*sin(10*x2)+4;C3=exp(-x3*x3)*sin(10*x3)+4;C4=exp(-x4*x4)*sin(10*x4)+4;for(k=1;kn;k++){x1+=h;x2+=h;x3+=h;x4+=h;C1+=exp(-x1*x1)*sin(10*x1)+4;C2+=exp(-x2*x2)*sin(10*x2)+4;C3+=exp(-x3*x3)*sin(10*x3)+4;C4+=exp(-x4*x4)*sin(10*x4)+4;}C=(7*C+32*C2+12*C3+32*C4+14*C1)*h/90;cout.precision(15);cout运用复化Cotes求积公式求解得Cendl;}3-2-1#includeiostream.h#includestdio.h#includemath.hvoidmain(){longdoublepi=3.3846,h,x,T1=0,T,a,b;intn=100,k;a=2*pi;b=4*pi;h=(b-a)/n;x=a;T=sin(5*a)/(a*a*a)+sin(5*b)/(b*b*b);for(k=1;kn;k++){x+=h;T1+=sin(5*x)/(x*x*x);}T=(T+2*T1)*h/2;cout.precision(10);cout运用复化梯形公式求解得Tendl;}3-2-2#includeiostream.h#includestdio.h#includemath.hvoidmain(){longdoublepi=3.3846,h,a,b,S1=0,S2,S,x1,x2;intn=150,k;a=2*pi;b=4*pi;h=(b-a)/n;x1=a;x2=a+h/2;S=sin(5*a)/(a*a*a)+sin(5*b)/(b*b*b);S2=sin(5*x2)/(x2*x2*x2);for(k=1;kn;k++){x1+=h;x2+=h;S1+=sin(