1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76
|
#include<stdio.h>
#include<math.h>
float f(float t, float a){
return -1 * 6.65 * pow(10, -14);
}
float y(float t, float a, float b, float c){
return 6.64 * pow(10, -14) * a - (9.91 * pow(10, -13) * b * c);
}
float z(float t, float b, float c){
return -1 * 9.91 * pow(10, -13) * b * c;
}
float q(float t, float b, float c){
return 9.91 * pow(10,-13) * b * c;
}
int main (void){
int i , j ;
float RA[1000], RB[1000], RC[1000], RD[1000], K[1000], G[1000], L[1000], M[1000], a, b, c, d, h, t ,n ;
printf("Lutfen SO2 için konsantrasyon degeri giriniz:\n");
scanf("%f", &RA[0]);
printf("Lutfen SO3 için konsantrasyon degeri giriniz:\n");
scanf("%f", &RB[0]);
printf("Lutfen H2O için konsantrasyon degeri giriniz:\n");
scanf("%f", &RC[0]);
printf("Lutfen H2SO4 için konsantrasyon degeri giriniz:\n");
scanf("%f", &RD[0]);
printf("Lutfen sureyi belirleyiniz:\n");
scanf("%f", &n);
printf("Lutfen adim sayisini belirleyiniz:");
scanf("%f", &h);
t = 0;
for(i = 0; t <= n; i++ ){
K[0] = f(t , RA[i]);
G[0] = y(t, RA[i], RB[i], RC[i]);
L[0] = z(t, RB[i], RC[i]);
M[0] = q(t, RB[i], RC[i]);
K[1] = f(t + 0.5 * h, RA[i] + 0.5 * K[0]);
G[1] = y(t + 0.5 * h, RA[i] + 0.5 * K[0], RB[i] + 0.5 * G[0], RC[i] + 0.5 * L[0] );
L[1] = z(t + 0.5 * h, RB[i] + 0.5 * G[0], RC[i] + 0.5 * L[0]);
M[1] = q(t + 0.5 * h, RB[i] + 0.5 * G[0], RC[i] + 0.5 * L[0]);
K[2] = f(t + 0.5 * h, RA[i] + 0.5 * K[1]);
G[2] = y(t + 0.5 * h, RA[i] + 0.5 * K[1], RB[i] + 0.5 * G[1], RC[i] + 0.5 * L[1] );
L[2] = z(t + 0.5 * h, RB[i] + 0.5 * G[1], RC[i] + 0.5 * L[1]);
M[2] = q(t + 0.5 * h, RB[i] + 0.5 * G[1], RC[i] + 0.5 * L[1]);
K[3] = f(t + h, RA[i] + K[2]);
G[3] = y(t + h, RA[i] + K[2], RB[i] + G[2], RC[i] + L[2] );
L[3] = z(t + h, RB[i] + G[2], RC[i] + L[2]);
M[3] = q(t + h, RB[i] + G[2], RC[i] + L[2]);
RA[i+1] = RA[i] + (1/6) * (K[0] + 2 * K[1] + 2 * K[2] + K[3]) * h;
RB[i+1] = RB[i] + (1/6) * (G[0] + 2 * G[1] + 2 * G[2] + G[3]) * h;
RC[i+1] = RC[i] + (1/6) * (L[0] + 2 * L[1] + 2 * L[2] + L[3]) * h;
RD[i+1] = RD[i] + (1/6) * (M[0] + 2 * M[1] + 2 * M[2] + M[3]) * h;
t = t + h;
printf("Belirlenen Sicakliktaki konsantrasyon degerleri = %f\n", i, RA[i+1], RB[i+1], RC[i+1], RD[i+1]);
}
return 0;
}
|