| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 804 人关注过本帖
标题:[求助]求一个三次方程的算法
取消只看楼主 加入收藏
foreverjoy
Rank: 1
等 级:新手上路
帖 子:16
专家分:0
注 册:2006-5-11
收藏
 问题点数:0 回复次数:2 
[求助]求一个三次方程的算法
我要把这个程序改成q是已知的,能求出T3,它是个积分上限
但是我不会编3次方程的求法
求助高手啊
搜索更多相关主题的帖子: 方程 算法 
2006-05-11 11:03
foreverjoy
Rank: 1
等 级:新手上路
帖 子:16
专家分:0
注 册:2006-5-11
收藏
得分:0 
不好意思,没上传上来
main( )
{float a[6][4]={{26.9275,3.384E-2,-3.8690E-5,0},
{3.8033,1.5648E-1,-8.3429E-5,52.28},
{130.24,-1.77718E-1,5.38572E-4,-165.23},
{4.8930,5.518E-2,-3.435E-5,-129.79},
{30.2915,-7.2E-3,1.2460E-5,-92.31},
{30.2915,-7.2E-3,1.2460E-5,-167.16}};
float T0=298,T1=298,T2=298,T31=388,T3=371.65,T4=322.46,T5=388,T32=370.62,T=388;
float h1,h2,h31,h3,h4,h5,h32,h10,h20,h30,h0;
float q,q0,Q,f1=419.902679,f2=506.107483,f3=3449397.85/98.9753,f31=3000000/98.9683,f32=4538.377441,f4=109.417824,n42=92.786980,f5=4941.649414;
float x33=0.997845,x34=0.002089,x35=0.000066,x43=0.091837,x42=0.848006,x45=0.060157,x53=0.996689,x54=0.003251,x55=0.000061;
h1=a[0][3]+0.001*(a[0][0]*(T1-T0)+0.5*a[0][1]*(T1*T1-T0*T0)+a[0][2]*(T1*T1*T1-T0*T0*T0)/3);
h2=a[1][3]+0.001*(a[1][0]*(T2-T0)+0.5*a[1][1]*(T2*T2-T0*T0)+a[1][2]*(T2*T2*T2-T0*T0*T0)/3);
h31=(x33+x34)*a[2][3]+x35*a[5][3]+0.001*(((x33+x34)*a[2][0]+x35*a[5][0])*(T31-T0)+0.5*((x33+x34)*a[2][1]+x35*a[5][1])*(T31*T31-T0*T0)+((x33+x34)*a[2][2]+x35*a[5][2])*(T31*T31*T31-T0*T0*T0)/3);
h3=(x33+x34)*a[2][3]+x35*a[5][3]+0.001*(((x33+x34)*a[2][0]+x35*a[5][0])*(T3-T0)+0.5*((x33+x34)*a[2][1]+x35*a[5][1])*(T3*T3-T0*T0)+((x33+x34)*a[2][2]+x35*a[5][2])*(T3*T3*T3-T0*T0*T0)/3);
h4=x42*a[1][3]+x43*a[3][3]+x45*a[4][3]+0.001*((x42*a[1][0]+x43*a[3][0]+x45*a[4][0])*(T4-T0)+0.5*(x42*a[1][1]+x43*a[3][1]+x45*a[4][1])*(T4*T4-T0*T0)
+(x42*a[1][2]+x43*a[3][2]+x45*a[4][2])*(T4*T4*T4-T0*T0*T0)/3);
h5=(x53+x54)*a[2][3]+x55*a[5][3]+0.001*(((x53+x54)*a[2][0]+x55*a[5][0])*(T5-T0)+0.5*((x53+x54)*a[2][1]+x55*a[5][1])*(T5*T5-T0*T0)
+((x53+x54)*a[2][2]+x55*a[5][2])*(T5*T5*T5-T0*T0*T0)/3);
h32=(x33+x34)*a[2][3]+x35*a[5][3]+0.001*(((x33+x34)*a[2][0]+x35*a[5][0])*(T32-T0)+0.5*((x33+x34)*a[2][1]+x35*a[5][1])*(T32*T32-T0*T0)+((x33+x34)*a[2][2]+x35*a[5][2])*(T32*T32*T32-T0*T0*T0)/3);
h10=a[0][3]+0.001*(a[0][0]*(T-T0)+0.5*a[0][1]*(T*T-T0*T0)+a[0][2]*(T*T*T-T0*T0*T0)/3);
h20=a[1][3]+0.001*(a[1][0]*(T-T0)+0.5*a[1][1]*(T*T-T0*T0)+a[1][2]*(T*T*T-T0*T0*T0)/3);
h30=a[2][3]+0.001*(a[2][0]*(T-T0)+0.5*a[2][1]*(T*T-T0*T0)+a[2][2]*(T*T*T-T0*T0*T0)/3);
h0=h10+h20-h30;
printf("h1=%f,h2=%f,h31=%f,h3=%f,h4=%f,h5=%f,h32=%f,h0=%f\n",h1,h2,h31,h3,h4,h5,h32,h0);
q=(f1*h1+f2*h2+f3*h3-f31*h31-f4*h4-f5*h5)*1000;
q0=h0*(f2-n42)*1000;
Q=(f31*h31+f32*h32-f3*h3)*1000;
printf("q=%f,q0=%f,Q=%f\n",q,q0,Q);
}
2006-05-11 11:09
foreverjoy
Rank: 1
等 级:新手上路
帖 子:16
专家分:0
注 册:2006-5-11
收藏
得分:0 

多谢!我用牛顿法编出来了

2006-05-12 17:50
快速回复:[求助]求一个三次方程的算法
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.023163 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved