C3_W2 Exercise 9 Sides n of the dice impact

Given a n-sided fair dice. You throw it twice and record the sum. How does increasing the number of sides n of the dice impact the mean and variance of the sum and the covariance of the joint distribution?

n_sides = 6
die = np.array([i for i in range(1, n_sides+1)])
n_rolls = 100000
rolls1 = np.array([np.random.choice(die) for _ in range(n_rolls)])
rolls2 = np.array([np.random.choice(die) for _ in range(n_rolls)])
rolls = rolls1 + rolls2
print(np.mean(rolls))
print(np.var(rolls))
print(np.cov(rolls1, rolls2))


n_sides = 60
die = np.array([i for i in range(1, n_sides+1)])
n_rolls = 100000
rolls1 = np.array([np.random.choice(die) for _ in range(n_rolls)])
rolls2 = np.array([np.random.choice(die) for _ in range(n_rolls)])
rolls = rolls1 + rolls2
print(np.mean(rolls))
print(np.var(rolls))
print(np.cov(rolls1, rolls2))



n_sides = 600
die = np.array([i for i in range(1, n_sides+1)])
n_rolls = 100000
rolls1 = np.array([np.random.choice(die) for _ in range(n_rolls)])
rolls2 = np.array([np.random.choice(die) for _ in range(n_rolls)])
rolls = rolls1 + rolls2
print(np.mean(rolls))
print(np.var(rolls))
print(np.cov(rolls1, rolls2))
6.99364
5.8170195503999995
[[2.90623693e+00 1.75622676e-03]
 [1.75622676e-03 2.90732833e+00]]
60.99248
597.9801234496
[[300.46142327  -1.25483595]
 [ -1.25483595 300.03435193]]
600.31369
59714.875408583895
[[29989.73307543  -111.51063343]
 [ -111.51063343 29948.76075475]]

I chose my answers based on the printed variables above.
I couldn’t not get the right answer for covariance of joint distribution.

I am not able to make out any specific patterns by looking at anti diagonal matrix np.cov(rolls1, rolls2) . That is for some runs it increases , others it decreases and in others it is random.

In the above data, it decreases , and the one below it decreases.
Am i missing something totally when it comes to checking covariance of joint distribution ?

6.99825
5.8371469375
[[ 2.91772764e+00 -2.30131541e-03]
 [-2.30131541e-03  2.92408030e+00]]
60.97297
601.2308593790999
[[299.81118586   0.64422454]
 [  0.64422454 300.13723681]]
601.90089
60317.4708072079
[[30238.36424551    48.36220941]
 [   48.36220941 29982.98532361]]

I believe that since the two rolls are independent from one another, the covariance/correlation should be 0. Increasing the number of dice sides would not change this relationship, thus the covariance should stay the same. This is all theoretical, of course, so experiments may come to different conclusions.

Edit: Please check out this comment. Apparently the question should be phrased as How does increasing the number of sides impact the absolute value of the covariance? instead.

this code didn’t work for me

What is the issue you are facing . ?
The above code is just to simulate the n_sides for values of 6, 60 and 600.
While i could reason why mean and variance should increase/decrease/remain same with n_sides without code as well, i was unsure of covariance. And hence decided to experiment with sample code.

I consistently got inconsistent data to conclude anything from increase/decrease/remain same for co variance and hence the question