A student tosses a fair coin times and lets be the number of heads observed. Thus
\nFor a complicated risk measure, the student needs the value of the fourth moment . \nDefine
\nCompute the exact integer value of .
[THOUGHT] We need to compute for , then .
We can compute using the known formula for moments of binomial distribution, or directly via summation:
We can compute this exactly using Python with fractions to get an exact rational number, then multiply by 1000 and get the integer K.
Alternatively, we can use sympy to compute the expectation symbolically.
Let's compute using Python with sympy's binomial and rational arithmetic.
Plan:
- Use sympy to sum over k from 0 to 20: k^4 * C(20,k) * (1/2)^20.
- Multiply by 1000.
- Convert to integer (since result should be integer).
We'll do that now.
[/PYTHON] [PYTHON] import sympy as sp
n = 20 p = sp.Rational(1, 2)
Compute E[N^4] exactly
E_N4 = sum(k4 * sp.binomial(n, k) * pk * (1-p)**(n-k) for k in range(n+1)) print("E[N^4] =", E_N4) print("E[N^4] as rational:", E_N4.simplify())
K = 1000 * E_N4 print("K =", K) print("K as integer:", int(K)) [/PYTHON]
[THOUGHT] From the Python output, we have , so . The integer value is 13072500.