Advertisement
Korotkodul

осциллограф

Oct 8th, 2024
45
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.75 KB | None | 0 0
  1. import math
  2. """
  3. Y = [9, 13, 17, 21, 25, 31, 40, 49]
  4. X = [5, 7, 10, 13, 15, 20, 25, 30]
  5. """
  6. Y = [1, 2, 3, 4, 5, 7, 8, 10]
  7. X = [6, 12, 18, 23, 28, 39, 44, 56]
  8. for i in range(8):
  9.     X[i] *= math.sqrt(2)
  10. """
  11. res = []
  12.  
  13. for i in range(8):
  14.    res.append(round(L[i] / (U[i] * math.sqrt(2)), 2))
  15. print(res)
  16. """
  17. """
  18. UiLi = 0
  19. U2 = 0
  20. for i in range(8):
  21.    UiLi += U[i] * L[i]
  22.    U2 += U[i] ** 2
  23. d_avg = UiLi / (U2 * math.sqrt(2))
  24. print(d_avg)
  25.  
  26. d_avg = math.sqrt(1 / 7 * (Ui2 * Li2 - UiLi ** 2) / Ui2 ** 2)
  27. print(d_avg)
  28. """
  29.  
  30. x = 0
  31. y = 0
  32. x2 =0
  33. xy = 0
  34. for i in range(8):
  35.     x += X[i]
  36.     y += Y[i]
  37.     xy += X[i] * Y[i]
  38.     x2 += X[i] ** 2
  39. x /= 8
  40. y /= 8
  41. x2 /= 8
  42. xy /= 8
  43. k = (xy - x * y) / (x2 - x ** 2)
  44. b = y - k * x
  45. print(k, b)
  46.  
  47.  
  48.  
  49.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement