Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import math
- def c(b, a):
- a1 = math.factorial(a)
- b1 = math.factorial(b)
- c1 = math.factorial(a-b)
- c = a1 / b1 / c1
- return c
- def M(arX, ksi):
- M = []
- for i in range(0, len(arX)):
- M.append(arX[i]*ksi[i])
- return M
- def Msum(arX, ksi):
- M = []
- for i in range(0, len(arX)):
- M.append(arX[i]*ksi[i])
- return sum(M)
- def D(M_, arX, ksi):
- D = []
- for i in range(0, len(arX)):
- out = ((ksi[i])-M_)**2 * arX[i]
- D.append(out)
- return D
- def Dsum(M_, arX, ksi):
- D = []
- for i in range(0, len(arX)):
- out = ((ksi[i])-M_)**2 * arX[i]
- D.append(out)
- return sum(D)
- def sigma(Dx):
- return Dx**0.5
- def MuXY(arX_,ksi_,ksiy, Dx, Dy):
- ar = []
- for item in ksiy:
- for i in range(len(arX_)):
- ar.append(arX_[i]*ksi_[i]*item)
- i +=1
- ar.append(-Dx*Dy)
- return sum(ar)
- def rxy(MuXY,Sigx, Sigy):
- rx = MuXY/Sigx/Sigy
- return rx
- # 1
- # Дано
- arX_ = [0.35,0.27,0.33,0.05] # Дано
- ksi_ = [0,1,2,3] # Дано
- arY = [0.58,0.42] # Дано
- ksiy = [22,18] # Дано
- pervoe = 1 # первое число равно ?
- MuXY = MuXY(arX_,ksi_,ksiy, 0.8736, 3.897)
- print("MuXY - ", MuXY)
- # Формулы функции
- M_ = Msum(arX_, ksi_)
- print("Матожидан =", M_)
- D_= Dsum(M_,arX_,ksi_) # массив
- print("Дисперсия = ",D_)
- Sig = sigma(D_)
- print("Сигма = ",Sig)
- rxy = rxy(MuXY,0.934, 1.97)
- print("rx = ", rxy)
- # 2
- # импортируем модули
- import numpy as np
- import math
- import matplotlib.pyplot as plt
- from numpy import arange, exp
- ##a=0
- ##b=2
- ##def fx(x):
- ## y = 1 - (b-x)**2/(b-a)**2
- ## return y
- ##print(fx(0))
- ##print(fx(2))
- ##def fx2(x):
- ## y = +1/2*x**2 - 1/12*x**3
- ## return y
- ##print(fx2(0))
- ##print(fx2(2))
- ##x = np.linspace(0, 2,10)
- #plt.plot(x, fx2(x))
- #plt.show()
- ##
- ##
- ##def x025(x):
- ## return 0.25*x**2
- ##x025(1.5) - x025(-0.5)
- ##
- ##
- ##
- ##
- ##
- ##def x025_(x):
- ## return (1/6)*x**3
- ##x025_(1.5) - x025_(-0.5) -0.5**2
- def graf(x,y):
- plt.plot(x, y)
- a=6.4
- k = -0.3125/6.4
- b = 0.3125
- def fx_(x):
- return k*x+b
- def fxInt(x):
- return (k*x**2)/2+b*x
- def fxMx(x):
- return (k*x**3)/3+b*x**2/2
- def fxDx(x):
- return (k*x**4)/4 + b*x**3/3 - 2.13**2
- def expP(x):
- return 1-exp(-x*3)
- def expInt(x):
- return x+exp(-3*x)/3-1/3
- x = np.linspace(-1, 100,1)
- x_= arange(0,2.3333,0.01)
- fx_(x)
- graf(x_,expInt(x_))
- graf(x_,expP(x_))
- #S = fxInt(0) - fxInt(a)
- #S = fxMx(0) - fxMx(a)
- #S = fxDx(0) - fxDx(a)
- S = expInt(0.81)
- print(S)
- #graf(x,fx_(x))
- #graf(x,fxInt(x))
- #graf(x,fxMx(x))
- #graf(x,fxDx(x))
- #plt.show()
- #######################################4-5
- def laplasX(Dsig, predel): ##потом по табличному значению https://math.semestr.ru/corel/table-laplas.php
- return predel / Dsig
- plt.show()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement