SE250:lab-5:mcar147

From Marks Wiki
Jump to navigation Jump to search

Back to Lab Reports

Prologue

This lab was rather tough, firstly because I didn't have the gcc compiler on my laptop, thus aking it rather tough to actaully compile all files at once.

Next I had to download putty so I could run a shell and access the Uni linux server to actaully be able to compile.

gcc -lm *.c -o lab-5 && ./lab-5

Finally after all that when I was actaully able to start we encountered an interesting error:

randtest.c:154: warning: incompatible implicit declaration of built-in function 'log2'

Fortunately this didn't prevent me from running the code, so alls good.

Task 1

After an hour of stuffing around I finally was able to start on the lab... Yay... With all three values set to 100, the results were interesting, with 50% exceeding and Monte Carlo pi value being 2.5

Increasing all values to 10000, the Chi square increased to 99% and Monte Carlo pi rose to 3.188, much closer to what we want

Interestingly, if the values were dropped down to 10, the Chi square returned to 50%, while the Monte Carlo pi dropped to 0...

Task 2

With the first test the llps was 3 while the expected was 4.22, and on the second it was 7 instead of 6.67.