166 Introduction to Computational Modeling
15 double deltax; /
*
average difference
*
/
16 int j;
17
18 printf("Montly price of electricity\n");
19 m[0] = 1;
20 for (j = 1; j < N; j++)
21 m[j] = m[j-1] + 1;
22 /
*
Array Monthly price for electric energy
*
/
23 for (j = 0; j < N; j++)
24 printf("%lf ", e[j]);
25 /
*
differences in sequence e
*
/
26 printf("\nDifferences of the given data\n");
27 de = diff (e, N);
28 for (j = 0; j < N-1; j++)
29 printf("%f ", de[j]);
30 /
*
average of increments
*
/
31 deltax = mean(de, N-1);
32 printf("\nAverage difference: %lf \n", deltax);
33 /
*
Calculating price of electric energy
*
/
34 c[0] = e[0];
35 for (j = 1; j < N; j++)
36 c[j] = deltax
*
j + e[0];
37 printf("\nCalculated prices of elect: \n");
38 for (j = 0; j < N; j++)
39 printf("%f ", c[j]); ...