Difference between revisions of "161-A5.1"
Jump to navigation
Jump to search
Adrian Vidal (talk | contribs) |
Adrian Vidal (talk | contribs) |
||
(2 intermediate revisions by the same user not shown) | |||
Line 7: | Line 7: | ||
* <code>blocklength</code> - an <code>int</code> that is a power of two, denoting the blocklength or, equivalently, the number of synthetic channels produced via the polar transform. | * <code>blocklength</code> - an <code>int</code> that is a power of two, denoting the blocklength or, equivalently, the number of synthetic channels produced via the polar transform. | ||
* <code>erasure_prob</code> - a <code>float</code>, a positive real number between 0 and 1, indicating the erasure probability of the original BEC. | * <code>erasure_prob</code> - a <code>float</code>, a positive real number between 0 and 1, indicating the erasure probability of the original BEC. | ||
− | The function must return an <code>int</code> corresponding to the number of synthetic BECs with erasure probabilities strictly | + | The function must return an <code>int</code> corresponding to the number of synthetic BECs with erasure probabilities strictly greater than <code>erasure_prob</code>. |
+ | |||
+ | {| class="wikitable" | ||
+ | |+ Python test script for execution | ||
+ | |- | ||
+ | | Header | ||
+ | | | ||
+ | <syntaxhighlight lang="python3"> | ||
+ | import math | ||
+ | </syntaxhighlight> | ||
+ | |- | ||
+ | | Student submission (function only) | ||
+ | | | ||
+ | <syntaxhighlight lang="python3"> | ||
+ | def count_bad_channels(blocklength, erasure_prob): | ||
+ | # your code.. | ||
+ | # more code.. | ||
+ | |||
+ | return ans | ||
+ | } | ||
+ | </syntaxhighlight> | ||
+ | |- | ||
+ | | Main test script | ||
+ | | | ||
+ | <syntaxhighlight lang="python3"> | ||
+ | # Main test script goes here, and will not be visible to students. | ||
+ | # The script will test if the submitted code does the prescribed functionality. | ||
+ | # For successfully validated scripts, test results will be sent via email. | ||
+ | </syntaxhighlight> | ||
+ | |} | ||
== Expected Output == | == Expected Output == | ||
+ | |||
+ | {| class="wikitable" | ||
+ | |- | ||
+ | | | ||
+ | | <math>n = 2</math> | ||
+ | | <math>n = 4</math> | ||
+ | | <math>n = 16</math> | ||
+ | | <math>n = 256</math> | ||
+ | | <math>n = 65536</math> | ||
+ | |- | ||
+ | | <math>\epsilon = 0.1</math> | ||
+ | | 1 | ||
+ | | 1 | ||
+ | | 4 | ||
+ | | 39 | ||
+ | | 7291 | ||
+ | |- | ||
+ | | <math>\epsilon = 0.3</math> | ||
+ | | 1 | ||
+ | | 1 | ||
+ | | 6 | ||
+ | | 86 | ||
+ | | 20158 | ||
+ | |- | ||
+ | | <math>\epsilon = 0.8</math> | ||
+ | | 1 | ||
+ | | 3 | ||
+ | | 11 | ||
+ | | 193 | ||
+ | | 51758 | ||
+ | |- | ||
+ | |} |
Latest revision as of 21:38, 15 May 2021
In this module, you have learned that it is possible to synthesize extremal channels from multiple copies of a given binary-input channel. In particular, the binary erasure channel (BEC) has the property that all synthesized channels are equivalent to BECs.
Task Description
Your task in Module 5 is simple: given the erasure probability of a BEC, you are to count the number of synthetic channels with erasure probability that is better (lower) than the original BEC.
You need to write a function count_bad_channels
which will take two arguments:
blocklength
- anint
that is a power of two, denoting the blocklength or, equivalently, the number of synthetic channels produced via the polar transform.erasure_prob
- afloat
, a positive real number between 0 and 1, indicating the erasure probability of the original BEC.
The function must return an int
corresponding to the number of synthetic BECs with erasure probabilities strictly greater than erasure_prob
.
Header |
import math
|
Student submission (function only) |
def count_bad_channels(blocklength, erasure_prob):
# your code..
# more code..
return ans
}
|
Main test script |
# Main test script goes here, and will not be visible to students.
# The script will test if the submitted code does the prescribed functionality.
# For successfully validated scripts, test results will be sent via email.
|
Expected Output
1 | 1 | 4 | 39 | 7291 | |
1 | 1 | 6 | 86 | 20158 | |
1 | 3 | 11 | 193 | 51758 |