求大佬看看程序怎么啦 解决有重谢
#include<stdio.h>
#include <math.h>
//n的函数
float function_n_t(float t)
{
float n_t=1;
return n_t;
}
//.......函数形参都是已知的
float Item_first(float m_Beta,float L,float Beta1,float Beta2,float Beta3,float Beta4,float Beta5,float Beta6,float Lambda1,float Lambda2,float Lambda3,float Lambda4,float Lambda5,float Lambda6,float h,float t)
{
float C_1_0 = Beta1*function_n_t(0)/(Lambda1*L);
float C_2_0 = Beta2*function_n_t(0)/(Lambda2*L);
float C_3_0 = Beta3*function_n_t(0)/(Lambda3*L);
float C_4_0 = Beta4*function_n_t(0)/(Lambda4*L);
float C_5_0 = Beta5*function_n_t(0)/(Lambda5*L);
float C_6_0 = Beta6*function_n_t(0)/(Lambda6*L);
float dn_dt = 0;
dn_dt = (8*function_n_t(t+h) - 8*function_n_t(t-h) - function_n_t(t+2*h) + function_n_t(t - 2*h))/(12*h);
float m_Sigma = 0;
m_Sigma = (Lambda1 * exp((float)(-Lambda1*t)) * C_1_0) + (Lambda2 * exp((float)(-Lambda2*t)) * C_2_0) + (Lambda3 * exp((float)(-Lambda3*t)) * C_3_0) + (Lambda4 * exp((float)(-Lambda4*t)) * C_4_0) + (Lambda5 * exp((float)(-Lambda5*t)) * C_5_0) + (Lambda6 * exp((float)(-Lambda6*t)) * C_6_0);
float Previous_item = 0;
Previous_item = m_Beta + (L/function_n_t(t)) * dn_dt - (L/function_n_t(t))*m_Sigma;
return Previous_item;
}
//.......函数形参都是已知的
//detal_t
float Item_last(float n,float detal_t,float h,float t,float Beta1,float Beta2,float Beta3,float Beta4,float Beta5,float Beta6,float Lambda1,float Lambda2,float Lambda3,float Lambda4,float Lambda5,float Lambda6)
{
//R_1
float R_1_1 = (function_n_t(1) * (1- exp((float)(-Lambda1))))/Lambda1;
float R_2_1 = (function_n_t(1) * (1- exp((float)(-Lambda2))))/Lambda2;
float R_3_1 = (function_n_t(1) * (1- exp((float)(-Lambda3))))/Lambda3;
float R_4_1 = (function_n_t(1) * (1- exp((float)(-Lambda4))))/Lambda4;
float R_5_1 = (function_n_t(1) * (1- exp((float)(-Lambda5))))/Lambda5;
float R_6_1 = (function_n_t(1) * (1- exp((float)(-Lambda6))))/Lambda6;
float R_1 = R_1_1+R_2_1+R_3_1+R_4_1+R_5_1+R_6_1;
float temp1 = ( Lambda1*Beta1*R_1_1 + Lambda2*Beta2*R_2_1 + Lambda3*Beta3*R_3_1 + Lambda4*Beta4*R_4_1 + Lambda5*Beta5*R_5_1 + Lambda6*Beta6*R_6_1 )/ function_n_t(1);
//R_2
float R_1_2 = R_1_1*exp((float)(-Lambda1*detal_t))+ (1 - exp((float)(-Lambda1*detal_t)))*(1 - h/(Lambda1*detal_t))/Lambda1+ h/Lambda1;
float R_2_2 = R_2_1*exp((float)(-Lambda2*detal_t))+ (1 - exp((float)(-Lambda2*detal_t)))*(1 - h/(Lambda2*detal_t))/Lambda2+ h/Lambda2;
float R_3_2 = R_3_1*exp((float)(-Lambda3*detal_t))+ (1 - exp((float)(-Lambda3*detal_t)))*(1 - h/(Lambda3*detal_t))/Lambda3+ h/Lambda3;
float R_4_2 = R_4_1*exp((float)(-Lambda4*detal_t))+ (1 - exp((float)(-Lambda4*detal_t)))*(1 - h/(Lambda4*detal_t))/Lambda4+ h/Lambda4;
float R_5_2 = R_5_1*exp((float)(-Lambda5*detal_t))+ (1 - exp((float)(-Lambda5*detal_t)))*(1 - h/(Lambda5*detal_t))/Lambda5+ h/Lambda5;
float R_6_2 = R_6_1*exp((float)(-Lambda6*detal_t))+ (1 - exp((float)(-Lambda6*detal_t)))*(1 - h/(Lambda6*detal_t))/Lambda6+ h/Lambda6;
float R_2 = R_1_2+R_2_2+R_3_2+R_4_2+R_5_2+R_6_2;
float temp2 = ( Lambda1*Beta1*R_1_2 + Lambda2*Beta2*R_2_2 + Lambda3*Beta3*R_3_2 + Lambda4*Beta4*R_4_2 + Lambda5*Beta5*R_5_2 + Lambda6*Beta6*R_6_2 )/ function_n_t(2);
//----------------------------------------------------------------------
//R_3
float R_1_3 = R_1_2*exp((float)(-Lambda1*detal_t))+ (1 - exp((float)(-Lambda1*detal_t)))*((1+h) - h/(Lambda1*detal_t))/Lambda1+ h/Lambda1;
float R_2_3 = R_2_2*exp((float)(-Lambda2*detal_t))+ (1 - exp((float)(-Lambda2*detal_t)))*((1+h) - h/(Lambda2*detal_t))/Lambda2+ h/Lambda2;
float R_3_3 = R_3_2*exp((float)(-Lambda3*detal_t))+ (1 - exp((float)(-Lambda3*detal_t)))*((1+h) - h/(Lambda3*detal_t))/Lambda3+ h/Lambda3;
float R_4_3 = R_4_2*exp((float)(-Lambda4*detal_t))+ (1 - exp((float)(-Lambda4*detal_t)))*((1+h) - h/(Lambda4*detal_t))/Lambda4+ h/Lambda4;
float R_5_3 = R_5_2*exp((float)(-Lambda5*detal_t))+ (1 - exp((float)(-Lambda5*detal_t)))*((1+h) - h/(Lambda5*detal_t))/Lambda5+ h/Lambda5;
float R_6_3 = R_6_2*exp((float)(-Lambda6*detal_t))+ (1 - exp((float)(-Lambda6*detal_t)))*((1+h) - h/(Lambda6*detal_t))/Lambda6+ h/Lambda6;
float R_3 = R_1_3+R_2_3+R_3_3+R_4_3+R_5_3+R_6_3;
float temp3 = ( Lambda1*Beta1*R_1_3 + Lambda2*Beta2*R_2_3 + Lambda3*Beta3*R_3_3 + Lambda4*Beta4*R_4_3 + Lambda5*Beta5*R_5_3 + Lambda6*Beta6*R_6_3 )/ function_n_t(3);
//R_4
float R_1_4 = R_1_3*exp((float)(-Lambda1*detal_t))+ (1 - exp((float)(-Lambda1*detal_t)))*((1+2*h) - h/(Lambda1*detal_t))/Lambda1+ h/Lambda1;
float R_2_4 = R_2_3*exp((float)(-Lambda2*detal_t))+ (1 - exp((float)(-Lambda2*detal_t)))*((1+2*h) - h/(Lambda2*detal_t))/Lambda2+ h/Lambda2;
float R_3_4 = R_3_3*exp((float)(-Lambda3*detal_t))+ (1 - exp((float)(-Lambda3*detal_t)))*((1+2*h) - h/(Lambda3*detal_t))/Lambda3+ h/Lambda3;
float R_4_4 = R_4_3*exp((float)(-Lambda4*detal_t))+ (1 - exp((float)(-Lambda4*detal_t)))*((1+2*h) - h/(Lambda4*detal_t))/Lambda4+ h/Lambda4;
float R_5_4 = R_5_3*exp((float)(-Lambda5*detal_t))+ (1 - exp((float)(-Lambda5*detal_t)))*((1+2*h) - h/(Lambda5*detal_t))/Lambda5+ h/Lambda5;
float R_6_4 = R_6_3*exp((float)(-Lambda6*detal_t))+ (1 - exp((float)(-Lambda6*detal_t)))*((1+2*h) - h/(Lambda6*detal_t))/Lambda6+ h/Lambda6;
float R_4 = R_1_4+R_2_4+R_3_4+R_4_4+R_5_4+R_6_4;
float temp4 = ( Lambda1*Beta1*R_1_4 + Lambda2*Beta2*R_2_4 + Lambda3*Beta3*R_3_4 + Lambda4*Beta4*R_4_4 + Lambda5*Beta5*R_5_4 + Lambda6*Beta6*R_6_4 )/ function_n_t(4);
//R_5
float R_1_5 = R_1_4*exp((float)(-Lambda1*detal_t))+ (1 - exp((float)(-Lambda1*detal_t)))*((1+3*h) - h/(Lambda1*detal_t))/Lambda1+ h/Lambda1;
float R_2_5 = R_2_4*exp((float)(-Lambda2*detal_t))+ (1 - exp((float)(-Lambda2*detal_t)))*((1+3*h) - h/(Lambda2*detal_t))/Lambda2+ h/Lambda2;
float R_3_5 = R_3_4*exp((float)(-Lambda3*detal_t))+ (1 - exp((float)(-Lambda3*detal_t)))*((1+3*h) - h/(Lambda3*detal_t))/Lambda3+ h/Lambda3;
float R_4_5 = R_4_4*exp((float)(-Lambda4*detal_t))+ (1 - exp((float)(-Lambda4*detal_t)))*((1+3*h) - h/(Lambda4*detal_t))/Lambda4+ h/Lambda4;
float R_5_5 = R_5_4*exp((float)(-Lambda5*detal_t))+ (1 - exp((float)(-Lambda5*detal_t)))*((1+3*h) - h/(Lambda5*detal_t))/Lambda5+ h/Lambda5;
float R_6_5 = R_6_4*exp((float)(-Lambda6*detal_t))+ (1 - exp((float)(-Lambda6*detal_t)))*((1+3*h) - h/(Lambda6*detal_t))/Lambda6+ h/Lambda6;
float R_5 = R_1_5+R_2_5+R_3_5+R_4_5+R_5_5+R_6_5;
float temp5 = ( Lambda1*Beta1*R_1_5 + Lambda2*Beta2*R_2_5 + Lambda3*Beta3*R_3_5 + Lambda4*Beta4*R_4_5 + Lambda5*Beta5*R_5_5 + Lambda6*Beta6*R_6_5 )/ function_n_t(5);
//R_6
float R_1_6 = R_1_5*exp((float)(-Lambda1*detal_t))+ (1 - exp((float)(-Lambda1*detal_t)))*((1+4*h) - h/(Lambda1*detal_t))/Lambda1+ h/Lambda1;
float R_2_6 = R_2_5*exp((float)(-Lambda2*detal_t))+ (1 - exp((float)(-Lambda2*detal_t)))*((1+4*h) - h/(Lambda2*detal_t))/Lambda2+ h/Lambda2;
float R_3_6 = R_3_5*exp((float)(-Lambda3*detal_t))+ (1 - exp((float)(-Lambda3*detal_t)))*((1+4*h) - h/(Lambda3*detal_t))/Lambda3+ h/Lambda3;
float R_4_6 = R_4_5*exp((float)(-Lambda4*detal_t))+ (1 - exp((float)(-Lambda4*detal_t)))*((1+4*h) - h/(Lambda4*detal_t))/Lambda4+ h/Lambda4;
float R_5_6 = R_5_5*exp((float)(-Lambda5*detal_t))+ (1 - exp((float)(-Lambda5*detal_t)))*((1+4*h) - h/(Lambda5*detal_t))/Lambda5+ h/Lambda5;
float R_6_6 = R_6_5*exp((float)(-Lambda6*detal_t))+ (1 - exp((float)(-Lambda6*detal_t)))*((1+4*h) - h/(Lambda6*detal_t))/Lambda6+ h/Lambda6;
float R_6 = R_1_6+R_2_6+R_3_6+R_4_6+R_5_6+R_6_6;
float temp6 = ( Lambda1*Beta1*R_1_6 + Lambda2*Beta2*R_2_6 + Lambda3*Beta3*R_3_6 + Lambda4*Beta4*R_4_6 + Lambda5*Beta5*R_5_6 + Lambda6*Beta6*R_6_6 )/ function_n_t(6);
float m_Sigma;
m_Sigma = temp1 + temp2 + temp3 + temp4 + temp5 + temp6;
return m_Sigma;
}
int main()
{
float m_Beta=0.007;
float L=0.00002;
float Beta1=0.000266;
float Beta2=0.001491;
float Beta3=0.001316;
float Beta4=0.002849;
float Beta5=0.000896;
float Beta6=0.000182;
float Lambda1=0.0127;
float Lambda2=0.0317;
float Lambda3=0.115;
float Lambda4=0.311;
float Lambda5=1.40;
float Lambda6=3.87;
float h=1;
float t=100;
float n;
float detal_t=1;
float m_Rho = 0;
m_Rho = Item_first(m_Beta,L,Beta1,Beta2,Beta3,Beta4,Beta5,Beta6,Lambda1,Lambda2,Lambda3,Lambda4,Lambda5,Lambda6, h,t) - Item_last(n,detal_t,h,t, Beta1, Beta2, Beta3, Beta4, Beta5,Beta6,Lambda1,Lambda2,Lambda3, Lambda4, Lambda5,Lambda6);
return 0;
}