Compare commits
2 Commits
e91d7763b4
...
b24d3eaaed
Author | SHA1 | Date | |
---|---|---|---|
b24d3eaaed | |||
1d1320fb8f |
3
practica/math/statistic/Number_square.py
Normal file
3
practica/math/statistic/Number_square.py
Normal file
@ -0,0 +1,3 @@
|
||||
# возвращаем квадрат из числа
|
||||
def get_sqrt(x):
|
||||
return x ** 0.5
|
14
practica/math/statistic/Standard deviation.py
Normal file
14
practica/math/statistic/Standard deviation.py
Normal file
@ -0,0 +1,14 @@
|
||||
# Среднеквадратичное отклонение sd
|
||||
list_data = [int(value) for value in input().split()]
|
||||
n = len(list_data)
|
||||
Sum = 0
|
||||
for value in list_data:
|
||||
Sum += value
|
||||
SUm=Sum/n
|
||||
Sum = 0
|
||||
for value in list_data:
|
||||
a = (value - SUm)**2
|
||||
Sum += a
|
||||
D = (Sum / (n - 1 ))
|
||||
sd = D ** 0.5
|
||||
print (sd)
|
6
practica/math/statistic/Variance/Population_variance.py
Normal file
6
practica/math/statistic/Variance/Population_variance.py
Normal file
@ -0,0 +1,6 @@
|
||||
# дисперсия в генеральной совокупности
|
||||
def find_general_variance(x, x_average):
|
||||
variance = 0
|
||||
for i in x:
|
||||
variance += (i - x_average) ** 2
|
||||
return variance / len(x)
|
68
practica/math/statistic/Variance/Variance.py
Normal file
68
practica/math/statistic/Variance/Variance.py
Normal file
@ -0,0 +1,68 @@
|
||||
# ДИСПЕРСИЯ
|
||||
# list_data = [int(value) for value in input().split()]
|
||||
# n = len(list_data)
|
||||
# Sum = 0
|
||||
# for value in list_data:
|
||||
# Sum += value
|
||||
# SUm=Sum/n
|
||||
# Sum = 0
|
||||
# for value in list_data:
|
||||
# a = (value - SUm)**2
|
||||
# Sum += a
|
||||
# D = (Sum / (n - 1 ))
|
||||
# print (D)
|
||||
|
||||
# Среднеквадратичное отклонение sd
|
||||
# list_data = [int(value) for value in input().split()]
|
||||
# n = len(list_data)
|
||||
# Sum = 0
|
||||
# for value in list_data:
|
||||
# Sum += value
|
||||
# SUm=Sum/n
|
||||
# Sum = 0
|
||||
# for value in list_data:
|
||||
# a = (value - SUm)**2
|
||||
# Sum += a
|
||||
# D = (Sum / (n - 1 ))
|
||||
# sd = D ** 0.5
|
||||
# print (sd)
|
||||
|
||||
|
||||
|
||||
|
||||
# находим среднее значение
|
||||
def find_average(x):
|
||||
return sum(x) / len(x)
|
||||
|
||||
|
||||
# находим размах
|
||||
def find_range(x):
|
||||
x_copy = sorted(x)
|
||||
return abs(x_copy[-1] - x_copy[0])
|
||||
|
||||
# находим медиану
|
||||
def find_median(x):
|
||||
if len(x) % 2 == 0:
|
||||
return (x[len(x) // 2] + x[len(x) // 2 -1]) / 2
|
||||
else:
|
||||
return x[len(x) // 2]
|
||||
|
||||
# находим дисперсию в генеральной совокупности
|
||||
def find_general_variance(x, x_average):
|
||||
variance = 0
|
||||
for i in x:
|
||||
variance += (i - x_average) ** 2
|
||||
return variance / len(x)
|
||||
|
||||
|
||||
# находим дисперсию в выборке
|
||||
def find_subgeneral_variance(x, x_average):
|
||||
variance = 0
|
||||
for i in x:
|
||||
variance += (i - x_average) ** 2
|
||||
return variance / (len(x) - 1)
|
||||
|
||||
|
||||
# возвращаем квадрат из числа
|
||||
def get_sqrt(x):
|
||||
return x ** 0.5
|
6
practica/math/statistic/Variance/sample_variance.py
Normal file
6
practica/math/statistic/Variance/sample_variance.py
Normal file
@ -0,0 +1,6 @@
|
||||
# дисперсию в выборке
|
||||
def find_subgeneral_variance(x, x_average):
|
||||
variance = 0
|
||||
for i in x:
|
||||
variance += (i - x_average) ** 2
|
||||
return variance / (len(x) - 1)
|
3
practica/math/statistic/average value.py
Normal file
3
practica/math/statistic/average value.py
Normal file
@ -0,0 +1,3 @@
|
||||
# среднее значение
|
||||
def find_average(x):
|
||||
return sum(x) / len(x)
|
6
practica/math/statistic/median.py
Normal file
6
practica/math/statistic/median.py
Normal file
@ -0,0 +1,6 @@
|
||||
# медиана
|
||||
def find_median(x):
|
||||
if len(x) % 2 == 0:
|
||||
return (x[len(x) // 2] + x[len(x) // 2 -1]) / 2
|
||||
else:
|
||||
return x[len(x) // 2]
|
4
practica/math/statistic/renge.py
Normal file
4
practica/math/statistic/renge.py
Normal file
@ -0,0 +1,4 @@
|
||||
# размах
|
||||
def find_range(x):
|
||||
x_copy = sorted(x)
|
||||
return abs(x_copy[-1] - x_copy[0])
|
Loading…
Reference in New Issue
Block a user