对分发迭代法牛顿法RKSRK方程.doc

上传人:飞****9 文档编号:127964729 上传时间:2020-04-07 格式:DOC 页数:17 大小:60.43KB
返回 下载 相关 举报
对分发迭代法牛顿法RKSRK方程.doc_第1页
第1页 / 共17页
对分发迭代法牛顿法RKSRK方程.doc_第2页
第2页 / 共17页
对分发迭代法牛顿法RKSRK方程.doc_第3页
第3页 / 共17页
对分发迭代法牛顿法RKSRK方程.doc_第4页
第4页 / 共17页
对分发迭代法牛顿法RKSRK方程.doc_第5页
第5页 / 共17页
点击查看更多>>
资源描述

《对分发迭代法牛顿法RKSRK方程.doc》由会员分享,可在线阅读,更多相关《对分发迭代法牛顿法RKSRK方程.doc(17页珍藏版)》请在金锄头文库上搜索。

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, float 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

展开阅读全文
相关资源
正为您匹配相似的精品文档
相关搜索

最新文档


当前位置:首页 > 中学教育 > 初中教育

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号