Cosc 416
Cosc 416
REUEL
REG. NO: U21DLCS10193
COURSE: COSC416
pi_estimate_1000, pi_estimates_large
Results:
(a) Estimate of π\pi using 1000 random points
With 1000 points, the estimated value of π\pi is 3.14.
(b) Accuracy improvement with more points
As we increase the number of points, the estimate of π\pi becomes more accurate:
10,000 points → π≈3.15
100,000 points → π≈3.14472
1,000,000 points → π≈3.13975
QUESTION 5.
import numpy as np
from scipy import stats
# (iv) Mean, Median, Mode, Range, Variance, and Standard Deviation calculation
dataset_3 = np.array([70, 75, 80, 85, 90, 95, 100])
mean_3 = np.mean(dataset_3)
median_3 = np.median(dataset_3)
mode_3 = stats.mode(dataset_3).mode[0] # Mode
range_3 = np.max(dataset_3) - np.min(dataset_3)
variance_3 = np.var(dataset_3, ddof=0) # Population variance
std_dev_3 = np.sqrt(variance_3) # Population standard deviation
(ii) Variance and Standard Deviation for dataset [6, 8, 10, 14, 18]
Variance = 18.56
Standard Deviation = 4.31
(iv) Statistical measures for dataset [70, 75, 80, 85, 90, 95, 100]
Mean = 85.0
Median = 85.0
Mode = 70 (since all values are unique, the first value is taken as the mode)
Range = 30 (100 - 70)
Variance = 100.0
Standard Deviation = 10.0
These results show a moderate spread in the data, with values fairly evenly distributed
around the mean.