Skip to Main Content
Introduction to Computational Modeling Using C and Open-Source Tools
book

Introduction to Computational Modeling Using C and Open-Source Tools

by Jose M. Garrido
November 2013
Intermediate to advanced content levelIntermediate to advanced
461 pages
12h 1m
English
CRC Press
Content preview from Introduction to Computational Modeling Using C and Open-Source Tools
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]); ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Computer Fundamentals and Programming in C (RMK)

Computer Fundamentals and Programming in C (RMK)

Anita Goel, Ajay Mittal

Publisher Resources

ISBN: 9781482216783