ImageVerifierCode 换一换
格式:DOCX , 页数:21 ,大小:127.09KB ,
资源ID:30233028      下载积分:3 金币
快捷下载
登录下载
邮箱/手机:
温馨提示:
快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。 如填写123,账号就是123,密码也是123。
特别说明:
请自助下载,系统不会自动发送文件的哦; 如果您已付费,想二次下载,请登录后访问:我的下载记录
支付方式: 支付宝    微信支付   
验证码:   换一换

加入VIP,免费下载
 

温馨提示:由于个人手机设置不同,如果发现不能下载,请复制以下地址【https://www.bdocx.com/down/30233028.html】到电脑端继续下载(重复下载不扣费)。

已注册用户请登录:
账号:
密码:
验证码:   换一换
  忘记密码?
三方登录: 微信登录   QQ登录  

下载须知

1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。
2: 试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。
3: 文件的所有权益归上传用户所有。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 本站仅提供交流平台,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

版权提示 | 免责声明

本文(数值分析上机实验报告.docx)为本站会员(b****5)主动上传,冰豆网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知冰豆网(发送邮件至service@bdocx.com或直接QQ联系客服),我们立即给予删除!

数值分析上机实验报告.docx

1、数值分析上机实验报告数值分析上机实验报告 班级:材料工程 学号:2013730069 姓名:张明杰 日期:2013.12.31昆 明 理 工 大 学 13工科硕士 数值分析上机实验报告专业: 材料工程 姓名: 张明杰 学号: 2013730069 任课教师: 李玉兰 作业完成实验室: 实验成绩:理论描述(10)数值公式(10)程序流程图和程序结构(20)数据和结果(20)讨论(20)源程序(20)总分(100)实验内容:1题目/要求:1、 利用Lagrange插值公式 编写出插值多项式程序;2、 给出插值多项式或分段三次插值多项式的表达式;3、 根据节点选取原则,对问题(2)用三点插值或二点插

2、值,其结果如何;对此插值问题用Newton插值多项式其结果如何2作业环境(包括选用的程序语言、运行环境) Visual C+ 6.03数学(理论背景)描述 1. Lagrange插值多项式定义:若n次多项式:当 其中,就称这个次多项式为节点上的次插值基函数。插值多项式可表示为:,称为Lagrange插值多项式。2. 分段线形插值就是通过插值点用折线段连接起来逼近设已知节点上的函数值,记求一折线函数满足:4数值计算公式 Lagrange插值多项式;分段线形插函数,在每个小区间上可表示为: ()在整个区间上为: 其中基函数,其形式是:5算法程序流程图 Lagrange插值算法程序流程图分段低次插值

