版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、对分法SRK方程#include#include# define R 8.314float fun(float A,float B, float Z) float fz; fz=pow(Z,3)-pow(Z,2)+(A-B-B*B)*Z-A*B; return fz;main()int i=1; float p0,t0,w,p1,t1,h,Z0,Z1,Z2;float a,b,m,A,B,t2,at,y,y1,y2;a=b=0.0; printf(请输入临界参数:n p0= ); scanf(%f,&p0);printf(请输入临界参数:n t0= ); scanf(%f,&t0);print
2、f(请输入偏心因子:n w= ); scanf(%f,&w);printf(请输入实际温度:n t1=); scanf(%f,&t1); printf(请输入实际压力:n p1=); scanf(%f,&p1); m=0.480+1.574*w-0.176*w*w;t2=t1/t0;at=(1+m*(1-sqrt(t2)*(1+m*(1-sqrt(t2); a=0.42748*R*R*pow(t0,2)/p0*at; b=0.08664*R*t0/p0; A=a*p1/(R*R*pow(t1,2); B=b*p1/(R*t1); Z1=0.0;Z2=3.0;y1=fun(A,B,Z1);y2=
3、fun(A,B,Z2);printf(第0 次计算结果 y1=%.6f y2=%.6f Z1=%.5f Z2=%.5fn,y1,y2,Z1,Z2); doZ0=(Z1+Z2)/2;y=fun(A,B,Z0); if(y0) y2=y;Z2=Z0; if(y0.0001); printf(n); printf(共经过%d次计算,求得压缩因子为Z=%.5f n,-i,Z1);对分法RK方程1#include#include# define R 8.314# define t0 126.2# define p0 3394000.0# define w 0.04float fun(float A,fl
4、oat B, float Z) float fz; fz=pow(Z,3)-pow(Z,2)+(A-B-B*B)*Z-A*B; return fz;main()int i=1; float p1,t1,Z0,Z1,Z2;float a,b,A,B,t2,y,y1,y2;a=b=0.0; printf(氨的临界压力 p0=%.1fn,p0);printf(氨的临界温度 t0=%.1fn,t0);printf(氨的偏心因子 w=%.2fn,w);printf(请输入实际温度:n t1=); scanf(%f,&t1); printf(请输入实际压力:n p1=); scanf(%f,&p1); a
5、=0.42748*R*R*pow(t0,2)/p0; b=0.08664*R*t0/p0; A=a*p1/(R*R*pow(t1,2); B=b*p1/(R*t1); Z1=0.0;Z2=3.0;y1=fun(A,B,Z1);y2=fun(A,B,Z2);printf(第0 次计算结果 y1=%.6f y2=%.6f Z1=%.5f Z2=%.5fn,y1,y2,Z1,Z2); doZ0=(Z1+Z2)/2;y=fun(A,B,Z0); if(y0) y2=y;Z2=Z0; if(y0.0001); printf(n); printf(共经过%d次计算,求得压缩因子为Z=%.5f n,-i,Z
6、1);对分法RK方程2#include#include# define R 8.314# define t0 126.2# define p0 3394000.0# define w 0.04float fun(float A,float B, float Z) float fz; fz=pow(Z,3)-pow(Z,2)+(A-B-B*B)*Z-A*B; return fz;main()int i=1; float p1,t1,h,Z0,Z1,Z2;float a,b,m,A,B,t2,at,y,y1,y2;a=b=0.0;printf(氨的临界压力 p0=%.1fn,p0);printf(
7、氨的临界温度 t0=%.1fn,t0);printf(氨的偏心因子 w=%.2fn,w);printf(请输入实际温度:n t1=); scanf(%f,&t1); printf(请输入实际压力:n p1=); scanf(%f,&p1); m=0.480+1.574*w-0.176*w*w;t2=t1/t0;at=(1+m*(1-sqrt(t2)*(1+m*(1-sqrt(t2); a=0.42748*R*R*pow(t0,2)/p0*at; b=0.08664*R*t0/p0; A=a*p1/(R*R*pow(t1,2); B=b*p1/(R*t1); Z1=0.0;Z2=3.0;y1=f
8、un(A,B,Z1);y2=fun(A,B,Z2);printf(第0 次计算结果 y1=%.6f y2=%.6f Z1=%.5f Z2=%.5fn,y1,y2,Z1,Z2); doZ0=(Z1+Z2)/2;y=fun(A,B,Z0); if(y0) y2=y;Z2=Z0; if(y0.0001); printf(n); printf(共经过%d次计算,求得压缩因子为Z=%.5f n,-i,Z1);迭代法RK方程#include#include# define R 8.314float fun(float A,float B, float h) float Z; Z=1.0/(1-h)-A/B
9、*(h/(1+h); return Z;main()int i=1; float p0,t0,w,p1,t1,h,Z0;float a,b,A,B,Z;a=b=0.0; printf(请输入临界参数:n p0= ); scanf(%f,&p0);printf(请输入临界参数:n t0= ); scanf(%f,&t0);printf(请输入偏心因子:n w= ); scanf(%f,&w);printf(请输入实际温度:n t1=); scanf(%f,&t1); printf(请输入实际压力:n p1=); scanf(%f,&p1); a=0.42748*R*R*pow(t0,2.5)/p
10、0; b=0.08664*R*t0/p0; A=a*p1/(R*R*pow(t1,2.5); B=b*p1/(R*t1);printf(请输入Z的迭代初值:n Z=); scanf(%f,&Z); doZ0=Z;h=B/Z0;Z=fun(A,B,h);printf(第%d次迭代 %f %fn,i,Z,h); i+; while(fabs(Z-Z0)0.0001); printf(n); printf(共经过%d次迭代,求得压缩因子为w=%f n,-i,Z);迭代法SRK方程#include#include# define R 8.314float fun(float A,float B, fl
11、oat h) float Z; Z=1.0/(1-h)-A/B*(h/(1+h); return Z;main()int i=1; float p0,t0,w,p1,t1,h,Z0;float a,b,m,A,B,Z,t2,ft;a=b=0.0; printf(请输入临界参数:n p0= ); scanf(%f,&p0);printf(请输入临界参数:n t0= ); scanf(%f,&t0);printf(请输入偏心因子:n w= ); scanf(%f,&w);printf(请输入实际温度:n t1=); scanf(%f,&t1); printf(请输入实际压力:n p1=); sca
12、nf(%f,&p1); m=0.480+1.574*w-0.176*w*w;t2=t1/t0;ft=(1+m*(1-sqrt(t2)*(1+m*(1-sqrt(t2); a=0.42748*R*R*pow(t0,2)/p0*ft; b=0.08664*R*t0/p0; A=a*p1/(R*R*pow(t1,2); B=b*p1/(R*t1);printf(请输入Z的迭代初值:n Z=);scanf(%f,&Z); h=B/Z;printf(第0次迭代 %.4f %.5fn,Z,h); doZ0=Z;Z=fun(A,B,h);h=B/Z;printf(第%d次迭代 %.4f %.5fn,i,Z,
13、h); i+; while(fabs(Z-Z0)0.0001); printf(n); printf(共经过%d次迭代,求得压缩因子为w=%.4f n,-i,Z);牛顿迭代法RK方程#include#include# define R 8.314# define t0 126.2# define p0 3394000.0# define w 0.04float fun(float A,float B, float Z) float fz; fz=pow(Z,3)-pow(Z,2)+(A-B-B*B)*Z-A*B; return fz;float fun1(float A,float B, fl
14、oat Z) float fz1; fz1=3*pow(Z,2)-2*Z+(A-B-B*B); return fz1;main()int i=1; float p1,t1,Z0,Z1;float a,b,A,B,t2,y,y1,y2;a=b=0.0; printf(氨的临界压力 p0=%.1fn,p0);printf(氨的临界温度 t0=%.1fn,t0);printf(氨的偏心因子 w=%.2fn,w);printf(请输入实际温度:n t1=); scanf(%f,&t1); printf(请输入实际压力:n p1=); scanf(%f,&p1);printf(请输入牛顿迭代初值:n Z
15、1=); scanf(%f,&Z1);a=0.42748*R*R*pow(t0,2.5)/p0; b=0.08664*R*t0/p0; A=a*p1/(R*R*pow(t1,2.5); B=b*p1/(R*t1); Z0=Z1; do Z1=Z0;Z0=Z1-fun(A,B,Z1)/fun1(A,B,Z1);printf(第%d次牛顿迭代 Z0=%f Z1=%fn,i,Z0,Z1);i+;while( fabs(Z1-Z0)0.0001);printf(经过第%d次牛顿迭代,Z=%fn,-i,Z0); 牛顿迭代法SRK方程#include#include# define R 8.314# de
16、fine t0 126.2# define p0 3394000.0# define w 0.04float fun(float A,float B, float Z) float fz; fz=pow(Z,3)-pow(Z,2)+(A-B-B*B)*Z-A*B; return fz;float fun1(float A,float B, float Z) float fz1; fz1=3*pow(Z,2)-2*Z+(A-B-B*B); return fz1;main()int i=1; float p1,t1,Z0,Z1;float a,b,m,A,B,t2,ft,y,y1,y2;a=b=0
17、.0; printf(氨的临界压力 p0=%.1fn,p0);printf(氨的临界温度 t0=%.1fn,t0);printf(氨的偏心因子 w=%.2fn,w);printf(请输入实际温度:n t1=); scanf(%f,&t1); printf(请输入实际压力:n p1=); scanf(%f,&p1);printf(请输入牛顿迭代初值:n Z1=); scanf(%f,&Z1); m=0.480+1.574*w-0.176*w*w;t2=t1/t0;ft=(1+m*(1-sqrt(t2)*(1+m*(1-sqrt(t2);a=0.42748*R*R*pow(t0,2.5)/p0*f
18、t; b=0.08664*R*t0/p0; A=a*p1/(R*R*pow(t1,2.5); B=b*p1/(R*t1); Z0=Z1; do Z1=Z0;Z0=Z1-fun(A,B,Z1)/fun1(A,B,Z1);printf(第%d次牛顿迭代 Z0=%f Z1=%fn,i,Z0,Z1);i+;while( fabs(Z1-Z0)0.0001);printf(经过第%d次牛顿迭代,Z=%fn,-i,Z0);公式法SRK方程#include#include# define R 8.314# define t0 126.2# define p0 3394000.0# define w 0.04
19、# define l (float)1/3main()int i=1; float p1,t1,D,U,V,Z,h,g;float a,b,m,A,B,t2,at,q,p;a=b=0.0;printf(氨的临界压力 p0=%.1fn,p0);printf(氨的临界温度 t0=%.1fn,t0);printf(氨的偏心因子 w=%.2fn,w);printf(请输入实际温度:n t1=); scanf(%f,&t1); printf(请输入实际压力:n p1=); scanf(%f,&p1); m=0.480+1.574*w-0.176*w*w;t2=t1/t0;at=(1+m*(1-sqrt(t2)*(1+m*(1-sqrt(t2); a=0.42748*R*R*pow(t0,2)/p0*at; b=0.08664*R*t0/p0; A=a*p1/(R*R*pow(t1,2); B=b*p1/(R*t1); p=(3*(A-B-B*B)-1)/3;q=(9*(A-B-B*B)-2-27*A*B)/27;D=sqr
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2026年宝鸡职业技术学院单招职业倾向性考试题库及答案1套
- 2026年普通心理学期末考试题库及参考答案1套
- 2026新疆赛尔山投资运营有限公司及下属公司招聘笔试模拟试题及答案解析
- 2026年常用电工仪表考试题库及答案(网校专用)
- 2026年沧州航空职业学院单招职业倾向性测试模拟测试卷附答案
- 2026年哈尔滨北方航空职业技术学院单招综合素质考试模拟测试卷及答案1套
- 2026年山西林业职业技术学院单招职业倾向性考试模拟测试卷附答案
- 浙江杭州市萧山区面向2026届高校毕业生提前批招聘教师245人笔试参考题库及答案解析
- 2025江苏徐州徐工弗迪电池科技有限公司招聘279人模拟试卷附答案
- 2026上海普陀区人民调解协会招聘13人笔试备考题库及答案解析
- 安徽省九师联盟2025-2026学年高三(1月)第五次质量检测英语(含答案)
- (2025年)四川省自贡市纪委监委公开遴选公务员笔试试题及答案解析
- 2026届江苏省常州市高一上数学期末联考模拟试题含解析
- 2026年及未来5年市场数据中国水质监测系统市场全面调研及行业投资潜力预测报告
- 2026安徽省农村信用社联合社面向社会招聘农商银行高级管理人员参考考试试题及答案解析
- 强夯地基施工质量控制方案
- 艺考机构协议书
- 2025年12月27日四川省公安厅遴选面试真题及解析
- 2025-2030中国海洋工程装备制造业市场供需关系研究及投资策略规划分析报告
- 《生态环境重大事故隐患判定标准》解析
- 2025年度吉林省公安机关考试录用特殊职位公务员(人民警察)备考笔试试题及答案解析
评论
0/150
提交评论