├── Chi square test └── chi.c ├── Continuous System Simulation (chemical reaction) ├── chemicalrecn.c ├── lab01.txt └── lab01.xlsx ├── Monte Carlo Simulation ├── WIthout Graphics │ └── Monte Carlo.c └── With Graphics │ ├── Makefile.win │ ├── monte carlo.dev │ ├── monte carlo.exe │ ├── monte carlo.layout │ ├── pie.cpp │ └── pie.o ├── Poker test └── poker.c ├── README.md └── Random Numbers Generation ├── README.md └── random numbers.c /Chi square test/chi.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | #define INTERVALS 10 // number of intervals 7 | #define tabulated_value 16.919 // we assumed LOS=5% and DF=9 8 | 9 | int main(void) 10 | { 11 | int x0=7,x1; //xo=seed, x1=next random number to be generated 12 | int a=5,c=3,m=100; //a=constant multiplier, c=increment, m=modulus 13 | int n = 100; // size of the sample 14 | int lb[INTERVALS] = {0, 10, 20, 30, 40, 50, 60, 70, 80, 90}; // lower bounds of the intervals 15 | int ub[INTERVALS] = {9, 19, 29, 39, 49, 59, 69, 79, 89, 99}; // upper bounds of the intervals 16 | int observed[INTERVALS] = {0},expected,N=0;; // observed frequencies ,expected frequency,total of observed frequency 17 | int i,j,array[100]; //o store the random numbers generated 18 | float final,calculation[20]; 19 | 20 | /* Calculation is the value of (Oi-Ei)^2/Ei for each intervals and final is the total calculated value of all intervals */ 21 | 22 | printf("The random numbers are:\n"); 23 | 24 | for (i = 0; i < n; i++) // generate random numbers between 0 and 99 using m=100 and mixed congruential method 25 | { 26 | x1=(a*x0+c) %m; 27 | array[i]=x1; 28 | x0=x1; 29 | printf("%d\t" ,array[i]); 30 | } 31 | 32 | for (i = 0; i < n; i++) // calculating observed frequency for each interval 33 | { 34 | for (j = 0; j < INTERVALS; j++) 35 | { 36 | if (array[i]>= lb[j] && array[i] <= ub[j]) 37 | { 38 | observed[j]++; 39 | break; 40 | } 41 | } 42 | } 43 | 44 | 45 | //calculation of N(total frequency), Calculation(((Oi-Ei)^2/Ei)),final 46 | expected=n/INTERVALS; 47 | for(i=0;i Tabulated value= %f . So, the null hypothesis is rejected and hence the random numbers are not uniform." ,final,tabulated_value); 74 | } 75 | return 0; 76 | 77 | } 78 | 79 | -------------------------------------------------------------------------------- /Continuous System Simulation (chemical reaction)/chemicalrecn.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | int main() 5 | { 6 | 7 | int i=0; 8 | float c1[1000],c2[1000],c3[1000];// C1 C2 C3 are the amount of chemicals Ch1 Ch2 Ch3 9 | float k1=0.025,k2=0.01,dt=0.001; // k1 k2 are the constants 10 | c1[0]=70.0,c2[0]=35.0,c3[0]=0.0; // amount of chemicals Ch1 Ch2 Ch3 at time 0 11 | float t=0.0, time=100.0; // time represents the total reaction time and t represents loop time, that increases by dt 12 | FILE *fp; 13 | fp=fopen("lab01.txt","w"); // write the output data to lab01.txt 14 | printf("Simulating reaction....."); 15 | 16 | while(t<=time) 17 | { 18 | 19 | c1[i+1]=c1[i]+(k2*c3[i]-k1*c1[i]*c2[i])*dt; // this represents the amount of change in ch1 ch2 ch3 with respect to dt time 20 | c2[i+1]=c2[i]+(k2*c3[i]-k1*c1[i]*c2[i])*dt; 21 | c3[i+1]=c3[i]+2.0*(k1*c1[i]*c2[i]-k2*c3[i])*dt; 22 | 23 | fprintf(fp,"\n%f %f %f",c1[i],c2[i],c3[i]); 24 | 25 | i=i+1; // i inreases by 1 26 | t=t+dt; // and t increases by dt time 27 | 28 | } 29 | fclose(fp); 30 | return 0; 31 | 32 | } 33 | 34 | -------------------------------------------------------------------------------- /Continuous System Simulation (chemical reaction)/lab01.txt: -------------------------------------------------------------------------------- 1 | 2 | 70.000000 35.000000 0.000000 3 | 69.938751 34.938751 0.122500 4 | 69.877663 34.877663 0.244676 5 | 69.816734 34.816734 0.366530 6 | 69.755966 34.755970 0.488062 7 | 69.695358 34.695362 0.609274 8 | 69.634911 34.634914 0.730167 9 | 69.574623 34.574627 0.850743 10 | 69.514496 34.514496 0.971001 11 | 69.454521 34.454525 1.090945 12 | 69.394707 34.394711 1.210574 13 | 69.335045 34.335052 1.329890 14 | 69.275543 34.275551 1.448895 15 | 69.216194 34.216206 1.567589 16 | 69.157005 34.157013 1.685973 17 | 69.097969 34.097977 1.804049 18 | 69.039085 34.039093 1.921818 19 | 68.980354 33.980362 2.039281 20 | 68.921776 33.921783 2.156440 21 | 68.863350 33.863358 2.273294 22 | 68.805077 33.805080 2.389846 23 | 68.746948 33.746956 2.506096 24 | 68.688972 33.688980 2.622046 25 | 68.631149 33.631153 2.737696 26 | 68.573471 33.573479 2.853049 27 | 68.515945 33.515949 2.968104 28 | 68.458565 33.458569 3.082864 29 | 68.401329 33.401337 3.197328 30 | 68.344246 33.344250 3.311499 31 | 68.287308 33.287312 3.425377 32 | 68.230515 33.230518 3.538964 33 | 68.173866 33.173870 3.652260 34 | 68.117363 33.117367 3.765266 35 | 68.061005 33.061008 3.877985 36 | 68.004791 33.004791 3.990415 37 | 67.948723 32.948719 4.102560 38 | 67.892792 32.892788 4.214419 39 | 67.837006 32.837002 4.325994 40 | 67.781357 32.781357 4.437285 41 | 67.725853 32.725853 4.548295 42 | 67.670486 32.670490 4.659023 43 | 67.615265 32.615265 4.769472 44 | 67.560181 32.560181 4.879641 45 | 67.505234 32.505234 4.989532 46 | 67.450424 32.450428 5.099145 47 | 67.395752 32.395760 5.208483 48 | 67.341217 32.341228 5.317546 49 | 67.286819 32.286835 5.426334 50 | 67.232559 32.232578 5.534850 51 | 67.178436 32.178455 5.643093 52 | 67.124451 32.124470 5.751065 53 | 67.070602 32.070618 5.858767 54 | 67.016884 32.016903 5.966200 55 | 66.963303 31.963322 6.073364 56 | 66.909851 31.909874 6.180261 57 | 66.856537 31.856558 6.286892 58 | 66.803352 31.803375 6.393257 59 | 66.750305 31.750324 6.499358 60 | 66.697388 31.697405 6.605195 61 | 66.644600 31.644617 6.710770 62 | 66.591942 31.591961 6.816082 63 | 66.539413 31.539434 6.921134 64 | 66.487015 31.487038 7.025927 65 | 66.434746 31.434771 7.130461 66 | 66.382607 31.382633 7.234736 67 | 66.330597 31.330624 7.338754 68 | 66.278717 31.278742 7.442516 69 | 66.226967 31.226988 7.546023 70 | 66.175339 31.175362 7.649276 71 | 66.123840 31.123861 7.752275 72 | 66.072464 31.072489 7.855021 73 | 66.021217 31.021242 7.957516 74 | 65.970093 30.970119 8.059760 75 | 65.919098 30.919123 8.161754 76 | 65.868225 30.868250 8.263498 77 | 65.817474 30.817501 8.364995 78 | 65.766853 30.766876 8.466244 79 | 65.716354 30.716375 8.567246 80 | 65.665977 30.665997 8.668003 81 | 65.615723 30.615740 8.768516 82 | 65.565590 30.565605 8.868784 83 | 65.515579 30.515593 8.968809 84 | 65.465691 30.465700 9.068592 85 | 65.415916 30.415930 9.168134 86 | 65.366264 30.366280 9.267435 87 | 65.316734 30.316750 9.366496 88 | 65.267326 30.267338 9.465319 89 | 65.218033 30.218046 9.563903 90 | 65.168861 30.168873 9.662250 91 | 65.119804 30.119818 9.760360 92 | 65.070869 30.070881 9.858234 93 | 65.022049 30.022060 9.955874 94 | 64.973343 29.973358 10.053280 95 | 64.924759 29.924772 10.150453 96 | 64.876289 29.876303 10.247393 97 | 64.827934 29.827950 10.344101 98 | 64.779694 29.779711 10.440578 99 | 64.731567 29.731586 10.536826 100 | 64.683556 29.683577 10.632844 101 | 64.635658 29.635681 10.728633 102 | 64.587875 29.587900 10.824195 103 | 64.540207 29.540234 10.919529 104 | 64.492653 29.492680 11.014637 105 | 64.445213 29.445238 11.109520 106 | 64.397881 29.397909 11.204178 107 | 64.350662 29.350693 11.298612 108 | 64.303558 29.303587 11.392822 109 | 64.256561 29.256594 11.486811 110 | 64.209679 29.209711 11.580577 111 | 64.162903 29.162939 11.674123 112 | 64.116241 29.116276 11.767448 113 | 64.069687 29.069723 11.860555 114 | 64.023247 29.023279 11.953442 115 | 63.976913 28.976944 12.046111 116 | 63.930687 28.930717 12.138563 117 | 63.884571 28.884600 12.230799 118 | 63.838562 28.838591 12.322818 119 | 63.792660 28.792688 12.414622 120 | 63.746864 28.746893 12.506212 121 | 63.701176 28.701204 12.597589 122 | 63.655594 28.655622 12.688751 123 | 63.610119 28.610147 12.779702 124 | 63.564751 28.564777 12.870441 125 | 63.519485 28.519514 12.960970 126 | 63.474327 28.474356 13.051288 127 | 63.429272 28.429302 13.141397 128 | 63.384323 28.384352 13.231297 129 | 63.339478 28.339506 13.320988 130 | 63.294735 28.294764 13.410472 131 | 63.250095 28.250124 13.499749 132 | 63.205559 28.205589 13.588820 133 | 63.161125 28.161156 13.677686 134 | 63.116795 28.116825 13.766347 135 | 63.072567 28.072598 13.854804 136 | 63.028439 28.028471 13.943057 137 | 62.984413 27.984446 14.031108 138 | 62.940491 27.940521 14.118957 139 | 62.896667 27.896698 14.206604 140 | 62.852943 27.852974 14.294050 141 | 62.809319 27.809351 14.381296 142 | 62.765797 27.765827 14.468343 143 | 62.722374 27.722403 14.555191 144 | 62.679050 27.679077 14.641841 145 | 62.635826 27.635851 14.728293 146 | 62.592697 27.592724 14.814548 147 | 62.549667 27.549694 14.900607 148 | 62.506737 27.506762 14.986470 149 | 62.463902 27.463928 15.072139 150 | 62.421165 27.421192 15.157613 151 | 62.378525 27.378551 15.242893 152 | 62.335979 27.336008 15.327980 153 | 62.293533 27.293560 15.412874 154 | 62.251183 27.251209 15.497577 155 | 62.208927 27.208954 15.582088 156 | 62.166767 27.166794 15.666408 157 | 62.124702 27.124729 15.750538 158 | 62.082733 27.082758 15.834478 159 | 62.040855 27.040882 15.918230 160 | 61.999073 26.999100 16.001793 161 | 61.957386 26.957413 16.085169 162 | 61.915791 26.915819 16.168358 163 | 61.874290 26.874317 16.251360 164 | 61.832882 26.832909 16.334177 165 | 61.791565 26.791594 16.416809 166 | 61.750343 26.750370 16.499256 167 | 61.709213 26.709238 16.581518 168 | 61.668175 26.668200 16.663597 169 | 61.627228 26.627253 16.745493 170 | 61.586372 26.586395 16.827206 171 | 61.545609 26.545630 16.908737 172 | 61.504932 26.504955 16.990088 173 | 61.464348 26.464371 17.071257 174 | 61.423855 26.423876 17.152246 175 | 61.383450 26.383471 17.233057 176 | 61.343136 26.343155 17.313688 177 | 61.302910 26.302929 17.394140 178 | 61.262772 26.262793 17.474415 179 | 61.222725 26.222744 17.554512 180 | 61.182766 26.182783 17.634432 181 | 61.142895 26.142912 17.714176 182 | 61.103111 26.103128 17.793745 183 | 61.063416 26.063433 17.873138 184 | 61.023808 26.023823 17.952356 185 | 60.984283 25.984301 18.031401 186 | 60.944847 25.944864 18.110271 187 | 60.905499 25.905516 18.188969 188 | 60.866234 25.866253 18.267494 189 | 60.827057 25.827076 18.345848 190 | 60.787964 25.787985 18.424030 191 | 60.748959 25.748980 18.502041 192 | 60.710037 25.710058 18.579882 193 | 60.671200 25.671223 18.657553 194 | 60.632450 25.632471 18.735054 195 | 60.593784 25.593805 18.812387 196 | 60.555202 25.555223 18.889553 197 | 60.516705 25.516726 18.966551 198 | 60.478291 25.478310 19.043381 199 | 60.439960 25.439978 19.120045 200 | 60.401711 25.401730 19.196543 201 | 60.363544 25.363564 19.272875 202 | 60.325462 25.325480 19.349041 203 | 60.287460 25.287479 19.425043 204 | 60.249542 25.249561 19.500881 205 | 60.211704 25.211725 19.576555 206 | 60.173950 25.173969 19.652065 207 | 60.136276 25.136295 19.727413 208 | 60.098682 25.098703 19.802599 209 | 60.061169 25.061192 19.877623 210 | 60.023739 25.023760 19.952486 211 | 59.986389 24.986408 20.027187 212 | 59.949120 24.949137 20.101728 213 | 59.911930 24.911945 20.176111 214 | 59.874817 24.874834 20.250334 215 | 59.837784 24.837803 20.324398 216 | 59.800831 24.800850 20.398304 217 | 59.763958 24.763977 20.472052 218 | 59.727161 24.727182 20.545641 219 | 59.690445 24.690466 20.619074 220 | 59.653805 24.653828 20.692350 221 | 59.617245 24.617268 20.765471 222 | 59.580761 24.580786 20.838436 223 | 59.544357 24.544380 20.911247 224 | 59.508030 24.508053 20.983904 225 | 59.471779 24.471802 21.056406 226 | 59.435604 24.435627 21.128754 227 | 59.399506 24.399530 21.200949 228 | 59.363483 24.363510 21.272991 229 | 59.327538 24.327566 21.344881 230 | 59.291668 24.291697 21.416618 231 | 59.255875 24.255903 21.488205 232 | 59.220158 24.220186 21.559641 233 | 59.184517 24.184544 21.630926 234 | 59.148949 24.148975 21.702061 235 | 59.113457 24.113483 21.773046 236 | 59.078037 24.078066 21.843884 237 | 59.042694 24.042723 21.914572 238 | 59.007423 24.007454 21.985111 239 | 58.972229 23.972258 22.055502 240 | 58.937107 23.937136 22.125746 241 | 58.902058 23.902088 22.195843 242 | 58.867081 23.867113 22.265793 243 | 58.832180 23.832211 22.335596 244 | 58.797352 23.797380 22.405254 245 | 58.762596 23.762625 22.474768 246 | 58.727913 23.727942 22.544136 247 | 58.693302 23.693329 22.613359 248 | 58.658764 23.658789 22.682440 249 | 58.624294 23.624321 22.751375 250 | 58.589897 23.589924 22.820168 251 | 58.555573 23.555599 22.888817 252 | 58.521320 23.521345 22.957325 253 | 58.487137 23.487162 23.025690 254 | 58.453026 23.453049 23.093914 255 | 58.418983 23.419006 23.161997 256 | 58.385014 23.385035 23.229939 257 | 58.351112 23.351133 23.297741 258 | 58.317280 23.317303 23.365404 259 | 58.283520 23.283541 23.432926 260 | 58.249828 23.249849 23.500309 261 | 58.216206 23.216227 23.567554 262 | 58.182652 23.182673 23.634661 263 | 58.149166 23.149189 23.701630 264 | 58.115749 23.115774 23.768461 265 | 58.082401 23.082428 23.835155 266 | 58.049122 23.049149 23.901712 267 | 58.015911 23.015938 23.968134 268 | 57.982769 22.982796 24.034420 269 | 57.949696 22.949720 24.100569 270 | 57.916687 22.916714 24.166584 271 | 57.883747 22.883774 24.232464 272 | 57.850876 22.850901 24.298208 273 | 57.818069 22.818094 24.363819 274 | 57.785332 22.785355 24.429296 275 | 57.752659 22.752682 24.494640 276 | 57.720055 22.720076 24.559853 277 | 57.687515 22.687536 24.624931 278 | 57.655041 22.655064 24.689878 279 | 57.622635 22.622656 24.754694 280 | 57.590294 22.590315 24.819378 281 | 57.558018 22.558039 24.883930 282 | 57.525806 22.525827 24.948353 283 | 57.493660 22.493681 25.012644 284 | 57.461578 22.461599 25.076805 285 | 57.429562 22.429583 25.140837 286 | 57.397610 22.397631 25.204741 287 | 57.365723 22.365744 25.268515 288 | 57.333900 22.333921 25.332161 289 | 57.302143 22.302162 25.395679 290 | 57.270447 22.270468 25.459070 291 | 57.238815 22.238836 25.522333 292 | 57.207249 22.207268 25.585468 293 | 57.175743 22.175764 25.648478 294 | 57.144302 22.144323 25.711361 295 | 57.112923 22.112946 25.774118 296 | 57.081608 22.081631 25.836750 297 | 57.050354 22.050377 25.899256 298 | 57.019165 22.019186 25.961637 299 | 56.988037 21.988058 26.023893 300 | 56.956970 21.956991 26.086025 301 | 56.925964 21.925987 26.148033 302 | 56.895023 21.895044 26.209919 303 | 56.864143 21.864164 26.271681 304 | 56.833324 21.833345 26.333321 305 | 56.802567 21.802588 26.394836 306 | 56.771870 21.771891 26.456230 307 | 56.741234 21.741255 26.517502 308 | 56.710659 21.710680 26.578653 309 | 56.680145 21.680164 26.639683 310 | 56.649693 21.649710 26.700592 311 | 56.619297 21.619316 26.761381 312 | 56.588963 21.588982 26.822050 313 | 56.558689 21.558708 26.882599 314 | 56.528473 21.528494 26.943027 315 | 56.498318 21.498339 27.003338 316 | 56.468224 21.468243 27.063528 317 | 56.438187 21.438206 27.123600 318 | 56.408211 21.408228 27.183554 319 | 56.378292 21.378309 27.243389 320 | 56.348434 21.348450 27.303108 321 | 56.318634 21.318649 27.362709 322 | 56.288891 21.288906 27.422194 323 | 56.259209 21.259222 27.481562 324 | 56.229584 21.229597 27.540813 325 | 56.200016 21.200029 27.599949 326 | 56.170506 21.170519 27.658970 327 | 56.141052 21.141066 27.717875 328 | 56.111656 21.111671 27.776665 329 | 56.082317 21.082335 27.835340 330 | 56.053036 21.053055 27.893902 331 | 56.023811 21.023832 27.952349 332 | 55.994644 20.994665 28.010681 333 | 55.965534 20.965555 28.068901 334 | 55.936481 20.936502 28.127007 335 | 55.907486 20.907505 28.184999 336 | 55.878544 20.878565 28.242880 337 | 55.849659 20.849680 28.300648 338 | 55.820831 20.820852 28.358305 339 | 55.792061 20.792080 28.415850 340 | 55.763344 20.763363 28.473284 341 | 55.734684 20.734701 28.530605 342 | 55.706078 20.706095 28.587816 343 | 55.677528 20.677544 28.644917 344 | 55.649033 20.649048 28.701908 345 | 55.620594 20.620607 28.758789 346 | 55.592209 20.592222 28.815561 347 | 55.563877 20.563890 28.872223 348 | 55.535599 20.535614 28.928776 349 | 55.507378 20.507391 28.985220 350 | 55.479210 20.479223 29.041555 351 | 55.451096 20.451109 29.097784 352 | 55.423035 20.423050 29.153904 353 | 55.395027 20.395044 29.209917 354 | 55.367073 20.367092 29.265821 355 | 55.339172 20.339193 29.321619 356 | 55.311325 20.311348 29.377310 357 | 55.283531 20.283556 29.432894 358 | 55.255791 20.255817 29.488373 359 | 55.228104 20.228130 29.543745 360 | 55.200470 20.200497 29.599012 361 | 55.172890 20.172916 29.654175 362 | 55.145363 20.145388 29.709232 363 | 55.117886 20.117912 29.764185 364 | 55.090462 20.090488 29.819033 365 | 55.063091 20.063116 29.873775 366 | 55.035770 20.035797 29.928415 367 | 55.008503 20.008530 29.982950 368 | 54.981285 19.981314 30.037382 369 | 54.954121 19.954149 30.091711 370 | 54.927006 19.927036 30.145937 371 | 54.899944 19.899975 30.200060 372 | 54.872932 19.872965 30.254082 373 | 54.845974 19.846004 30.308001 374 | 54.819065 19.819096 30.361818 375 | 54.792206 19.792238 30.415535 376 | 54.765400 19.765430 30.469151 377 | 54.738644 19.738674 30.522665 378 | 54.711937 19.711967 30.576078 379 | 54.685280 19.685310 30.629391 380 | 54.658672 19.658705 30.682604 381 | 54.632114 19.632149 30.735716 382 | 54.605610 19.605642 30.788729 383 | 54.579155 19.579185 30.841642 384 | 54.552750 19.552778 30.894457 385 | 54.526394 19.526421 30.947172 386 | 54.500084 19.500113 30.999788 387 | 54.473824 19.473854 31.052307 388 | 54.447613 19.447643 31.104727 389 | 54.421452 19.421482 31.157049 390 | 54.395340 19.395370 31.209272 391 | 54.369278 19.369307 31.261398 392 | 54.343262 19.343292 31.313427 393 | 54.317295 19.317326 31.365360 394 | 54.291378 19.291409 31.417196 395 | 54.265507 19.265539 31.468935 396 | 54.239685 19.239717 31.520578 397 | 54.213913 19.213943 31.572126 398 | 54.188187 19.188217 31.623579 399 | 54.162510 19.162539 31.674934 400 | 54.136879 19.136908 31.726196 401 | 54.111298 19.111324 31.777363 402 | 54.085762 19.085789 31.828434 403 | 54.060272 19.060301 31.879412 404 | 54.034832 19.034859 31.930294 405 | 54.009438 19.009464 31.981083 406 | 53.984089 18.984118 32.031776 407 | 53.958790 18.958817 32.082378 408 | 53.933537 18.933563 32.132885 409 | 53.908329 18.908356 32.183300 410 | 53.883167 18.883194 32.233624 411 | 53.858051 18.858080 32.283852 412 | 53.832981 18.833012 32.333988 413 | 53.807957 18.807989 32.384033 414 | 53.782982 18.783012 32.433987 415 | 53.758053 18.758081 32.483849 416 | 53.733170 18.733196 32.533619 417 | 53.708328 18.708357 32.583298 418 | 53.683533 18.683563 32.632885 419 | 53.658783 18.658815 32.682381 420 | 53.634079 18.634111 32.731789 421 | 53.609421 18.609453 32.781105 422 | 53.584808 18.584841 32.830330 423 | 53.560242 18.560272 32.879467 424 | 53.535717 18.535749 32.928513 425 | 53.511238 18.511271 32.977470 426 | 53.486805 18.486835 33.026340 427 | 53.462414 18.462446 33.075119 428 | 53.438068 18.438101 33.123810 429 | 53.413769 18.413799 33.172413 430 | 53.389511 18.389542 33.220928 431 | 53.365299 18.365328 33.269356 432 | 53.341129 18.341158 33.317696 433 | 53.317005 18.317032 33.365948 434 | 53.292923 18.292950 33.414112 435 | 53.268887 18.268911 33.462189 436 | 53.244892 18.244917 33.510178 437 | 53.220940 18.220966 33.558079 438 | 53.197033 18.197058 33.605896 439 | 53.173168 18.173193 33.653625 440 | 53.149345 18.149372 33.701267 441 | 53.125568 18.125593 33.748825 442 | 53.101833 18.101858 33.796295 443 | 53.078140 18.078165 33.843681 444 | 53.054489 18.054514 33.890984 445 | 53.030880 18.030907 33.938198 446 | 53.007313 18.007341 33.985329 447 | 52.983791 17.983818 34.032375 448 | 52.960312 17.960337 34.079338 449 | 52.936874 17.936897 34.126217 450 | 52.913479 17.913500 34.173012 451 | 52.890125 17.890144 34.219723 452 | 52.866814 17.866831 34.266350 453 | 52.843544 17.843559 34.312893 454 | 52.820313 17.820330 34.359352 455 | 52.797123 17.797142 34.405727 456 | 52.773975 17.773994 34.452023 457 | 52.750870 17.750889 34.498234 458 | 52.727806 17.727825 34.544361 459 | 52.704784 17.704802 34.590408 460 | 52.681801 17.681820 34.636372 461 | 52.658859 17.658878 34.682255 462 | 52.635960 17.635977 34.728058 463 | 52.613098 17.613117 34.773777 464 | 52.590279 17.590298 34.819416 465 | 52.567501 17.567518 34.864975 466 | 52.544762 17.544781 34.910450 467 | 52.522064 17.522083 34.955845 468 | 52.499405 17.499426 35.001160 469 | 52.476788 17.476809 35.046394 470 | 52.454208 17.454231 35.091549 471 | 52.431671 17.431694 35.136623 472 | 52.409172 17.409197 35.181618 473 | 52.386715 17.386738 35.226536 474 | 52.364296 17.364319 35.271374 475 | 52.341915 17.341940 35.316132 476 | 52.319576 17.319601 35.360809 477 | 52.297276 17.297300 35.405411 478 | 52.275013 17.275040 35.449932 479 | 52.252792 17.252817 35.494377 480 | 52.230610 17.230635 35.538742 481 | 52.208466 17.208490 35.583031 482 | 52.186359 17.186386 35.627239 483 | 52.164295 17.164320 35.671371 484 | 52.142269 17.142292 35.715427 485 | 52.120281 17.120304 35.759403 486 | 52.098331 17.098354 35.803303 487 | 52.076420 17.076443 35.847126 488 | 52.054546 17.054569 35.890873 489 | 52.032711 17.032734 35.934544 490 | 52.010914 17.010937 35.978138 491 | 51.989155 16.989178 36.021656 492 | 51.967434 16.967457 36.065098 493 | 51.945751 16.945774 36.108463 494 | 51.924107 16.924129 36.151752 495 | 51.902500 16.902521 36.194969 496 | 51.880932 16.880951 36.238110 497 | 51.859398 16.859419 36.281174 498 | 51.837902 16.837923 36.324165 499 | 51.816444 16.816465 36.367081 500 | 51.795025 16.795044 36.409924 501 | 51.773640 16.773661 36.452690 502 | 51.752293 16.752314 36.495384 503 | 51.730984 16.731005 36.538002 504 | 51.709713 16.709732 36.580547 505 | 51.688477 16.688496 36.623020 506 | 51.667278 16.667297 36.665417 507 | 51.646114 16.646135 36.707741 508 | 51.624989 16.625010 36.749992 509 | 51.603901 16.603920 36.792171 510 | 51.582848 16.582867 36.834278 511 | 51.561832 16.561850 36.876312 512 | 51.540852 16.540869 36.918274 513 | 51.519909 16.519924 36.960163 514 | 51.499001 16.499016 37.001980 515 | 51.478130 16.478144 37.043724 516 | 51.457294 16.457308 37.085396 517 | 51.436493 16.436508 37.126995 518 | 51.415730 16.415743 37.168526 519 | 51.395000 16.395014 37.209984 520 | 51.374306 16.374321 37.251369 521 | 51.353649 16.353662 37.292686 522 | 51.333027 16.333040 37.333931 523 | 51.312439 16.312452 37.375107 524 | 51.291885 16.291901 37.416210 525 | 51.271370 16.271383 37.457245 526 | 51.250889 16.250902 37.498207 527 | 51.230442 16.230455 37.539101 528 | 51.210030 16.210043 37.579926 529 | 51.189651 16.189667 37.620678 530 | 51.169308 16.169325 37.661362 531 | 51.148998 16.149017 37.701977 532 | 51.128727 16.128744 37.742523 533 | 51.108490 16.108505 37.783001 534 | 51.088287 16.088301 37.823410 535 | 51.068119 16.068130 37.863750 536 | 51.047985 16.047995 37.904022 537 | 51.027885 16.027893 37.944225 538 | 51.007816 16.007826 37.984360 539 | 50.987782 15.987793 38.024426 540 | 50.967781 15.967793 38.064423 541 | 50.947815 15.947828 38.104355 542 | 50.927883 15.927896 38.144218 543 | 50.907986 15.907999 38.184013 544 | 50.888123 15.888135 38.223743 545 | 50.868294 15.868304 38.263405 546 | 50.848495 15.848507 38.302998 547 | 50.828732 15.828743 38.342525 548 | 50.809002 15.809012 38.381985 549 | 50.789307 15.789315 38.421379 550 | 50.769642 15.769651 38.460709 551 | 50.750011 15.750021 38.499969 552 | 50.730415 15.730423 38.539165 553 | 50.710850 15.710858 38.578297 554 | 50.691319 15.691326 38.617359 555 | 50.671818 15.671827 38.656357 556 | 50.652351 15.652361 38.695290 557 | 50.632919 15.632927 38.734158 558 | 50.613518 15.613525 38.772961 559 | 50.594151 15.594156 38.811699 560 | 50.574814 15.574821 38.850372 561 | 50.555511 15.555516 38.888981 562 | 50.536240 15.536244 38.927525 563 | 50.517002 15.517005 38.966003 564 | 50.497795 15.497798 39.004417 565 | 50.478619 15.478622 39.042767 566 | 50.459476 15.459479 39.081051 567 | 50.440365 15.440369 39.119274 568 | 50.421284 15.421289 39.157433 569 | 50.402237 15.402242 39.195526 570 | 50.383221 15.383226 39.233559 571 | 50.364235 15.364243 39.271526 572 | 50.345284 15.345290 39.309433 573 | 50.326363 15.326369 39.347275 574 | 50.307472 15.307480 39.385056 575 | 50.288612 15.288622 39.422771 576 | 50.269787 15.269795 39.460426 577 | 50.250992 15.250999 39.498016 578 | 50.232227 15.232235 39.535545 579 | 50.213493 15.213502 39.573013 580 | 50.194790 15.194799 39.610416 581 | 50.176117 15.176128 39.647758 582 | 50.157478 15.157488 39.685040 583 | 50.138870 15.138878 39.722260 584 | 50.120293 15.120299 39.759418 585 | 50.101746 15.101751 39.796516 586 | 50.083229 15.083234 39.833553 587 | 50.064743 15.064747 39.870529 588 | 50.046288 15.046290 39.907444 589 | 50.027863 15.027864 39.944298 590 | 50.009468 15.009469 39.981091 591 | 49.991104 14.991103 40.017822 592 | 49.972767 14.972768 40.054493 593 | 49.954460 14.954463 40.091103 594 | 49.936184 14.936188 40.127651 595 | 49.917938 14.917943 40.164143 596 | 49.899723 14.899728 40.200573 597 | 49.881538 14.881542 40.236942 598 | 49.863384 14.863387 40.273254 599 | 49.845257 14.845262 40.309505 600 | 49.827160 14.827166 40.345699 601 | 49.809093 14.809099 40.381832 602 | 49.791058 14.791062 40.417908 603 | 49.773048 14.773055 40.453922 604 | 49.755070 14.755077 40.489880 605 | 49.737122 14.737129 40.525776 606 | 49.719204 14.719210 40.561615 607 | 49.701313 14.701320 40.597397 608 | 49.683453 14.683458 40.633118 609 | 49.665623 14.665627 40.668781 610 | 49.647820 14.647823 40.704388 611 | 49.630047 14.630050 40.739937 612 | 49.612301 14.612305 40.775425 613 | 49.594585 14.594588 40.810856 614 | 49.576897 14.576901 40.846230 615 | 49.559238 14.559243 40.881546 616 | 49.541607 14.541614 40.916805 617 | 49.524006 14.524013 40.952007 618 | 49.506432 14.506440 40.987152 619 | 49.488888 14.488896 41.022240 620 | 49.471371 14.471380 41.057270 621 | 49.453884 14.453893 41.092243 622 | 49.436424 14.436434 41.127163 623 | 49.418995 14.419003 41.162025 624 | 49.401592 14.401600 41.196831 625 | 49.384216 14.384225 41.231579 626 | 49.366871 14.366879 41.266273 627 | 49.349552 14.349560 41.300911 628 | 49.332260 14.332269 41.335491 629 | 49.314999 14.315006 41.370018 630 | 49.297764 14.297771 41.404488 631 | 49.280556 14.280564 41.438904 632 | 49.263378 14.263385 41.473263 633 | 49.246227 14.246233 41.507565 634 | 49.229103 14.229109 41.541813 635 | 49.212006 14.212012 41.576008 636 | 49.194935 14.194943 41.610146 637 | 49.177895 14.177901 41.644230 638 | 49.160881 14.160887 41.678261 639 | 49.143894 14.143900 41.712234 640 | 49.126934 14.126940 41.746155 641 | 49.110001 14.110007 41.780022 642 | 49.093094 14.093102 41.813831 643 | 49.076214 14.076222 41.847588 644 | 49.059361 14.059371 41.881290 645 | 49.042534 14.042546 41.914940 646 | 49.025738 14.025748 41.948536 647 | 49.008968 14.008977 41.982079 648 | 48.992226 13.992232 42.015568 649 | 48.975510 13.975514 42.049004 650 | 48.958820 13.958823 42.082386 651 | 48.942158 13.942159 42.115715 652 | 48.925518 13.925521 42.148991 653 | 48.908905 13.908910 42.182213 654 | 48.892319 13.892324 42.215382 655 | 48.875759 13.875766 42.248497 656 | 48.859226 13.859234 42.281563 657 | 48.842720 13.842728 42.314575 658 | 48.826241 13.826248 42.347534 659 | 48.809788 13.809794 42.380440 660 | 48.793362 13.793366 42.413296 661 | 48.776958 13.776965 42.446098 662 | 48.760582 13.760590 42.478848 663 | 48.744232 13.744240 42.511547 664 | 48.727909 13.727916 42.544193 665 | 48.711613 13.711617 42.576790 666 | 48.695339 13.695345 42.609333 667 | 48.679092 13.679098 42.641827 668 | 48.662872 13.662877 42.674267 669 | 48.646679 13.646682 42.706657 670 | 48.630508 13.630512 42.738998 671 | 48.614365 13.614368 42.771286 672 | 48.598248 13.598249 42.803524 673 | 48.582153 13.582156 42.835709 674 | 48.566086 13.566089 42.867844 675 | 48.550045 13.550046 42.899929 676 | 48.534027 13.534029 42.931965 677 | 48.518036 13.518037 42.963951 678 | 48.502068 13.502069 42.995884 679 | 48.486126 13.486128 43.027767 680 | 48.470207 13.470211 43.059601 681 | 48.454315 13.454319 43.091385 682 | 48.438450 13.438452 43.123119 683 | 48.422607 13.422609 43.154804 684 | 48.406792 13.406792 43.186440 685 | 48.390999 13.390999 43.218025 686 | 48.375233 13.375231 43.249561 687 | 48.359489 13.359488 43.281048 688 | 48.343769 13.343769 43.312485 689 | 48.328075 13.328075 43.343872 690 | 48.312405 13.312406 43.375210 691 | 48.296761 13.296761 43.406502 692 | 48.281139 13.281140 43.437744 693 | 48.265545 13.265544 43.468937 694 | 48.249973 13.249972 43.500080 695 | 48.234425 13.234425 43.531178 696 | 48.218903 13.218901 43.562225 697 | 48.203403 13.203402 43.593224 698 | 48.187927 13.187926 43.624176 699 | 48.172478 13.172475 43.655079 700 | 48.157051 13.157047 43.685932 701 | 48.141647 13.141644 43.716740 702 | 48.126266 13.126266 43.747498 703 | 48.110912 13.110910 43.778210 704 | 48.095581 13.095579 43.808872 705 | 48.080273 13.080272 43.839489 706 | 48.064987 13.064987 43.870056 707 | 48.049728 13.049726 43.900578 708 | 48.034492 13.034490 43.931053 709 | 48.019279 13.019277 43.961479 710 | 48.004089 13.004086 43.991859 711 | 47.988922 12.988920 44.022194 712 | 47.973778 12.973778 44.052479 713 | 47.958660 12.958658 44.082718 714 | 47.943565 12.943563 44.112911 715 | 47.928493 12.928490 44.143059 716 | 47.913445 12.913440 44.173157 717 | 47.898418 12.898414 44.203209 718 | 47.883415 12.883410 44.233215 719 | 47.868435 12.868430 44.263176 720 | 47.853477 12.853473 44.293091 721 | 47.838543 12.838538 44.322960 722 | 47.823631 12.823627 44.352783 723 | 47.808743 12.808739 44.382561 724 | 47.793877 12.793873 44.412292 725 | 47.779034 12.779030 44.441978 726 | 47.764214 12.764210 44.471619 727 | 47.749416 12.749413 44.501213 728 | 47.734642 12.734638 44.530762 729 | 47.719891 12.719887 44.560265 730 | 47.705162 12.705157 44.589722 731 | 47.690456 12.690451 44.619137 732 | 47.675774 12.675767 44.648506 733 | 47.661114 12.661105 44.677830 734 | 47.646473 12.646466 44.707108 735 | 47.631855 12.631849 44.736340 736 | 47.617260 12.617254 44.765530 737 | 47.602688 12.602682 44.794674 738 | 47.588139 12.588132 44.823772 739 | 47.573612 12.573604 44.852829 740 | 47.559105 12.559098 44.881840 741 | 47.544621 12.544615 44.910809 742 | 47.530159 12.530153 44.939732 743 | 47.515720 12.515714 44.968613 744 | 47.501305 12.501296 44.997448 745 | 47.486908 12.486900 45.026241 746 | 47.472534 12.472527 45.054989 747 | 47.458183 12.458175 45.083694 748 | 47.443851 12.443845 45.112354 749 | 47.429543 12.429536 45.140972 750 | 47.415257 12.415249 45.169544 751 | 47.400990 12.400984 45.198074 752 | 47.386745 12.386741 45.226563 753 | 47.372524 12.372519 45.255005 754 | 47.358322 12.358318 45.283405 755 | 47.344143 12.344139 45.311764 756 | 47.329987 12.329982 45.340080 757 | 47.315849 12.315845 45.368351 758 | 47.301735 12.301731 45.396580 759 | 47.287643 12.287638 45.424767 760 | 47.273571 12.273565 45.452911 761 | 47.259521 12.259515 45.481014 762 | 47.245491 12.245485 45.509075 763 | 47.231483 12.231477 45.537090 764 | 47.217495 12.217489 45.565063 765 | 47.203529 12.203523 45.592995 766 | 47.189583 12.189577 45.620884 767 | 47.175659 12.175653 45.648731 768 | 47.161755 12.161749 45.676537 769 | 47.147873 12.147866 45.704300 770 | 47.134010 12.134005 45.732021 771 | 47.120171 12.120164 45.759705 772 | 47.106350 12.106344 45.787346 773 | 47.092552 12.092545 45.814945 774 | 47.078773 12.078766 45.842503 775 | 47.065014 12.065008 45.870018 776 | 47.051277 12.051270 45.897491 777 | 47.037560 12.037554 45.924927 778 | 47.023865 12.023858 45.952320 779 | 47.010189 12.010182 45.979671 780 | 46.996532 11.996527 46.006981 781 | 46.982899 11.982892 46.034252 782 | 46.969284 11.969277 46.061481 783 | 46.955688 11.955684 46.088669 784 | 46.942116 11.942110 46.115818 785 | 46.928562 11.928556 46.142925 786 | 46.915028 11.915023 46.169991 787 | 46.901516 11.901509 46.197018 788 | 46.888023 11.888017 46.224003 789 | 46.874550 11.874544 46.250950 790 | 46.861095 11.861092 46.277855 791 | 46.847664 11.847659 46.304722 792 | 46.834251 11.834247 46.331547 793 | 46.820858 11.820854 46.358334 794 | 46.807484 11.807481 46.385078 795 | 46.794132 11.794127 46.411785 796 | 46.780800 11.780794 46.438450 797 | 46.767487 11.767481 46.465076 798 | 46.754192 11.754188 46.491665 799 | 46.740917 11.740913 46.518211 800 | 46.727661 11.727659 46.544720 801 | 46.714428 11.714424 46.571190 802 | 46.701214 11.701209 46.597622 803 | 46.688019 11.688013 46.624012 804 | 46.674843 11.674837 46.650364 805 | 46.661686 11.661680 46.676678 806 | 46.648548 11.648543 46.702953 807 | 46.635429 11.635426 46.729187 808 | 46.622330 11.622327 46.755383 809 | 46.609249 11.609248 46.781540 810 | 46.596188 11.596189 46.807659 811 | 46.583149 11.583148 46.833740 812 | 46.570129 11.570127 46.859783 813 | 46.557129 11.557124 46.885788 814 | 46.544147 11.544142 46.911755 815 | 46.531185 11.531178 46.937683 816 | 46.518242 11.518234 46.963573 817 | 46.505318 11.505309 46.989426 818 | 46.492413 11.492402 47.015240 819 | 46.479527 11.479514 47.041016 820 | 46.466660 11.466645 47.066753 821 | 46.453812 11.453795 47.092453 822 | 46.440979 11.440965 47.118114 823 | 46.428165 11.428153 47.143738 824 | 46.415371 11.415359 47.169323 825 | 46.402596 11.402585 47.194874 826 | 46.389839 11.389830 47.220387 827 | 46.377102 11.377092 47.245861 828 | 46.364384 11.364374 47.271297 829 | 46.351685 11.351674 47.296696 830 | 46.339005 11.338993 47.322060 831 | 46.326344 11.326330 47.347385 832 | 46.313698 11.313686 47.372673 833 | 46.301071 11.301061 47.397926 834 | 46.288464 11.288453 47.423141 835 | 46.275875 11.275865 47.448318 836 | 46.263306 11.263294 47.473461 837 | 46.250755 11.250742 47.498566 838 | 46.238220 11.238208 47.523632 839 | 46.225704 11.225692 47.548664 840 | 46.213207 11.213195 47.573658 841 | 46.200729 11.200716 47.598618 842 | 46.188267 11.188255 47.623539 843 | 46.175823 11.175813 47.648426 844 | 46.163399 11.163388 47.673275 845 | 46.150993 11.150982 47.698090 846 | 46.138603 11.138593 47.722866 847 | 46.126232 11.126222 47.747608 848 | 46.113880 11.113869 47.772312 849 | 46.101543 11.101534 47.796982 850 | 46.089226 11.089217 47.821617 851 | 46.076927 11.076918 47.846214 852 | 46.064648 11.064636 47.870777 853 | 46.052383 11.052373 47.895306 854 | 46.040138 11.040127 47.919796 855 | 46.027908 11.027899 47.944252 856 | 46.015697 11.015689 47.968674 857 | 46.003506 11.003496 47.993057 858 | 45.991329 10.991322 48.017406 859 | 45.979172 10.979164 48.041721 860 | 45.967033 10.967024 48.066002 861 | 45.954910 10.954902 48.090248 862 | 45.942806 10.942797 48.114456 863 | 45.930717 10.930709 48.138630 864 | 45.918648 10.918639 48.162769 865 | 45.906593 10.906587 48.186874 866 | 45.894558 10.894551 48.210945 867 | 45.882542 10.882533 48.234982 868 | 45.870541 10.870532 48.258984 869 | 45.858559 10.858549 48.282951 870 | 45.846592 10.846583 48.306885 871 | 45.834644 10.834635 48.330784 872 | 45.822712 10.822703 48.354649 873 | 45.810799 10.810789 48.378479 874 | 45.798901 10.798892 48.402275 875 | 45.787022 10.787011 48.426037 876 | 45.775158 10.775147 48.449764 877 | 45.763313 10.763301 48.473457 878 | 45.751484 10.751472 48.497116 879 | 45.739670 10.739659 48.520741 880 | 45.727875 10.727864 48.544331 881 | 45.716095 10.716085 48.567886 882 | 45.704334 10.704324 48.591412 883 | 45.692589 10.692579 48.614902 884 | 45.680862 10.680851 48.638359 885 | 45.669151 10.669140 48.661781 886 | 45.657455 10.657445 48.685169 887 | 45.645779 10.645767 48.708527 888 | 45.634117 10.634106 48.731850 889 | 45.622471 10.622461 48.755138 890 | 45.610844 10.610833 48.778393 891 | 45.599232 10.599222 48.801617 892 | 45.587635 10.587627 48.824806 893 | 45.576057 10.576049 48.847961 894 | 45.564495 10.564487 48.871086 895 | 45.552948 10.552941 48.894176 896 | 45.541420 10.541412 48.917236 897 | 45.529907 10.529900 48.940262 898 | 45.518410 10.518403 48.963253 899 | 45.506931 10.506923 48.986214 900 | 45.495468 10.495460 49.009140 901 | 45.484020 10.484013 49.032036 902 | 45.472588 10.472582 49.054897 903 | 45.461174 10.461167 49.077728 904 | 45.449776 10.449769 49.100525 905 | 45.438393 10.438387 49.123291 906 | 45.427025 10.427021 49.146023 907 | 45.415676 10.415670 49.168724 908 | 45.404343 10.404336 49.191391 909 | 45.393024 10.393018 49.214027 910 | 45.381721 10.381716 49.236633 911 | 45.370434 10.370430 49.259205 912 | 45.359165 10.359159 49.281746 913 | 45.347912 10.347905 49.304253 914 | 45.336674 10.336667 49.326729 915 | 45.325451 10.325444 49.349174 916 | 45.314243 10.314238 49.371590 917 | 45.303051 10.303047 49.393970 918 | 45.291878 10.291872 49.416321 919 | 45.280720 10.280713 49.438641 920 | 45.269577 10.269569 49.460926 921 | 45.258450 10.258442 49.483181 922 | 45.247337 10.247330 49.505405 923 | 45.236240 10.236233 49.527599 924 | 45.225159 10.225152 49.549763 925 | 45.214092 10.214087 49.571892 926 | 45.203041 10.203036 49.593990 927 | 45.192005 10.192002 49.616058 928 | 45.180984 10.180984 49.638096 929 | 45.169983 10.169980 49.660103 930 | 45.158997 10.158992 49.682079 931 | 45.148026 10.148020 49.704025 932 | 45.137070 10.137063 49.725941 933 | 45.126129 10.126122 49.747826 934 | 45.115204 10.115195 49.769680 935 | 45.104294 10.104284 49.791504 936 | 45.093399 10.093389 49.813297 937 | 45.082520 10.082508 49.835060 938 | 45.071655 10.071643 49.856792 939 | 45.060806 10.060793 49.878494 940 | 45.049973 10.049958 49.900166 941 | 45.039154 10.039139 49.921806 942 | 45.028351 10.028335 49.943417 943 | 45.017563 10.017545 49.964996 944 | 45.006790 10.006770 49.986546 945 | 44.996029 9.996011 50.008064 946 | 44.985283 9.985267 50.029552 947 | 44.974552 9.974537 50.051010 948 | 44.963837 9.963822 50.072437 949 | 44.953136 9.953123 50.093838 950 | 44.942451 9.942438 50.115208 951 | 44.931782 9.931768 50.136547 952 | 44.921127 9.921113 50.157856 953 | 44.910488 9.910473 50.179134 954 | 44.899864 9.899848 50.200386 955 | 44.889256 9.889237 50.221607 956 | 44.878658 9.878642 50.242798 957 | 44.868076 9.868061 50.263962 958 | 44.857510 9.857494 50.285095 959 | 44.846958 9.846943 50.306198 960 | 44.836422 9.836406 50.327271 961 | 44.825901 -------------------------------------------------------------------------------- /Continuous System Simulation (chemical reaction)/lab01.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AnkitPangeni/Simulation_Modeling/8a9b17edf5173dfae2fc13dc09d5fd2e72fda1c3/Continuous System Simulation (chemical reaction)/lab01.xlsx -------------------------------------------------------------------------------- /Monte Carlo Simulation/WIthout Graphics/Monte Carlo.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #define SEED time(NULL) 6 | 7 | int main() { 8 | 9 | srand( SEED ); // SEED is used for different random number generation every time and rand is the random number generation function 10 | int i, count, n; // count is the number of drops in circle and n is the time interval till which the drop of water falls 11 | double x,y,z,pi; // here x and y are the coordinate location points for any random position of water drop and d is the distance of the x,y coordinate from origin 12 | 13 | printf(" n = "); 14 | scanf("%d", &n); 15 | 16 | count = 0; 17 | 18 | for(i = 0; i < n; ++i) { 19 | 20 | x = (double)rand() / RAND_MAX; 21 | y = (double)rand() / RAND_MAX; 22 | // here x and y are randomly generated 23 | z = x * x + y * y; 24 | 25 | if( z <= 1 ) count++; // to check if raindrop is inside the circle, if it is inside then increase the count 26 | } 27 | 28 | pi = (double) count / n * 4; 29 | 30 | printf("Approximate PI = %g", pi); 31 | 32 | return(0); 33 | } 34 | -------------------------------------------------------------------------------- /Monte Carlo Simulation/With Graphics/Makefile.win: -------------------------------------------------------------------------------- 1 | # Project: Project1 2 | # Makefile created by Dev-C++ 5.11 3 | 4 | CPP = g++.exe 5 | CC = gcc.exe 6 | WINDRES = windres.exe 7 | OBJ = pie.o 8 | LINKOBJ = pie.o 9 | LIBS = -L"C:/Program Files (x86)/Dev-Cpp/MinGW64/x86_64-w64-mingw32/lib32" -static-libgcc -lbgi -lgdi32 -luser32 -m32 10 | INCS = -I"C:/Program Files (x86)/Dev-Cpp/MinGW64/include" -I"C:/Program Files (x86)/Dev-Cpp/MinGW64/x86_64-w64-mingw32/include" -I"C:/Program Files (x86)/Dev-Cpp/MinGW64/lib/gcc/x86_64-w64-mingw32/4.9.2/include" 11 | CXXINCS = -I"C:/Program Files (x86)/Dev-Cpp/MinGW64/include" -I"C:/Program Files (x86)/Dev-Cpp/MinGW64/x86_64-w64-mingw32/include" -I"C:/Program Files (x86)/Dev-Cpp/MinGW64/lib/gcc/x86_64-w64-mingw32/4.9.2/include" -I"C:/Program Files (x86)/Dev-Cpp/MinGW64/lib/gcc/x86_64-w64-mingw32/4.9.2/include/c++" 12 | BIN = "monte carlo.exe" 13 | CXXFLAGS = $(CXXINCS) -m32 14 | CFLAGS = $(INCS) -m32 15 | RM = rm.exe -f 16 | 17 | .PHONY: all all-before all-after clean clean-custom 18 | 19 | all: all-before $(BIN) all-after 20 | 21 | clean: clean-custom 22 | ${RM} $(OBJ) $(BIN) 23 | 24 | $(BIN): $(OBJ) 25 | $(CPP) $(LINKOBJ) -o $(BIN) $(LIBS) 26 | 27 | pie.o: pie.cpp 28 | $(CPP) -c pie.cpp -o pie.o $(CXXFLAGS) 29 | -------------------------------------------------------------------------------- /Monte Carlo Simulation/With Graphics/monte carlo.dev: -------------------------------------------------------------------------------- 1 | [Project] 2 | FileName=monte carlo.dev 3 | Name=Project1 4 | Type=1 5 | Ver=2 6 | ObjFiles= 7 | Includes= 8 | Libs= 9 | PrivateResource= 10 | ResourceIncludes= 11 | MakeIncludes= 12 | Compiler= 13 | CppCompiler= 14 | Linker=-lbgi -lgdi32 -luser32 15 | IsCpp=1 16 | Icon= 17 | ExeOutput= 18 | ObjectOutput= 19 | LogOutput= 20 | LogOutputEnabled=0 21 | OverrideOutput=0 22 | OverrideOutputName= 23 | HostApplication= 24 | UseCustomMakefile=0 25 | CustomMakefile= 26 | CommandLine= 27 | Folders= 28 | IncludeVersionInfo=0 29 | SupportXPThemes=0 30 | CompilerSet=3 31 | CompilerSettings=0000000100000000000000000 32 | UnitCount=1 33 | 34 | [VersionInfo] 35 | Major=1 36 | Minor=0 37 | Release=0 38 | Build=0 39 | LanguageID=1033 40 | CharsetID=1252 41 | CompanyName= 42 | FileVersion= 43 | FileDescription=Developed using the Dev-C++ IDE 44 | InternalName= 45 | LegalCopyright= 46 | LegalTrademarks= 47 | OriginalFilename= 48 | ProductName= 49 | ProductVersion= 50 | AutoIncBuildNr=0 51 | SyncProduct=1 52 | 53 | [Unit1] 54 | FileName=pie.cpp 55 | CompileCpp=1 56 | Folder= 57 | Compile=1 58 | Link=1 59 | Priority=1000 60 | OverrideBuildCmd=0 61 | BuildCmd= 62 | 63 | -------------------------------------------------------------------------------- /Monte Carlo Simulation/With Graphics/monte carlo.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AnkitPangeni/Simulation_Modeling/8a9b17edf5173dfae2fc13dc09d5fd2e72fda1c3/Monte Carlo Simulation/With Graphics/monte carlo.exe -------------------------------------------------------------------------------- /Monte Carlo Simulation/With Graphics/monte carlo.layout: -------------------------------------------------------------------------------- 1 | [Editors] 2 | Order=0 3 | Focused=0 4 | [Editor_0] 5 | CursorCol=1 6 | CursorRow=21 7 | TopLine=1 8 | LeftChar=1 9 | -------------------------------------------------------------------------------- /Monte Carlo Simulation/With Graphics/pie.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | // Function to generate random x and y coordinates 7 | // between -1 and 1 8 | void generate_random_point(double &x, double &y) { 9 | x = (double) rand() / RAND_MAX * 2 - 1; 10 | y = (double) rand() / RAND_MAX * 2 - 1; 11 | } 12 | 13 | /* 14 | rand() generates a random integer between 0 and RAND_MAX, which is a constant defined in the C standard library. 15 | (double) rand() converts the integer to a double precision floating-point number. 16 | (double) rand() / RAND_MAX scales the double number to be between 0 and 1. 17 | (double) rand() / RAND_MAX * 2 scales the double number to be between 0 and 2. 18 | (double) rand() / RAND_MAX * 2 - 1 shifts the double number to be between -1 and 1. 19 | 20 | */ 21 | 22 | int main() { 23 | int i,circlepoints=0,squarepoints=0, iteration; 24 | double x, y; 25 | std::cout << "Enter the number of iteration: "; // Type a number and press enter 26 | std::cin >> iteration; 27 | 28 | // Initialize the graphics window 29 | initwindow(600, 600); 30 | 31 | // Set the seed for the random number generator 32 | srand(time(0)); 33 | 34 | circle(300, 300, 200); 35 | rectangle(100, 100, 500, 500); 36 | /* 37 | These draw a circle and a square in the graphics window. The circle has a center at (300,300) and a radius of 200, 38 | while the square has a top-left corner at (100,100) and a bottom-right corner at (500,500). */ 39 | 40 | // Perform the Monte Carlo simulation 41 | for (i = 0; i < iteration; i++) { 42 | generate_random_point(x, y); 43 | 44 | if (x*x + y*y <= 1) // checks whether the points lie within the circle 45 | { 46 | circlepoints++; // to keep track of the number of points generated that fall inside the circle 47 | putpixel(300 + x * 200, 300 + y * 200, YELLOW); // point is drawn in yellow if it falls inside the circle and blue otherwise 48 | } 49 | else 50 | { 51 | putpixel(300 + x * 200, 300 + y * 200, BLUE); //x&y coordinates of the point are scaled by a factor of 200 and added to 300 52 | // to map them to the range of the graphics window. 53 | } 54 | squarepoints++;// to keep track of the number of points generated that fall in the square 55 | 56 | } 57 | 58 | 59 | 60 | // Estimate the value of pi 61 | double pi_estimate = 4.0 * circlepoints /squarepoints; 62 | std::cout << "Estimated value of pi: " << pi_estimate << std::endl; 63 | 64 | // Wait for the user to press a key before closing the graphics window 65 | getch(); 66 | closegraph(); 67 | 68 | return 0; 69 | } 70 | 71 | -------------------------------------------------------------------------------- /Monte Carlo Simulation/With Graphics/pie.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AnkitPangeni/Simulation_Modeling/8a9b17edf5173dfae2fc13dc09d5fd2e72fda1c3/Monte Carlo Simulation/With Graphics/pie.o -------------------------------------------------------------------------------- /Poker test/poker.c: -------------------------------------------------------------------------------- 1 | 2 | // 3 and 4 digit poker test 3 | #include 4 | #define TAB_CHISQUARE_4D 9.49 5 | #define TAB_CHISQUARE_3D 5.99 6 | 7 | int main() 8 | { 9 | 10 | int num; 11 | printf("Please choose your test:"); 12 | printf("\n 1. Three digit poker test"); 13 | printf("\n 2. Four digit poker test\n"); 14 | scanf("%d",&num); 15 | 16 | int i,n; 17 | 18 | int four_diff,four_of_a_kind, three_of_a_kind, one_pair, two_pair; // for 4 digit poker 19 | float CAL_CHISQUARE=0.0; 20 | float probabilities_4d[5]={0.504, 0.001, 0.036, 0.432, 0.027}; 21 | float expected_frequency_4d[5]; 22 | 23 | int three_diff; // for 3 digit poker 24 | float probabilities_3d[3]={0.72, 0.01, 0.27}; 25 | float expected_frequency_3d[3]; 26 | 27 | 28 | switch(num){ 29 | 30 | case 2: 31 | 32 | printf("\nHow many numbers did you generate:"); 33 | scanf("%d", &n); 34 | 35 | printf("\nEnter the observed frequencies of: \n"); 36 | printf("\nFour different digits:"); 37 | scanf("%d", &four_diff); 38 | 39 | printf("\nFour same digits:"); 40 | scanf("%d", &four_of_a_kind); 41 | 42 | printf("\nThree of a kind:"); 43 | scanf("%d", &three_of_a_kind); 44 | 45 | printf("\nOne Pair:"); 46 | scanf("%d", &one_pair); 47 | 48 | printf("\nTwo Pair:"); 49 | scanf("%d", &two_pair); 50 | 51 | if ((four_diff+four_of_a_kind+ three_of_a_kind+ one_pair+ two_pair)!=n){ 52 | printf("\nThe sum is not equal to %d",n); 53 | } 54 | else { 55 | 56 | 57 | printf("----------------------------------------------------------------------"); 58 | int observed_frequency_4d[5] ={four_diff,four_of_a_kind, three_of_a_kind, one_pair, two_pair}; 59 | printf("\nThe Observed frequencies are:\n"); 60 | for(i=0; i<5; i++) 61 | { 62 | printf("\t%d", observed_frequency_4d[i]); 63 | expected_frequency_4d[i]=probabilities_4d[i]*n; 64 | } 65 | 66 | printf("\nAnd their respective expected frequencies are:\n"); 67 | 68 | for(i=0; i<5; i++) 69 | { 70 | 71 | printf("\t%d",(int)expected_frequency_4d[i]); 72 | } 73 | 74 | for(i=0;i<5;i++) 75 | { 76 | CAL_CHISQUARE+= 77 | (( 78 | (observed_frequency_4d[i]-expected_frequency_4d[i])* 79 | (observed_frequency_4d[i]-expected_frequency_4d[i])) 80 | /expected_frequency_4d[i]); 81 | } 82 | printf("\n----------------------------------------------------------------------"); 83 | 84 | printf("\n \n The sum of calculated chi square statistics is : %f ",CAL_CHISQUARE); 85 | 86 | printf("\n The tabulated value for chisquare is %f",TAB_CHISQUARE_4D); 87 | if(CAL_CHISQUARE<= TAB_CHISQUARE_4D){ 88 | printf("\n\nSo,the generated random numbers are independent."); 89 | } 90 | else 91 | printf("\n\nSo,the generated random numbers are not independent."); 92 | 93 | } 94 | break; 95 | 96 | case 1: 97 | 98 | printf("\nHow many numbers did you generate:"); 99 | scanf("%d", &n); 100 | 101 | printf("\nEnter the observed frequencies of: \n"); 102 | printf("\nThree different digits:"); 103 | scanf("%d", &three_diff); 104 | 105 | printf("\nThree same digits:"); 106 | scanf("%d", &three_of_a_kind); 107 | 108 | printf("\nOne Pair:"); 109 | scanf("%d", &one_pair); 110 | 111 | 112 | if ((three_diff+three_of_a_kind+ one_pair)!=n){ 113 | printf("\nThe sum is not equal to %d",n); 114 | } 115 | else { 116 | 117 | printf("----------------------------------------------------------------------"); 118 | int observed_frequency_3d[3] ={three_diff,three_of_a_kind,one_pair}; 119 | printf("\nThe Observed frequencies are:\n"); 120 | for(i=0; i<3; i++) 121 | { 122 | printf("\t%d", observed_frequency_3d[i]); 123 | expected_frequency_3d[i]=probabilities_3d[i]*n; 124 | } 125 | 126 | printf("\nAnd their respective expected frequencies are:\n"); 127 | 128 | for(i=0; i<3; i++) 129 | { 130 | printf("\t%d",(int)expected_frequency_3d[i]); 131 | } 132 | 133 | for(i=0;i<3;i++) 134 | { 135 | CAL_CHISQUARE+= 136 | (( 137 | (observed_frequency_3d[i]-expected_frequency_3d[i])* 138 | (observed_frequency_3d[i]-expected_frequency_3d[i])) 139 | /expected_frequency_3d[i]); 140 | } 141 | printf("\n----------------------------------------------------------------------"); 142 | 143 | printf("\n \n The sum of calculated chi square statistics is : %f ",CAL_CHISQUARE); 144 | 145 | printf("\n The tabulated value for chisquare is %f",TAB_CHISQUARE_3D); 146 | if(CAL_CHISQUARE<= TAB_CHISQUARE_3D){ 147 | printf("\n\nSo,the generated random numbers are independent."); 148 | } 149 | else 150 | printf("\n\nSo,the generated random numbers are not independent."); 151 | 152 | } 153 | 154 | break; 155 | 156 | default: printf("\nPlease choose either 1 or 2"); break; 157 | } 158 | } 159 | 160 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Simulation_Modeling 2 | The GitHub repository includes a collection of C and C++ codes that cover various topics related to simulation and modeling. 3 | The codes are designed to be used as tools for exploring and analyzing different aspects of simulation,with a particular focus 4 | on Monte Carlo simulation, pseudorandom number generation, continuous system simulation, chi-square testing, and poker testing for random numbers. 5 | 6 | Monte Carlo simulation of pie provides an engaging way to understand the concept of randomness and probability. 7 | The code generates a large number of random points within a square and then determines how many of those points fall within a circle inscribed in the square. 8 | This is a classic example of how the Monte Carlo method can be used to approximate the value of pi. 9 | 10 | Another important topic is implementation of pseudorandom number generators. These generators are essential in simulation and modeling, 11 | as they allow for the creation of random events within a controlled environment. The code in this repository demonstrates how to generate high-quality random numbers 12 | using various methods, such as the Mixed congruential method and Linear congruental method. 13 | 14 | Continuous system simulation is another important topic covered by the repository. The code provides an implementation of continuous-time simulation, which is a technique used to model systems that evolve continuously. It describes a chemical reaction. 15 | 16 | The repository also includes code for chi-square testing, which is a statistical method used to determine if an observed distribution is significantly different from an 17 | expected distribution. This code can be used to analyze data from a variety of sources, such as experimental results or survey data. Here we generate random data. 18 | 19 | Finally, the poker test for random numbers is another important feature of the repository. This test is used to determine if a sequence of random numbers is truly random, 20 | or if there are any patterns or biases in the sequence. The code in this repository can be used to test any pseudorandom number generator and can help ensure that 21 | simulations are accurate and reliable. 22 | 23 | 24 | -------------------------------------------------------------------------------- /Random Numbers Generation/README.md: -------------------------------------------------------------------------------- 1 | The C program generates pseudo random numbers using two methods: Linear Congruential and Arithmetic Congruential. 2 | 3 | The Linear Congruential method uses a linear equation to generate a sequence of numbers that appears random. It requires three parameters: a seed value, a multiplier, and an increment. The seed value is used to initialize the sequence, and the multiplier and increment are used to generate subsequent values in the sequence. 4 | 5 | The Arithmetic Congruential method is similar to the Linear Congruential method, but it uses an arithmetic equation instead of a linear equation. It also requires three parameters: a seed value, a multiplier, and an increment. 6 | 7 | To generate pseudo random numbers using these methods, the C program first prompts the user to enter the seed value, multiplier, and increment. It then uses these values to initialize the Linear Congruential and Arithmetic Congruential generators. The program generates a series of pseudo random numbers using both methods and displays them on the screen. 8 | 9 | The C program also includes error checking to ensure that the user-entered values are valid and within the acceptable range for each method. If the values are not valid, the program displays an error message and prompts the user to enter new values. 10 | 11 | 12 | 13 | # Pseudo-Random-Numbers-Generation 14 | -------------------------------------------------------------------------------- /Random Numbers Generation/random numbers.c: -------------------------------------------------------------------------------- 1 | 2 | // random number generation 3 | #include 4 | #include 5 | 6 | 7 | int main() 8 | { 9 | int x0,x1,x2; //xo=seed, x1=next random number (but for arithmetic, x1 is thw 2nd seed & x2 is next random number 10 | int a,c,m; //a=constant multiplier, c=increment, m=modulus 11 | int i,n,num, method; 12 | int array[20]; //to store the random numbers generated 13 | printf("Choose the method:\n"); 14 | printf("\n1.Linear congruential Method"); 15 | printf("\n2.Arithmetic congruential Method\n"); 16 | scanf("%d",&method); 17 | switch(method) 18 | { 19 | 20 | case 1: // Linear congruental method 21 | printf("\nEnter the seed value x0: "); 22 | scanf("%d",&x0); 23 | 24 | 25 | printf("\nEnter the modulus m: "); 26 | scanf("%d",&m); 27 | 28 | printf("\nHow many random numbers you want to generate: "); 29 | scanf("%d",&n); 30 | 31 | 32 | printf("\nWhich method you want to perform"); 33 | printf("\n1.Mixed congruential"); 34 | printf("\n2.Additive congruential"); 35 | printf("\n3.Multiplicative congurential\n"); 36 | scanf("\n%d",&num); 37 | switch(num) 38 | { 39 | 40 | case 1: // Mixed congruental 41 | printf("\nEnter the constant multiplier a: "); 42 | scanf("%d",&a); 43 | 44 | printf("\nEnter the increment c: "); 45 | scanf("%d",&c); 46 | 47 | if(c!=0) 48 | { 49 | for(i=1;i<=n;i++) // loop to generate random numbers 50 | { 51 | x1=(a*x0+c) %m; 52 | array[i]=x1; 53 | x0=x1; 54 | } 55 | 56 | printf("\nThe generated random numbers are: "); 57 | for(i=1;i<=n;i++) 58 | { 59 | printf("\nX%d=%d",i,array[i]); 60 | printf("\t"); 61 | } 62 | } 63 | else 64 | printf("for mixed congruential value of c cannot be zero");break; 65 | 66 | 67 | case 2: // Additive congruental 68 | printf("\nEnter the increment c: "); 69 | scanf("%d",&c); 70 | for(i=1;i<=n;i++) 71 | { 72 | x1=(1*x0+c) %m; 73 | array[i]=x1; 74 | x0=x1; 75 | } 76 | 77 | printf("\nThe generated random numbers are: "); 78 | for(i=1;i<=n;i++) 79 | { 80 | printf("\nX%d=%d",i,array[i]); 81 | printf("\t"); 82 | } break; 83 | 84 | 85 | 86 | case 3: // Multiplicative congruential 87 | printf("\nEnter the constant multiplier a: "); 88 | scanf("%d",&a); 89 | 90 | for(i=1;i<=n;i++) 91 | { 92 | x1=(a*x0) %m; 93 | array[i]=x1; 94 | x0=x1; 95 | } 96 | 97 | printf("\nThe generated random numbers are: "); 98 | for(i=1;i<=n;i++) 99 | { 100 | printf("\nX%d=%d",i,array[i]); 101 | printf("\t"); 102 | } 103 | break; 104 | default: printf("Please choose either 1 or 2 or 3"); 105 | } 106 | break; 107 | 108 | case 2: // Arithmetic Congreuntial method 109 | printf("\nEnter the seed value x0: "); 110 | scanf("%d",&x0); 111 | 112 | printf("\nEnter the seed value x1: "); 113 | scanf("%d",&x1); 114 | 115 | printf("\nEnter the modulus m: "); 116 | scanf("%d",&m); 117 | 118 | printf("\nHow many random numbers you want to generate: "); 119 | scanf("%d",&n); 120 | 121 | 122 | for(i=1;i<=n;i++) 123 | { 124 | x2=(x0+x1) %m; 125 | array[i]=x2; 126 | x0=x1; 127 | x1=x2; 128 | } 129 | 130 | printf("\nThe generated random numbers are: "); 131 | for(i=1;i<=n;i++) 132 | { 133 | printf("\nX%d=%d",i+1,array[i]); 134 | printf("\t"); 135 | } 136 | break; 137 | 138 | default: printf("\nPlease choose either 1 or 2"); 139 | } 140 | return 0; 141 | getch(); 142 | } 143 | 144 | 145 | --------------------------------------------------------------------------------