3、算法程序流程图 6程序结构(程序中的函数调用关系图 6实验数据和实验结果(打印或用屏幕图形拷屏表示,可加为附页)(1)0.40.550.650.800.951.050.410750.578150.696750.901.001.25382Lagrange插值算法 分段低次插值算法 (2) 12345670.3680.1350.0500.0180.0070.0020.001Lagrange插值算法 分段低次插值算法 7讨论(包括题目要求的讨论和方法的适用性讨论)对于插值多项式L (x),当时,L (x)不一定收敛到f(x),此时需用分段线性插值比L (x)逼近f(x)好得多,题(2)就是一例。计算

4、时,用分段线性插值算法的结果比用Lagrange插值算法的结果更接近题目所给数据0.00213348。另一种情况,当用拉格郎日插值多项式L (x)计算函数近似值,如精度不满足要求需增加插值节点,原来算出的数据均不能利用时,可用埃特金逐次线形插值算法。牛顿插值多项式较Lagrange插值多项式更有一般性,它对是由离散点给出的情形或导数不存在时均适用。且比Lagrange值计算量省,且便于程序设计。8附源程序(打包邮件)题一()Lagrange插值算法源程序#include #include #include double LAG(int n,double t,double*x,double*y)

5、 int i,j; double p,s; s=0; for(i=0;i=n-1;i+) /外循环,累和 p=1; for(j=0;j=n-1;j+) /内循环,累积 if(i!=j) p*=(t-xj)/(xi-xj); /循环语句 s+=p*yi; return(s);double LAG(int n,double t,double*x,double*y);void main() int n; double *x,*y,t; n=6; t=0.99; /或t=0.596 x=(double*)calloc(n,sizeof(double); if(x=NULL) printf(error)

6、; y=(double*)calloc(n,sizeof(double); if(y=NULL) printf(error); x0=0.4; x1=0.55; x2=0.65; x3=0.80; x4=0.95; x5=1.05; y0=0.41075; y1=0.57815; y2=0.69675; y3=0.90; y4=1.00; y5=1.25382; printf(%10.8fn,LAG(n,t,x,y); free(x); free(y);()分段低次插值算法程序#include #include #include double LAG(int n,double t,double

7、*x,double*y) int i,j; double p,s; s=0; for(i=0;i=n-1;i+) /外循环,累和 p=1; for(j=0;j=n-1;j+) /内循环,累积 if(i!=j) p*=(t-xj)/(xi-xj); /循环语句 s+=p*yi; return(s);double LAG(int n,double t,double*x,double*y);void main() int n; double *x,*y,t; n=6; t=0.99; /或t=0.596 x=(double*)calloc(n,sizeof(double); if(x=NULL) p

8、rintf(error); y=(double*)calloc(n,sizeof(double); if(y=NULL) printf(error); x0=0.4; x1=0.55; x2=0.65; x3=0.80; x4=0.95; x5=1.05; y0=0.41075; y1=0.57815; y2=0.69675; y3=0.90; y4=1.00; y5=1.25382; printf(%10.8fn,LAG(n,t,x,y); free(x); free(y);题二()Lagrange插值算法源程序#include #include double LAG(int n,doubl

9、e t,double *x,double *y) int k,i;double p,s;s=0;for(k=0;k=n-1;k+) /外循环,累和p=1;for(i=0;i=n-1;i+) /内循环,累积 if(i!=k) p*=(t-xi)/(xk-xi); /循环语句s+=(p*yk); return(s);double LAG(int n,double t,double*x,double*y);void main()int n;double *x,*y,t; n=7; t=1.8; /或t=6.15x=(double*)calloc(n,sizeof(double); if(x=NULL

10、)printf(error); y=(double*)calloc(n,sizeof(double); if(y=NULL)printf(error);x0=1;x1=2;x2=3;x3=4;x4=5;x5=6;x6=7;y0=0.368;y1=0.135;y2=0.050;y3=0.018;y4=0.007;y5=0.002;y6=0.001;printf(%10.8fn,LAG(n,t,x,y);free(x);free(y);()分段低次插值算法程序#include #include double LIP(int n,double t,double *x,double *y) int i

11、=0; double u,f; for(i=0;i=xi&t=xi+1) u=(t-xi)/(xi+1-xi); f=yi+u*(yi+1-yi); return(f);double LIP(int n,double t,double*x,double*y);void main() int n; double *x,*y,t; n=7; t=6.15; /或1.8 x=(double*)calloc(n,sizeof(double); if(x=NULL) printf(error); y=(double*)calloc(n,sizeof(double); if(y=NULL) printf(

12、error); x0=1; x1=2; x2=3; x3=4; x4=5; x5=6; x6=7; y0=0.368; y1=0.135; y2=0.050; y3=0.018; y4=0.007; y5=0.002; y6=0.001; printf(%10.8fn,LIP(n,t,x,y); free(x); free(y);#include #include #include double LAG(int n,double t,double*x,double*y) int i,j; double p,s; s=0; for(i=0;i=n-1;i+) /外循环,累和 p=1; for(j

13、=0;j=n-1;j+) /内循环,累积 if(i!=j) p*=(t-xj)/(xi-xj); /循环语句 s+=p*yi; return(s);double LAG(int n,double t,double*x,double*y);void main() int n; double *x,*y,t; n=6; t=0.99; /或t=0.596 x=(double*)calloc(n,sizeof(double); if(x=NULL) printf(error); y=(double*)calloc(n,sizeof(double); if(y=NULL) printf(error);

14、 x0=0.4; x1=0.55; x2=0.65; x3=0.80; x4=0.95; x5=1.05; y0=0.41075; y1=0.57815; y2=0.69675; y3=0.90; y4=1.00; y5=1.25382; printf(%10.8fn,LAG(n,t,x,y); free(x); free(y);Lagrange插值算法源程序#include #include #include double LAG(int n,double t,double*x,double*y) int i,j; double p,s; s=0; for(i=0;i=n-1;i+) /外循

15、环,累和 p=1; for(j=0;j=n-1;j+) /内循环,累积 if(i!=j) p*=(t-xj)/(xi-xj); /循环语句 s+=p*yi; return(s);double LAG(int n,double t,double*x,double*y);void main() int n; double *x,*y,t; n=6; t=0.99; /或t=0.596 x=(double*)calloc(n,sizeof(double); if(x=NULL) printf(error); y=(double*)calloc(n,sizeof(double); if(y=NULL)

16、 printf(error); x0=0.4; x1=0.55; x2=0.65; x3=0.80; x4=0.95; x5=1.05; y0=0.41075; y1=0.57815; y2=0.69675; y3=0.90; y4=1.00; y5=1.25382; printf(%10.8fn,LAG(n,t,x,y); free(x); free(y); 分段低次插值算法程序#include #include double LIP(int n,double t,double *x,double *y) int i=0; double u,f; for(i=0;i=xi&t=xi+1) u

17、=(t-xi)/(xi+1-xi); f=yi+u*(yi+1-yi); return(f);double LIP(int n,double t,double*x,double*y);void main() int n; double *x,*y,t; n=6; t=0.596; /或t=0.99 x=(double*)calloc(n,sizeof(double); if(x=NULL) printf(error); y=(double*)calloc(n,sizeof(double); if(y=NULL) printf(error); x0=0.4; x1=0.55; x2=0.65; x3=0.80; x4=0.95; x5=1.05; y0=0.41075; y1=0.57815; y2=0.69675; y3=0.90; y4=1.00; y5=1.25382; printf(%10.8fn,LIP(n,t,x,y); free(x); free(y);

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1