0

I'm currently preparing for a final exam in Networks and Internet Systems. I don't have a large background knowledge on the topics, so I'm attempting to use python to approach the majority of question in the exam. I had an original series of code written out but when I try to use it for this question, it runs, but gives the incorrect answer. Could anyone offer some advice?

Consider a path with 6 intermediate nodes where all the links have the same probability of bit error or 1 in 10 million. The goal is to have less than 1 in a thousand packets received in error. What is the maximum packet size in bytes?

Answer = 178


def calculate_max_packet_size(desired_probability, Pb, k):
    # Solve for L using the given probability
    log_term = math.log(desired_probability) / (k * 8 * math.log(1 - Pb))
    max_packet_size = math.ceil(log_term)
return max_packet_size

Example usage: desired_probability = 1e-7 # Desired probability of being in error Pb = 1e-4 # Bit error rate on a single link k = 6

Number of hops

max_packet_size = calculate_max_packet_size(desired_probability, Pb, k) print(f"The maximum packet size for a probability of {desired_probability * 100}% being in error is: {max_packet_size} bytes")```

Kate
  • 1
  • 1

0 Answers0