Sephinroth

2.1

Feb 26th, 2021
475
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # -*- coding: utf-8 -*-
  2.  
  3. def P(n):
  4.     res = 1
  5.     for i in range(0, n):
  6.         if i <= N:
  7.             lamda = lamda_const
  8.         else:
  9.             lamda = 2*lamda_const
  10.         res *= lamda/mu_const
  11.     return res * p0
  12.  
  13. def P0():
  14.     res1 = 0
  15.     res2 = 1
  16.     for j in range(1, n+1):
  17.         for i in range(n):
  18.             if i <= N:
  19.                 lamda = lamda_const
  20.             else:
  21.                 lamda = 2*lamda_const
  22.             res2 *= lamda/mu_const
  23.         res1 += res2
  24.     return 1/(1+res1)
  25.  
  26. N = 4
  27. n = 10
  28. lamda_const = 1.4
  29. mu_const = 9.5
  30. p0 = P0()
  31. #p0 = 1 - lamda_const/mu_const
  32.  
  33. if 2*lamda_const/mu_const < 1:
  34.     p = [P(j) for j in range(1, n+1)]
  35.     print("Начальное распределение:\n{}\n\nСтационарное распределение:\n{}\n\nСумма вероятностей (проверка):\n{}".format(p0, p, sum(p)))
  36. else:
  37.     print("Условие существования стационарного режима не выполнено")
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×