欢迎来到天天文库
浏览记录
ID:47571130
大小:182.00 KB
页数:10页
时间:2020-01-16
《Lagrange插值及Newton插值》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、实验报告实验项目插值法实验日期2016/9/30理论内容Lagrange插值与Newton插值授课日期实验室名称文理管203微机编号E1实验目的及要求:1、了解多项式差值公式的存在唯一性条件及其余项表达式的推导。2、了解拉格朗日插值多项式的构造、计算及其基函数的特点,牛顿插值多项式的构造与应用,差商、差分的计算及基本性质。实验内容:编写Lagrange插值法及Newton插值法通用子程序,依据数据表0.320.340.360.3145670.3334870.352274构造一个抛物插值多项式及,计算的近似值并估计误差。最新范本,供参考!实验步骤及
2、程序:1、Lagrange插值公式算法流程图开始输入输出y结束最新范本,供参考!Newton插值公式算法流程图调用函数ChaShang()返回i阶差商f调用函数Newton()I阶差商f=ChaShang(i,X,Y)temp=1i3、[],doubleY[],doubleX0[]){intm=X.length;intn=X0.length;doubleY0[]=newdouble[n];for(inti1=0;i14、icvoidmain(String[]args){/*输入插值点横纵坐标*/System.out.println("Inputnumberofinterpolationpoint:");Scannerscan=newScanner(System.in);intm=scan.nextInt();System.out.println("Inputnumberoftestpoint:");intn=scan.nextInt();doubleX[]=newdouble[m];doubleY[]=newdouble[m];doubleX0[]=newdou5、ble[n];System.out.println("InputtheelementsofX:");//已知插值点最新范本,供参考!for(inti=0;i6、0;i7、拷贝向量*/privatestaticvoidcopy_vector(doublefrom[],doubleto[]){intk=from.length;intk2=to.length;if(k!=k2){System.out.println("thetwovector'slengthisnotequal!");System.exit(0);}for(inti=0;i8、]Y,doubleX0[]){intm=X.length;intn=X0.length;double[]Y0=newdouble[n];
3、[],doubleY[],doubleX0[]){intm=X.length;intn=X0.length;doubleY0[]=newdouble[n];for(inti1=0;i14、icvoidmain(String[]args){/*输入插值点横纵坐标*/System.out.println("Inputnumberofinterpolationpoint:");Scannerscan=newScanner(System.in);intm=scan.nextInt();System.out.println("Inputnumberoftestpoint:");intn=scan.nextInt();doubleX[]=newdouble[m];doubleY[]=newdouble[m];doubleX0[]=newdou5、ble[n];System.out.println("InputtheelementsofX:");//已知插值点最新范本,供参考!for(inti=0;i6、0;i7、拷贝向量*/privatestaticvoidcopy_vector(doublefrom[],doubleto[]){intk=from.length;intk2=to.length;if(k!=k2){System.out.println("thetwovector'slengthisnotequal!");System.exit(0);}for(inti=0;i8、]Y,doubleX0[]){intm=X.length;intn=X0.length;double[]Y0=newdouble[n];
4、icvoidmain(String[]args){/*输入插值点横纵坐标*/System.out.println("Inputnumberofinterpolationpoint:");Scannerscan=newScanner(System.in);intm=scan.nextInt();System.out.println("Inputnumberoftestpoint:");intn=scan.nextInt();doubleX[]=newdouble[m];doubleY[]=newdouble[m];doubleX0[]=newdou
5、ble[n];System.out.println("InputtheelementsofX:");//已知插值点最新范本,供参考!for(inti=0;i6、0;i7、拷贝向量*/privatestaticvoidcopy_vector(doublefrom[],doubleto[]){intk=from.length;intk2=to.length;if(k!=k2){System.out.println("thetwovector'slengthisnotequal!");System.exit(0);}for(inti=0;i8、]Y,doubleX0[]){intm=X.length;intn=X0.length;double[]Y0=newdouble[n];
6、0;i7、拷贝向量*/privatestaticvoidcopy_vector(doublefrom[],doubleto[]){intk=from.length;intk2=to.length;if(k!=k2){System.out.println("thetwovector'slengthisnotequal!");System.exit(0);}for(inti=0;i8、]Y,doubleX0[]){intm=X.length;intn=X0.length;double[]Y0=newdouble[n];
7、拷贝向量*/privatestaticvoidcopy_vector(doublefrom[],doubleto[]){intk=from.length;intk2=to.length;if(k!=k2){System.out.println("thetwovector'slengthisnotequal!");System.exit(0);}for(inti=0;i8、]Y,doubleX0[]){intm=X.length;intn=X0.length;double[]Y0=newdouble[n];
8、]Y,doubleX0[]){intm=X.length;intn=X0.length;double[]Y0=newdouble[n];
此文档下载收益归作者所有