****************************** Solution I ****************************** Tprime,lab: 0.026s Tgauss,lab: 5.132s Tprime,grendel: 0.014s Tgauss,grendel: 11.942s Tprime,ozark: 0.022s Tgauss,ozark: 8.160s Tprime,grendel / Tprime,lab: 0.538 Tprime,ozark / Tprime,lab: 0.846 Tgauss,grendel / Tgauss,lab: 2.327 Tgauss,ozark / Tgauss,lab: 1.590 We decided to use the time command to measure the amount of time our programs take. This is a Linux command that writes the real time elapsed, the user CPU time, and the system CPU time to standard output upon the completion of a program. We used the Python programming language to translate the pseudo code into actual code, and we named our files prime.py (Appendix I) and gaussian.py (Appendix II). To obtain the time for the prime function, we chose to make a list containing three known prime numbers and two composite numbers and tested each using our function. After accessing the desktop using the cd Desktop command in the terminal, we typed "time python prime.py" to test how long the program would take. We recorded the real time, meaning the amount of time the CPU took to complete the program from start to finish. To test prime.py on grendel, we typed "ssh grendel" and then "cd Desktop" before "time python.py". For ozark, we had to save our files in the www directory, and when we accessed ozark we first typed "www" instead of "cd Desktop". For the gaussian function, we also made a list of numbers to test and took the total amount of time. We used the same technique for the gaussian function, typing "time python gaussian.py". In addition, we created a second file called gauss2.py (Appendix III) that only tested the gaussian function for 1000, a relatively small value of n. Surprisingly, when we tested gauss2.py, we found that it took the Linux machine 0.027 seconds, grendel 0.017 seconds, and ozark 0.027 seconds. This makes the ratio Tgauss, grendel / Tgauss, lab equal to 0.607, and the ratio Tgauss, ozark / Tgauss, lab equal to 0.964. These ratios are very different from the ones we obtained using a list containing several much larger numbers. Appendix I def Prime(n): d = 2.0 while d**2.0 < n: if n % d == 0: print(n) return False d += 1.0 print("true") return True numbers = [3343, 2000,3347, 3359, 4000000000000] for n in numbers: Prime(n) Appendix II import math def f(x): return(math.e**((-x**2.0)/2.0)) def gaussian(): numbers=[10,200,3000,40000,500000,6000000] for n in numbers: s = f(-2.0) + f(2.0) d = 4.0/n i = 1.0 while i <= (n-1.0): s = s + 3.0*f(-2.0 + i*d) i+=1.0 print(d*s/3.0) gaussian() Appendix III import math def f(x): return(math.e**((-x**2.0)/2.0)) def gaussian(): numbers=[1000] for n in numbers: s = f(-2.0) + f(2.0) d = 4.0/n i = 1.0 while i <= (n-1.0): s = s + 3.0*f(-2.0 + i*d) i+=1.0 print(d*s/3.0) gaussian()