Computer Science, asked by Superb4692, 1 year ago

Find mean and standard deviation of first 15 natural numbers.

Answers

Answered by ehanhilal
3

The formula to calculate SD is SD=∑x2n−(∑xn)2−−−−−−−−−−−−−−√

1st 10 natural numbers are 1,2,3,4,5,6,7,8,9,10

∑x=1+2+3+4+5+6+7+8+9+10

=n(n+1)2=10(10+1)2

=10×112=55

∑x2=12+22+..............+102

=n(n+1)(2n+1)6

=10×11×216

=385

SD=∑x2n−(∑xn)2−−−−−−−−−−−−−−√

=38510−(5510)2−−−−−−−−−−−−√

=38.5−(5.5)2−−−−−−−−−−√

=8.25−−−−√

=2.87

we can calculate 15 natural numbers same as above i have calculated

Answered by mahinderjeetkaur878
0

Answer: -We need to find the mean and standard deviation of first 15 natural numbers. The program for it is written below.

The formula to calculate SD is SD = ∑x2n−(∑xn)2

1st 10 natural numbers are 1, 2, 3, 4, 5, 6, 7, 8, 9, 10.

∑x = 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10

= n(n+1)2 = 10(10+1)2

= 10×112 = 55

∑x2 = 12+22+..............+102

= n(n+1) (2n+1)6

=10×11×216

=385

SD=∑x2n−(∑xn)2

=38510−(5510)2

=38.5−(5.5)2

=8.25

=2.87

The program is: -

import NumPy as np #for declaring an array or simply use list

def mean(data):

 n = len(data)

 mean = sum(data) / n

 return mean

def variance(data):

 n = len(data)

 mean = sum(data) / n

 deviations = [(x - mean) ** 2 for x in data]

 variance = sum(deviations) / n

 return variance

def stdev(data):

 import math

 var = variance(data)

 std_dev = math.sqrt(var)

 return std_dev

data = np.array([7,5,4,9,12,45])

print("Standard Deviation of the sample is % s "% (stdev(data)))

print("Mean of the sample is % s " % (mean(data)))

To know more about the topic, visit the below links: -

https://brainly.in/question/15826005

https://brainly.in/question/48465904

#SPJ3

Similar questions