How to wtite Erlang B and Erlang C formulas in Python [closed]

2024/10/6 10:28:06

I need to use Erlang B and Erlang C formulas in python script.

  • Erlang B
  • Erlang C

How can I write these formulas in Python?

Answer

Try looking for a scientific python library like scipy :=)

from math import factorial
def ErlangB (E, m):InvB = 1.0for j in range(1, m+1):InvB = 1.0 + InvB * (j/E)return (1.0 / InvB)def ErlangC(A, N):L = (A**N / factorial(N)) * (N / (N - A))sum_ = 0for i in range(N):sum_ += (A**i) / factorial(i)return (L / (sum_ + L))

( According to wikipedia pseudo-code)

https://en.xdnf.cn/q/118964.html

Related Q&A

Pip is not recognizing the install command (Windows 7, Python 3.3) [duplicate]

This question already has answers here:python3 --version shows "NameError: name python3 is not defined" [duplicate](2 answers)Closed 6 years ago.I am trying to install Python programs using P…

How do I check if 1 is always followed by a 0

In Python, I cannot find a solution as to how to determine whether there is always a 0 following a 1 somewhere in a list of numbers, to form a pair 10. It doesnt have to be direct follower.For clarity,…

Visual Studio Code debugs even when i run without debugging

i just installed VSCode and I used to work on it but now when I try to run without Debugging with Ctrl + F5. it seems to opens up python debug console and debug like below image enter image description…

Mock global function call while importing

Suppose I have a file called a.py with code likeimport mod1 mod1.a()def b():print("hi")Now if I want to mock fun b() then unittest.py while have import statement at top likefrom a import bat …

can the order of code make this program faster?

Hi this is my first post, I am learning how to write code so technically I am a newbie.I am learning python I am still at the very basics, I was getting to Know the if statement and I tried to mix it …

How can I label a node that is the initial vertex in a cycle from graph data

I need to implement an algorithm such that in a collection of unique and ordered graph edges, I can find a cyclic node. E.g. for a ->b, b->c, c->a, then a is a cyclic node and thus I want to a…

Pandas : How to drop #DIV/0! and NA values in new column in pandas dataframe?

I did some calculation and have #DIV/0! in my dataframe. How to drop these values and count further ? I followed df.dropna but dataframe still counting #DIV/0!. Please suggest.df.insert(loc=df.column…

unsupported operand for 3 instances of two classes and one method?

Im trying to get the program to take the hp stat from enemyUnit, the attack stat from unit, and the damage stat from tackle and put them into one math problem in the method getHit(). this is the code:…

Telling the script to wait until button is clickable? [duplicate]

This question already has answers here:Check whether element is clickable in selenium(3 answers)Closed 4 years ago.Im writing a script in Selenium (Python) and I am having an issue with a disabled clic…

Python: UnicodeDecodeError: utf8

Im having problem to save accented letters. Im using POSTGRESQL and Python 2.7POSTGRESQL - ENCODING = LATIN1I already added this line but does not worked! #!/usr/bin/python # -*- coding: UTF-8 -*-More…