<jupyter_start><jupyter_text>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;                                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;     Probabilistic States   Suppose that Asja tosses a fair coin secretly.As we do not see the result, our information about the outcome will be probabilistic:$\rightarrow$ The outcome is heads with probability $0.5$ and the outcome will be tails with probability $0.5$.If the coin has a bias $ \dfrac{Pr(Head)}{Pr(Tail)} = \dfrac{3}{1}$, then our information about the outcome will be as follows:$\rightarrow$  The outcome will be heads with probability $ 0.75 $ and the outcome will be tails with probability $ 0.25 $. Explanation: The probability of getting heads is three times of the probability of getting tails.            The total probability is 1.          We divide the whole probability 1 into four parts (three parts are for heads and one part is for tail),         one part is $ \dfrac{1}{4} = 0.25$,         and then give three parts for heads ($0.75$) and one part for tails ($0.25$).      Listing probabilities as a column We have two different outcomes: heads (0) and tails (1).We use a column of size 2 to show the probabilities of getting heads and getting tails.For the fair coin, our information after the coin-flip will be $ \myvector{0.5 \\ 0.5} $. For the biased coin, it will be $ \myvector{0.75 \\ 0.25} $.The first entry shows the probability of getting heads, and the second entry shows the probability of getting tails. $ \myvector{0.5 \\ 0.5} $ and $ \myvector{0.75 \\ 0.25} $ are two examples of 2-dimensional (column) vectors.  Task 1 Suppose that Balvis secretly flips a coin having the bias $ \dfrac{Pr(Heads)}{Pr(Tails)} = \dfrac{1}{4}$.Represent your information about the outcome as a column vector.  Task 2 Suppose that Fyodor secretly rolls a loaded (tricky) dice with the bias $$ Pr(1):Pr(2):Pr(3):Pr(4):Pr(5):Pr(6) = 7:5:4:2:6:1 . $$Represent your information about the result as a column vector. Remark that the size of your column vector should be 6.You may use python for your calculations.<jupyter_code>#
# your code is here
#<jupyter_output><empty_output><jupyter_text>click for our solution  Vector representation Suppose that we have a system with 4 distiguishable states: $ s_1 $, $s_2 $, $s_3$, and $s_4$.  We expect the system to be in one of them at any moment. By speaking with probabilities, we say that the system is in one of the states with probability 1, and in any other state with probability 0. By using our column representation, we can show each state as a column vector (by using the vectors in standard basis of $ \mathbb{R}^4 $):$    e_1 = \myvector{1\\ 0 \\ 0 \\ 0}, e_2 = \myvector{0 \\ 1 \\ 0 \\ 0}, e_3 = \myvector{0 \\ 0 \\ 1 \\ 0},     \mbox{ and } e_4 = \myvector{0 \\ 0 \\ 0 \\ 1}.$ This representation helps us to represent our information on a system when it is in more than one state with certain probabilities. Remember the case in which the coins are tossed secretly. For example, suppose that the system is in states $ s_1 $, $ s_2 $, $ s_3 $, and $ s_4 $ with probabilities $ 0.20 $, $ 0.25 $, $ 0.40 $, and $ 0.15 $, respectively. (The total probability must be 1, i.e., $ 0.20+0.25+0.40+0.15 = 1.00 $)Then, we can say that the system is in the following probabilistic state:$ 0.20 \cdot e_1 + 0.25 \cdot e2 + 0.40 \cdot e_3 + 0.15 \cdot e4 $$ =  0.20 \cdot \myvector{1\\ 0 \\ 0 \\ 0} + 0.25 \cdot \myvector{0\\ 1 \\ 0 \\ 0} + 0.40 \cdot \myvector{0\\ 0 \\ 1 \\ 0} + 0.15 \cdot  \myvector{0\\ 0 \\ 0 \\ 1}  $$ = \myvector{0.20\\ 0 \\ 0 \\ 0} +   \myvector{0\\ 0.25 \\ 0 \\ 0} +  \myvector{0\\ 0 \\0.40 \\ 0} +  \myvector{0\\ 0 \\ 0 \\ 0.15 } = \myvector{ 0.20 \\ 0.25 \\ 0.40 \\ 0.15 }, $where the summation of entries must be 1.  Probabilistic state A probabilistic state is a linear combination of the vectors in the standard basis.     Here coefficients (scalars) must satisfy certain properties:     Each coefficient is non-negative      The summation of coefficients is 1 Alternatively, we can say that a probabilistic state is a probability distribution over deterministic states.We can show all information as a single mathematical object, which is called as a stochastic vector. Remark that the state of any linear system is a linear combination of the vectors in the basis.    Task 3 For a system with 4 states, randomly create a probabilistic state, and print its entries, e.g., $ 0.16~~0.17~~0.02~~0.65 $.Hint: You may pick your random numbers between 0 and 100 (or 1000), and then normalize each value by dividing the summation of all numbers.<jupyter_code>#
# your solution is here
#<jupyter_output><empty_output><jupyter_text>click for our solution  Task 4 [extra] As given in the hint for Task 3, you may pick your random numbers between 0 and $ 10^k $. For better precision, you may take bigger values of $ k $.Write a function that randomly creates a probabilisitic state of size $ n $ with a precision up to $ k $ digits. Test your function.<jupyter_code>#
# your solution is here
#<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.10622275069361871, 'fraction_numerical': 0.046571541815299246, 'mean_word_length': 3.365916955017301, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '3', 'dir': 'jupyter-structured-clean-dedup', 'id': '248675', 'license': 'Apache-2.0', 'n_tokens_mistral': 1615, 'n_tokens_neox': 1429, 'n_words': 726, 'path': 'classical-systems/CS16_Probabilistic_States.ipynb', 'repo_name': 'jahadtariq/Quantum-Computing', 'size': '5046'}