Skip to content

Instantly share code, notes, and snippets.

@josh-hernandez-exe
Last active September 19, 2020 21:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save josh-hernandez-exe/07abd3cf45090fd662b38be7ced647ea to your computer and use it in GitHub Desktop.
Save josh-hernandez-exe/07abd3cf45090fd662b38be7ced647ea to your computer and use it in GitHub Desktop.
Move Point Refresh (MPR) Analysis for Pokemon Masters
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Move Point Refresh (MPR) Analysis for Pokemon Masters\n",
"\n",
"This report analyzes the MPR mechanic and the expected number of uses of a move given the max MP of that move. Two moves that are of particular interest are Potion and Phantom Force. This report began as an exploration of the move [Phantom Force](https://www.reddit.com/r/PokemonMasters/comments/ir3xfj/stats_on_mp_usage_on_phantom_force/?utm_source=share&utm_medium=web2x&context=3).\n",
"\n",
"# Introduction\n",
"\n",
"In Pokemon Masters, players undergo real time combat with a preconstructed team of Sync Pairs. These Sync Pairs will have four moves. Some of these moves have limited uses. A mechanic known as the \"Sync Grid\" was introduced that allows for improvements Sync Pairs. A specific mechanic of interest is know as move point refresh (MPR), in which when using a move with limited use, there is a probability of passive triggering and refreshing that use. Multiple instances of this mechanic can stack (if available to that Sync Pair's Sync Grid).\n",
"\n",
"### Example\n",
"\n",
"Morty and Drifblim have a move with finite uses called \"Phantom Force\" with three uses. On their Sync Grid there are two nodes called \"Phantom Force: Move Point Refresh 3\", where each node has a 40% chance of triggering during combat when \"Phantom Force\" is used.\n",
"\n",
"Each move use has 3 situations. First neither passive triggers at 36% chance. Both trigger at a chance of 16%. And only one triggers at a chance of 48%. The probability is further complicated by the fact that this is repeated during every move use. Thus there are many paths from the state of three uses to zero uses.\n",
"\n",
"The question we are trying to answer is now many uses of \"Phantom Force\" can I expect in combat.\n",
"\n",
"## General Question\n",
"\n",
"This report attempts to answer the general question: If a move has $n$ limited uses and $m$ MPR nodes activated with a probability $p$ of triggering, what is the expected number of uses of that move. A supplementary question is to ask what is the variance of that expected value.\n",
"\n",
"# Analysis\n",
"\n",
"The analysis is done using software which is provided for completeness and reproduction. The code is written using Python 3.8 and uses the scientific python stack.\n",
"\n",
"This first block of code is setting up the analysis."
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"# general code setup\n",
"from functools import lru_cache\n",
"\n",
"import sympy\n",
"from sympy.matrices import matrix_multiply_elementwise\n",
"from scipy.special import comb\n",
"from IPython.display import display\n",
"\n",
"p = sympy.symbols('p')\n",
"\n",
"mpr_rates = [0.1, 0.2, 0.3, 0.4, 0.5, 0.6]\n",
"mpr_rates = [sympy.Rational(str(x)) for x in mpr_rates]"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Markov Chain Analysis\n",
"\n",
"Due to the nature the having multiple MPR nodes, the analysis gets difficult. It is possible and [/u/zzladerp](https://www.reddit.com/r/PokemonMasters/comments/ir3xfj/stats_on_mp_usage_on_phantom_force/g51vx6a?utm_source=share&utm_medium=web2x&context=3) was able to calculate such values for 2 MPR nodes. This report attempts to generalize that to any number of MPR nodes.\n",
"\n",
"For the we use Markov chain analysis, as it is accurately depicts the situation at hand. For the Markov chain we need to setup the transition matrices. Each row represents the starting state (wheather you are at 2/3 uses or 0/3 uses), and the columns represent the destination state. The entries in the matrix represent the likelihood of transitioning to that state from the destination state. The rows sum to one since you have a probability of $1$ to end up in some state from where you started (and it may be the same state).\n",
"\n",
"In general for $n$ MPR nodes in a grid, you have to determine which combination of $k$ MPR nodes trigger. The top row in all these matrices represent having 0/n move uses, and when you are in that state you cannot leave it as shown with zero probability to go any other state.\n",
"\n",
"For convenience with the absorbing row is the top row rather than the bottom row. Thus we are not in canonical form, but are only one row and one column operation away. Here is a [wiki page](https://en.wikipedia.org/wiki/Absorbing_Markov_chain) for reference."
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
"@lru_cache\n",
"def t_matrix(n,m):\n",
" \"\"\"Funtion to generate general transition matrix\n",
" \"\"\"\n",
" mpr_triggers = [comb(m,i,exact=True)*p**i * (1-p)**(m-i) for i in range(m+1)]\n",
" t_matrix = sympy.eye(n+1)\n",
" for r_index in range(1,n+1):\n",
" for i,mpr_rate in enumerate(mpr_triggers):\n",
" c_index = r_index-1 + i\n",
" if c_index < n:\n",
" t_matrix[r_index,c_index] = mpr_rate\n",
" elif c_index >= n:\n",
" t_matrix[r_index,c_index] = sum(mpr_triggers[i:])\n",
" break\n",
"\n",
" return t_matrix\n",
"\n",
"@lru_cache\n",
"def q_matrix(n,m):\n",
" \"\"\"Transition to Transition Matrix\"\"\"\n",
" T = t_matrix(n,m)\n",
" return T[1:,1:]\n",
"\n",
"@lru_cache\n",
"def ones(n):\n",
" return sympy.Matrix([1 for _ in range(n)])"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Expected number of values\n",
"\n",
"Deine the fundamental matrix to be\n",
"$$ F_{n,m} = (I_{n} - Q_{n,m})^{-1} $$\n",
"\n",
"The expected number of uses will be\n",
"$$ \\textbf{e}_{n,m} = F_{n,m} \\textbf{1} $$\n",
"Where $I_{n}$ is the identity matrix of size $n$ and $Q_{n,m}$ is the transition to transition matrix, and $\\textbf{1}$ is a vector of only ones. The expected number of uses can be read off from the entries of $\\textbf{e}$, where the entry corresponds to your starting state. The top entry represents starting at 1/n MP while the bottom entry represents starting at n/n.\n",
"\n",
"We classify our matrices with the tuple $(n,m)$ where $n$ is the max MP of the move, and $m$ is the number of MPR nodes selected. An assumption built into the construction is that all the MPR nodes have the same trigger rate. This analysis can be generalized to do such, but we do not do it here."
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
"@lru_cache\n",
"def f_matrix(n,m):\n",
" \"\"\"Calculate the fundamental matrix:\n",
" (I_n-Q_{n,m})^{-1}\n",
" \"\"\"\n",
" fund_matrix = (sympy.eye(n) - q_matrix(n,m))**(-1)\n",
" return sympy.simplify(fund_matrix)\n",
"\n",
"@lru_cache\n",
"def e_vector(n,m):\n",
" e_vec = f_matrix(n,m) @ ones(n)\n",
" return sympy.simplify(e_vec)\n",
"\n",
"def expected_uses(n,m):\n",
" return e_vector(n,m)[n-1]\n",
"\n",
"def eval_expected(n,m):\n",
" display([expected_uses(n,m).subs(p,x) for x in mpr_rates])\n",
" print([f\"{expected_uses(n,m).evalf(subs={p:x}):.3f}\" for x in mpr_rates])"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Expected standard error\n",
"\n",
"The variance error of the expected number of move uses is\n",
"$$ \\textbf{s}^{2}_{n,m} = \\left(2 F_{n,m} - I_{n}\\right) \\cdot \\textbf{e}_{n,m} - \\textbf{e}_{n,m} \\otimes \\textbf{e}_{n,m} $$\n",
"Where $\\otimes$ is the Hammond product (entrywise multiplication). So we can write a relation to the standard error as:\n",
"$$ \\textbf{s}_{n,m} \\otimes \\textbf{s}_{n,m} = \\textbf{s}^{2}_{n,m}$$\n",
"\n",
"Thus the standard error can be read as the square root of the entries of $\\textbf{s}^{2}_{n,m}$, so the $i$th entry being $\\sqrt{\\left(\\textbf{s}^{2}_{n,m}\\right)_{i}}$. Which we interpret as the standard error of the expected number move uses starting at MP equal to $i$.\n",
"\n",
"This value is a measure of how spread out you would expect multiple independent observations. Later on in this analysis, you will see that variance (and thus the standard error) rises with $m$ quiet a bit. So these expected values are unreliable when planning for a specific combat encounter. "
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [],
"source": [
"@lru_cache\n",
"def var_vector(n,m):\n",
" \"\"\"variance on expected number of uses\"\"\"\n",
" e_vec = e_vector(n,m)\n",
" e_sqr = matrix_multiply_elementwise(e_vec, e_vec)\n",
" var_vec = (2*f_matrix(n,m) - sympy.eye(n)) @ e_vec - e_sqr\n",
" return sympy.simplify(var_vec)\n",
"\n",
"def expected_stderr(n,m):\n",
" stderr_value = sympy.sqrt(var_vector(n,m)[n-1]) \n",
" return sympy.simplify(stderr_value)\n",
"\n",
"def eval_stderr(n,m):\n",
" print([f\"{expected_stderr(n,m).evalf(subs={p:x}):.3f}\" for x in mpr_rates])"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Verification\n",
"\n",
"To verify these values, we use Monte Carlo simulations. None of the simulations are reported here, but the code that was used to simulated is provided for completeness.\n",
"\n",
"Most (but not all) cases were validated using this method. Each case in the original report was validate using this method [here](https://gist.github.com/josh-hernandez-exe/96902e9c7a488f24f8c0b9cc866f5dc0)."
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [],
"source": [
"from collections import Counter\n",
"import numpy as np\n",
"def emperical(start_mp, mpr_prob, num_nodes, num_simulations, cap_mp=None):\n",
" \"\"\"Helper function to emprically validate analysis\"\"\"\n",
" counter = Counter()\n",
" if cap_mp is None:\n",
" cap_mp = start_mp\n",
" for _ in range(num_simulations):\n",
" cur_mp = start_mp\n",
" count = 0\n",
" while cur_mp > 0:\n",
" cur_mp -= 1\n",
" count += 1\n",
" cur_mp += sum(np.random.rand(num_nodes) < mpr_prob )\n",
" cur_mp = min(cur_mp, cap_mp) # since our MP isn't unbounded\n",
"\n",
" counter[count] += 1\n",
" \n",
" expected_count = sum(\n",
" move_count*occurences\n",
" for move_count,occurences in counter.items()\n",
" )\n",
" expected_count /= num_simulations\n",
" \n",
" expected_variance = sum(\n",
" move_count**2 * occurences\n",
" for move_count,occurences in counter.items()\n",
" )\n",
" expected_variance /= num_simulations \n",
" expected_variance -= expected_count**2\n",
" \n",
" expected_strerr = expected_variance**(0.5)\n",
" \n",
" return expected_count, expected_strerr"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Then the following can be ran to validate results\n",
"```python\n",
"for n in range(1,4):\n",
" for rate in mpr_rates:\n",
" for m in range(1,3):\n",
" e_value = expected_uses(n,m).evalf(subs={p:rate})\n",
" stderr_value = expected_stderr(n,m).evalf(subs={p:rate})\n",
" sim_value, sim_stderr = emperical(\n",
" start_mp=n,\n",
" mpr_prob=float(rate),\n",
" num_nodes=m,\n",
" num_simulations=100_000,\n",
" )\n",
" print(f\"{(n, rate, m)}: mean {e_value:10.3f} {sim_value:10.3f}\")\n",
" print(f\"{(n, rate, m)}: stderr {stderr_value:10.3f} {sim_stderr:10.3f}\")\n",
" if abs(e_value-sim_value) > 0.5:\n",
" print(f\"Error\")\n",
"```"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## General Closed Form\n",
"\n",
"I speculate we might be able to find a closed form that approximates the answer. The analysis I have done imposes a cap on the MP value (which is the true case). But I think the formulas will simplify a lot if we let the MP value have no maximum, and we just set a starting value.\n",
"\n",
"In the later sections when we generate the transition matrices, you will notice that the matrices are pseudo diagonal. The symmetry in the entries break when you evaluate the probabilities near the max MP value. If we were to let MP be unbounded, that symmetry is maintained. Further work will need to be done using infinite Markov chain analysis."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Quick Reference\n",
"\n",
"For convenience here we summarize the numerical results for a subset of the explored values. We show the expected uses and the value of one standard deviation."
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"|1|0.3| 1.429 $\\pm$ 0.782| 2.041 $\\pm$ 1.457| 2.915 $\\pm$ 2.363|\n",
"|1|0.4| 1.667 $\\pm$ 1.054| 2.778 $\\pm$ 2.222| 4.630 $\\pm$ 4.099|\n",
"|1|0.5| 2.000 $\\pm$ 1.414| 4.000 $\\pm$ 3.464| 8.000 $\\pm$ 7.483|\n",
"|\n",
"|2|0.3| 2.857 $\\pm$ 1.107| 4.456 $\\pm$ 2.660| 7.667 $\\pm$ 5.841|\n",
"|2|0.4| 3.333 $\\pm$ 1.491| 6.790 $\\pm$ 4.887| 16.804 $\\pm$ 14.923|\n",
"|2|0.5| 4.000 $\\pm$ 2.000| 12.000 $\\pm$ 10.000| 48.000 $\\pm$ 46.130|\n",
"|\n",
"|3|0.3| 4.286 $\\pm$ 1.355| 6.941 $\\pm$ 3.631| 13.804 $\\pm$ 10.214|\n",
"|3|0.4| 5.000 $\\pm$ 1.826| 11.351 $\\pm$ 7.582| 42.645 $\\pm$ 38.828|\n",
"|3|0.5| 6.000 $\\pm$ 2.449| 24.000 $\\pm$ 19.799|224.000 $\\pm$ 220.327|\n"
]
}
],
"source": [
"raw_table = []\n",
"for n in range(1,4):\n",
" section = []\n",
" for rate in mpr_rates[2:5]:\n",
" line = []\n",
" for m in range(1,4):\n",
" e_value = expected_uses(n,m)\n",
" s_value = expected_stderr(n,m)\n",
" line.append(f\"{e_value.evalf(subs={p:rate}):7.3f} $\\pm$ {s_value.evalf(subs={p:rate}):7.3f}|\")\n",
" section.append(f\"|{n}|{float(rate)}|{''.join(line)}\")\n",
" raw_table.append(\"\\n\".join(section))\n",
"print(\"\\n|\\n\".join(raw_table))"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"| Max MP | MPR Rate | 1 Node | 2 Nodes | 3 Nodes |\n",
"|:------:|:--------:|:------:|:-------:|:-------:|\n",
"|1|0.3| 1.429 $\\pm$ 0.782| 2.041 $\\pm$ 1.457| 2.915 $\\pm$ 2.363|\n",
"|1|0.4| 1.667 $\\pm$ 1.054| 2.778 $\\pm$ 2.222| 4.630 $\\pm$ 4.099|\n",
"|1|0.5| 2.000 $\\pm$ 1.414| 4.000 $\\pm$ 3.464| 8.000 $\\pm$ 7.483|\n",
"|\n",
"|2|0.3| 2.857 $\\pm$ 1.107| 4.456 $\\pm$ 2.660| 7.667 $\\pm$ 5.841|\n",
"|2|0.4| 3.333 $\\pm$ 1.491| 6.790 $\\pm$ 4.887| 16.804 $\\pm$ 14.923|\n",
"|2|0.5| 4.000 $\\pm$ 2.000| 12.000 $\\pm$ 10.000| 48.000 $\\pm$ 46.130|\n",
"|\n",
"|3|0.3| 4.286 $\\pm$ 1.355| 6.941 $\\pm$ 3.631| 13.804 $\\pm$ 10.214|\n",
"|3|0.4| 5.000 $\\pm$ 1.826| 11.351 $\\pm$ 7.582| 42.645 $\\pm$ 38.828|\n",
"|3|0.5| 6.000 $\\pm$ 2.449| 24.000 $\\pm$ 19.799|224.000 $\\pm$ 220.327|"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Results\n",
"\n",
"The following section of this report covers generating the transition matrices for 1-4 max MP moves, having 1-3 MPR nodes, and trigger rates corresponding to MPR0 (0.1 trigger rate) to MPR5 (0.6 trigger rate). This is controlled by the setup variable `mpr_rates`.\n",
"\n",
"When interpreting the output of `eval_expected`, the output is repeated twice. The first group will be the MPR rates evaluated as true rational values, so the ouput will be as fractions. The second group will be as floating point values. You read the values in each of these list in correspondence to the values in `mpr_rates`. \n",
"\n",
"Similarly `eval_stderr` is the standard deviation of the expected number of move uses. Again with the entries corresponding to the list of values in `mpr_rates`.\n",
"\n",
"For convenience we will display `mpr_rates` after this section."
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"[1/10, 1/5, 3/10, 2/5, 1/2, 3/5]"
]
},
"execution_count": 7,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"mpr_rates"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Transition Matrices with One MPR node\n",
"\n",
"With only one MPR node this is simple enough to use the geometric series with the equation.\n",
"\n",
"$$\\textrm{Expected Uses} = \\frac{a}{1-p}$$\n",
"\n",
"where $a$ is the number starting uses, and $p$ is the probability of the MPR triggering. The reddit user zzladerp wrote a great explanation [here](https://www.reddit.com/r/PokemonMasters/comments/ir3xfj/stats_on_mp_usage_on_phantom_force/g4wg9gv?utm_source=share&utm_medium=web2x&context=3). This result is also consistent with the Markov chain analysis to be done."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Max 1 MP with One MPR node"
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {},
"outputs": [
{
"data": {
"text/latex": [
"$\\displaystyle \\left[\\begin{matrix}1 & 0\\\\1 - p & p\\end{matrix}\\right]$"
],
"text/plain": [
"Matrix([\n",
"[ 1, 0],\n",
"[1 - p, p]])"
]
},
"execution_count": 8,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"t_matrix(1,1)"
]
},
{
"cell_type": "code",
"execution_count": 9,
"metadata": {},
"outputs": [
{
"data": {
"text/latex": [
"$\\displaystyle - \\frac{1}{p - 1}$"
],
"text/plain": [
"-1/(p - 1)"
]
},
"execution_count": 9,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"expected_uses(1,1)"
]
},
{
"cell_type": "code",
"execution_count": 10,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"[10/9, 5/4, 10/7, 5/3, 2, 5/2]"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"['1.111', '1.250', '1.429', '1.667', '2.000', '2.500']\n"
]
}
],
"source": [
"eval_expected(1,1)"
]
},
{
"cell_type": "code",
"execution_count": 11,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"['0.351', '0.559', '0.782', '1.054', '1.414', '1.936']\n"
]
}
],
"source": [
"eval_stderr(1,1)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Max 2 MP with One MPR node"
]
},
{
"cell_type": "code",
"execution_count": 12,
"metadata": {},
"outputs": [
{
"data": {
"text/latex": [
"$\\displaystyle \\left[\\begin{matrix}1 & 0 & 0\\\\1 - p & p & 0\\\\0 & 1 - p & p\\end{matrix}\\right]$"
],
"text/plain": [
"Matrix([\n",
"[ 1, 0, 0],\n",
"[1 - p, p, 0],\n",
"[ 0, 1 - p, p]])"
]
},
"execution_count": 12,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"t_matrix(2,1)"
]
},
{
"cell_type": "code",
"execution_count": 13,
"metadata": {},
"outputs": [
{
"data": {
"text/latex": [
"$\\displaystyle - \\frac{2}{p - 1}$"
],
"text/plain": [
"-2/(p - 1)"
]
},
"execution_count": 13,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"expected_uses(2,1)"
]
},
{
"cell_type": "code",
"execution_count": 14,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"[20/9, 5/2, 20/7, 10/3, 4, 5]"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"['2.222', '2.500', '2.857', '3.333', '4.000', '5.000']\n"
]
}
],
"source": [
"eval_expected(2,1)"
]
},
{
"cell_type": "code",
"execution_count": 15,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"['0.497', '0.791', '1.107', '1.491', '2.000', '2.739']\n"
]
}
],
"source": [
"eval_stderr(2,1)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Max 3 MP with One MPR node"
]
},
{
"cell_type": "code",
"execution_count": 16,
"metadata": {},
"outputs": [
{
"data": {
"text/latex": [
"$\\displaystyle \\left[\\begin{matrix}1 & 0 & 0 & 0\\\\1 - p & p & 0 & 0\\\\0 & 1 - p & p & 0\\\\0 & 0 & 1 - p & p\\end{matrix}\\right]$"
],
"text/plain": [
"Matrix([\n",
"[ 1, 0, 0, 0],\n",
"[1 - p, p, 0, 0],\n",
"[ 0, 1 - p, p, 0],\n",
"[ 0, 0, 1 - p, p]])"
]
},
"execution_count": 16,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"t_matrix(3,1)"
]
},
{
"cell_type": "code",
"execution_count": 17,
"metadata": {},
"outputs": [
{
"data": {
"text/latex": [
"$\\displaystyle - \\frac{3}{p - 1}$"
],
"text/plain": [
"-3/(p - 1)"
]
},
"execution_count": 17,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"expected_uses(3,1)"
]
},
{
"cell_type": "code",
"execution_count": 18,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"[10/3, 15/4, 30/7, 5, 6, 15/2]"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"['3.333', '3.750', '4.286', '5.000', '6.000', '7.500']\n"
]
}
],
"source": [
"eval_expected(3,1)"
]
},
{
"cell_type": "code",
"execution_count": 19,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"['0.609', '0.968', '1.355', '1.826', '2.449', '3.354']\n"
]
}
],
"source": [
"eval_stderr(3,1)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Max 4 MP with One MPR node"
]
},
{
"cell_type": "code",
"execution_count": 20,
"metadata": {},
"outputs": [
{
"data": {
"text/latex": [
"$\\displaystyle \\left[\\begin{matrix}1 & 0 & 0 & 0 & 0\\\\1 - p & p & 0 & 0 & 0\\\\0 & 1 - p & p & 0 & 0\\\\0 & 0 & 1 - p & p & 0\\\\0 & 0 & 0 & 1 - p & p\\end{matrix}\\right]$"
],
"text/plain": [
"Matrix([\n",
"[ 1, 0, 0, 0, 0],\n",
"[1 - p, p, 0, 0, 0],\n",
"[ 0, 1 - p, p, 0, 0],\n",
"[ 0, 0, 1 - p, p, 0],\n",
"[ 0, 0, 0, 1 - p, p]])"
]
},
"execution_count": 20,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"t_matrix(4,1)"
]
},
{
"cell_type": "code",
"execution_count": 21,
"metadata": {},
"outputs": [
{
"data": {
"text/latex": [
"$\\displaystyle - \\frac{4}{p - 1}$"
],
"text/plain": [
"-4/(p - 1)"
]
},
"execution_count": 21,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"expected_uses(4,1)"
]
},
{
"cell_type": "code",
"execution_count": 22,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"[40/9, 5, 40/7, 20/3, 8, 10]"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"['4.444', '5.000', '5.714', '6.667', '8.000', '10.000']\n"
]
}
],
"source": [
"eval_expected(4,1)"
]
},
{
"cell_type": "code",
"execution_count": 23,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"['0.703', '1.118', '1.565', '2.108', '2.828', '3.873']\n"
]
}
],
"source": [
"eval_stderr(4,1)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Transition Matrices with Two MPR nodes\n",
"These matrices will assume two MPR nodes selected in the units grid. At the moment a closed form with respect the max usages the move has isn't clear."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Max 1 MP with Two MPR node"
]
},
{
"cell_type": "code",
"execution_count": 24,
"metadata": {},
"outputs": [
{
"data": {
"text/latex": [
"$\\displaystyle \\left[\\begin{matrix}1 & 0\\\\\\left(1 - p\\right)^{2} & p^{2} + 2 p \\left(1 - p\\right)\\end{matrix}\\right]$"
],
"text/plain": [
"Matrix([\n",
"[ 1, 0],\n",
"[(1 - p)**2, p**2 + 2*p*(1 - p)]])"
]
},
"execution_count": 24,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"t_matrix(1,2)"
]
},
{
"cell_type": "code",
"execution_count": 25,
"metadata": {},
"outputs": [
{
"data": {
"text/latex": [
"$\\displaystyle \\frac{1}{p^{2} - 2 p + 1}$"
],
"text/plain": [
"1/(p**2 - 2*p + 1)"
]
},
"execution_count": 25,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"expected_uses(1,2)"
]
},
{
"cell_type": "code",
"execution_count": 26,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"[100/81, 25/16, 100/49, 25/9, 4, 25/4]"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"['1.235', '1.562', '2.041', '2.778', '4.000', '6.250']\n"
]
}
],
"source": [
"eval_expected(1,2)"
]
},
{
"cell_type": "code",
"execution_count": 27,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"['0.538', '0.938', '1.457', '2.222', '3.464', '5.728']\n"
]
}
],
"source": [
"eval_stderr(1,2)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Max 2 MP with Two MPR nodes"
]
},
{
"cell_type": "code",
"execution_count": 28,
"metadata": {},
"outputs": [
{
"data": {
"text/latex": [
"$\\displaystyle \\left[\\begin{matrix}1 & 0 & 0\\\\\\left(1 - p\\right)^{2} & 2 p \\left(1 - p\\right) & p^{2}\\\\0 & \\left(1 - p\\right)^{2} & p^{2} + 2 p \\left(1 - p\\right)\\end{matrix}\\right]$"
],
"text/plain": [
"Matrix([\n",
"[ 1, 0, 0],\n",
"[(1 - p)**2, 2*p*(1 - p), p**2],\n",
"[ 0, (1 - p)**2, p**2 + 2*p*(1 - p)]])"
]
},
"execution_count": 28,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"t_matrix(2,2)"
]
},
{
"cell_type": "code",
"execution_count": 29,
"metadata": {},
"outputs": [
{
"data": {
"text/latex": [
"$\\displaystyle \\frac{3 p^{2} - 4 p + 2}{p^{4} - 4 p^{3} + 6 p^{2} - 4 p + 1}$"
],
"text/plain": [
"(3*p**2 - 4*p + 2)/(p**4 - 4*p**3 + 6*p**2 - 4*p + 1)"
]
},
"execution_count": 29,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"expected_uses(2,2)"
]
},
{
"cell_type": "code",
"execution_count": 30,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"[16300/6561, 825/256, 10700/2401, 550/81, 12, 425/16]"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"['2.484', '3.223', '4.456', '6.790', '12.000', '26.562']\n"
]
}
],
"source": [
"eval_expected(2,2)"
]
},
{
"cell_type": "code",
"execution_count": 31,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"['0.800', '1.510', '2.660', '4.887', '10.000', '24.513']\n"
]
}
],
"source": [
"eval_stderr(2,2)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Max 3 MP with Two MPR node"
]
},
{
"cell_type": "code",
"execution_count": 32,
"metadata": {},
"outputs": [
{
"data": {
"text/latex": [
"$\\displaystyle \\left[\\begin{matrix}1 & 0 & 0 & 0\\\\\\left(1 - p\\right)^{2} & 2 p \\left(1 - p\\right) & p^{2} & 0\\\\0 & \\left(1 - p\\right)^{2} & 2 p \\left(1 - p\\right) & p^{2}\\\\0 & 0 & \\left(1 - p\\right)^{2} & p^{2} + 2 p \\left(1 - p\\right)\\end{matrix}\\right]$"
],
"text/plain": [
"Matrix([\n",
"[ 1, 0, 0, 0],\n",
"[(1 - p)**2, 2*p*(1 - p), p**2, 0],\n",
"[ 0, (1 - p)**2, 2*p*(1 - p), p**2],\n",
"[ 0, 0, (1 - p)**2, p**2 + 2*p*(1 - p)]])"
]
},
"execution_count": 32,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"t_matrix(3,2)"
]
},
{
"cell_type": "code",
"execution_count": 33,
"metadata": {},
"outputs": [
{
"data": {
"text/latex": [
"$\\displaystyle \\frac{6 p^{4} - 16 p^{3} + 20 p^{2} - 12 p + 3}{p^{6} - 6 p^{5} + 15 p^{4} - 20 p^{3} + 15 p^{2} - 6 p + 1}$"
],
"text/plain": [
"(6*p**4 - 16*p**3 + 20*p**2 - 12*p + 3)/(p**6 - 6*p**5 + 15*p**4 - 20*p**3 + 15*p**2 - 6*p + 1)"
]
},
"execution_count": 33,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"expected_uses(3,2)"
]
},
{
"cell_type": "code",
"execution_count": 34,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"[1984600/531441, 20025/4096, 816600/117649, 8275/729, 24, 5025/64]"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"['3.734', '4.889', '6.941', '11.351', '24.000', '78.516']\n"
]
}
],
"source": [
"eval_expected(3,2)"
]
},
{
"cell_type": "code",
"execution_count": 35,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"['0.995', '1.937', '3.631', '7.582', '19.799', '74.164']\n"
]
}
],
"source": [
"eval_stderr(3,2)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Max 4 MP with Two MPR nodes"
]
},
{
"cell_type": "code",
"execution_count": 36,
"metadata": {},
"outputs": [
{
"data": {
"text/latex": [
"$\\displaystyle \\left[\\begin{matrix}1 & 0 & 0 & 0 & 0\\\\\\left(1 - p\\right)^{2} & 2 p \\left(1 - p\\right) & p^{2} & 0 & 0\\\\0 & \\left(1 - p\\right)^{2} & 2 p \\left(1 - p\\right) & p^{2} & 0\\\\0 & 0 & \\left(1 - p\\right)^{2} & 2 p \\left(1 - p\\right) & p^{2}\\\\0 & 0 & 0 & \\left(1 - p\\right)^{2} & p^{2} + 2 p \\left(1 - p\\right)\\end{matrix}\\right]$"
],
"text/plain": [
"Matrix([\n",
"[ 1, 0, 0, 0, 0],\n",
"[(1 - p)**2, 2*p*(1 - p), p**2, 0, 0],\n",
"[ 0, (1 - p)**2, 2*p*(1 - p), p**2, 0],\n",
"[ 0, 0, (1 - p)**2, 2*p*(1 - p), p**2],\n",
"[ 0, 0, 0, (1 - p)**2, p**2 + 2*p*(1 - p)]])"
]
},
"execution_count": 36,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"t_matrix(4,2)"
]
},
{
"cell_type": "code",
"execution_count": 37,
"metadata": {},
"outputs": [
{
"data": {
"text/latex": [
"$\\displaystyle \\frac{10 p^{6} - 40 p^{5} + 80 p^{4} - 92 p^{3} + 63 p^{2} - 24 p + 4}{p^{8} - 8 p^{7} + 28 p^{6} - 56 p^{5} + 70 p^{4} - 56 p^{3} + 28 p^{2} - 8 p + 1}$"
],
"text/plain": [
"(10*p**6 - 40*p**5 + 80*p**4 - 92*p**3 + 63*p**2 - 24*p + 4)/(p**8 - 8*p**7 + 28*p**6 - 56*p**5 + 70*p**4 - 56*p**3 + 28*p**2 - 8*p + 1)"
]
},
"execution_count": 37,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"expected_uses(4,2)"
]
},
{
"cell_type": "code",
"execution_count": 38,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"[214561000/43046721,\n",
" 429625/65536,\n",
" 54409000/5764801,\n",
" 106000/6561,\n",
" 40,\n",
" 51625/256]"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"['4.984', '6.556', '9.438', '16.156', '40.000', '201.660']\n"
]
}
],
"source": [
"eval_expected(4,2)"
]
},
{
"cell_type": "code",
"execution_count": 39,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"['1.159', '2.288', '4.432', '10.098', '32.863', '194.307']\n"
]
}
],
"source": [
"eval_stderr(4,2)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Transition Matrices with Three MPR node\n",
"These matrices will assume two MPR nodes selected in the units grid. Similar to the set of transition matrices with two MPR nodes, a closed form with respect the max usages the move has isn't clear.\n",
"\n",
"No move in the game currently has 3 MPR nodes. This section is done as an exploration."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Max 1 MP with Three MPR nodes"
]
},
{
"cell_type": "code",
"execution_count": 40,
"metadata": {},
"outputs": [
{
"data": {
"text/latex": [
"$\\displaystyle \\left[\\begin{matrix}1 & 0\\\\\\left(1 - p\\right)^{3} & p^{3} + 3 p^{2} \\left(1 - p\\right) + 3 p \\left(1 - p\\right)^{2}\\end{matrix}\\right]$"
],
"text/plain": [
"Matrix([\n",
"[ 1, 0],\n",
"[(1 - p)**3, p**3 + 3*p**2*(1 - p) + 3*p*(1 - p)**2]])"
]
},
"execution_count": 40,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"t_matrix(1,3)"
]
},
{
"cell_type": "code",
"execution_count": 41,
"metadata": {},
"outputs": [
{
"data": {
"text/latex": [
"$\\displaystyle - \\frac{1}{p^{3} - 3 p^{2} + 3 p - 1}$"
],
"text/plain": [
"-1/(p**3 - 3*p**2 + 3*p - 1)"
]
},
"execution_count": 41,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"expected_uses(1,3)"
]
},
{
"cell_type": "code",
"execution_count": 42,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"[1000/729, 125/64, 1000/343, 125/27, 8, 125/8]"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"['1.372', '1.953', '2.915', '4.630', '8.000', '15.625']\n"
]
}
],
"source": [
"eval_expected(1,3)"
]
},
{
"cell_type": "code",
"execution_count": 43,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"['0.714', '1.364', '2.363', '4.099', '7.483', '15.117']\n"
]
}
],
"source": [
"eval_stderr(1,3)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Max 2 MP with Three MPR nodes"
]
},
{
"cell_type": "code",
"execution_count": 44,
"metadata": {},
"outputs": [
{
"data": {
"text/latex": [
"$\\displaystyle \\left[\\begin{matrix}1 & 0 & 0\\\\\\left(1 - p\\right)^{3} & 3 p \\left(1 - p\\right)^{2} & p^{3} + 3 p^{2} \\left(1 - p\\right)\\\\0 & \\left(1 - p\\right)^{3} & p^{3} + 3 p^{2} \\left(1 - p\\right) + 3 p \\left(1 - p\\right)^{2}\\end{matrix}\\right]$"
],
"text/plain": [
"Matrix([\n",
"[ 1, 0, 0],\n",
"[(1 - p)**3, 3*p*(1 - p)**2, p**3 + 3*p**2*(1 - p)],\n",
"[ 0, (1 - p)**3, p**3 + 3*p**2*(1 - p) + 3*p*(1 - p)**2]])"
]
},
"execution_count": 44,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"t_matrix(2,3)"
]
},
{
"cell_type": "code",
"execution_count": 45,
"metadata": {},
"outputs": [
{
"data": {
"text/latex": [
"$\\displaystyle \\frac{- 4 p^{3} + 9 p^{2} - 6 p + 2}{p^{6} - 6 p^{5} + 15 p^{4} - 20 p^{3} + 15 p^{2} - 6 p + 1}$"
],
"text/plain": [
"(-4*p**3 + 9*p**2 - 6*p + 2)/(p**6 - 6*p**5 + 15*p**4 - 20*p**3 + 15*p**2 - 6*p + 1)"
]
},
"execution_count": 45,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"expected_uses(2,3)"
]
},
{
"cell_type": "code",
"execution_count": 46,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"[1486000/531441, 17625/4096, 902000/117649, 12250/729, 48, 12125/64]"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"['2.796', '4.303', '7.667', '16.804', '48.000', '189.453']\n"
]
}
],
"source": [
"eval_expected(2,3)"
]
},
{
"cell_type": "code",
"execution_count": 47,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"['1.122', '2.566', '5.841', '14.923', '46.130', '187.656']\n"
]
}
],
"source": [
"eval_stderr(2,3)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Max 3 MP with Three MPR nodes"
]
},
{
"cell_type": "code",
"execution_count": 48,
"metadata": {},
"outputs": [
{
"data": {
"text/latex": [
"$\\displaystyle \\left[\\begin{matrix}1 & 0 & 0 & 0\\\\\\left(1 - p\\right)^{3} & 3 p \\left(1 - p\\right)^{2} & 3 p^{2} \\left(1 - p\\right) & p^{3}\\\\0 & \\left(1 - p\\right)^{3} & 3 p \\left(1 - p\\right)^{2} & p^{3} + 3 p^{2} \\left(1 - p\\right)\\\\0 & 0 & \\left(1 - p\\right)^{3} & p^{3} + 3 p^{2} \\left(1 - p\\right) + 3 p \\left(1 - p\\right)^{2}\\end{matrix}\\right]$"
],
"text/plain": [
"Matrix([\n",
"[ 1, 0, 0, 0],\n",
"[(1 - p)**3, 3*p*(1 - p)**2, 3*p**2*(1 - p), p**3],\n",
"[ 0, (1 - p)**3, 3*p*(1 - p)**2, p**3 + 3*p**2*(1 - p)],\n",
"[ 0, 0, (1 - p)**3, p**3 + 3*p**2*(1 - p) + 3*p*(1 - p)**2]])"
]
},
"execution_count": 48,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"t_matrix(3,3)"
]
},
{
"cell_type": "code",
"execution_count": 49,
"metadata": {},
"outputs": [
{
"data": {
"text/latex": [
"$\\displaystyle \\frac{- 10 p^{6} + 45 p^{5} - 81 p^{4} + 81 p^{3} - 51 p^{2} + 18 p - 3}{p^{9} - 9 p^{8} + 36 p^{7} - 84 p^{6} + 126 p^{5} - 126 p^{4} + 84 p^{3} - 36 p^{2} + 9 p - 1}$"
],
"text/plain": [
"(-10*p**6 + 45*p**5 - 81*p**4 + 81*p**3 - 51*p**2 + 18*p - 3)/(p**9 - 9*p**8 + 36*p**7 - 84*p**6 + 126*p**5 - 126*p**4 + 84*p**3 - 36*p**2 + 9*p - 1)"
]
},
"execution_count": 49,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"expected_uses(3,3)"
]
},
{
"cell_type": "code",
"execution_count": 50,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"[1636660000/387420489,\n",
" 1773125/262144,\n",
" 557040000/40353607,\n",
" 839375/19683,\n",
" 224,\n",
" 1033125/512]"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"['4.225', '6.764', '13.804', '42.645', '224.000', '2017.822']\n"
]
}
],
"source": [
"eval_expected(3,3)"
]
},
{
"cell_type": "code",
"execution_count": 51,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"['1.429', '3.605', '10.214', '38.828', '220.327', '2014.506']\n"
]
}
],
"source": [
"eval_stderr(3,3)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Max 4 MP with Three MPR nodes"
]
},
{
"cell_type": "code",
"execution_count": 52,
"metadata": {},
"outputs": [
{
"data": {
"text/latex": [
"$\\displaystyle \\left[\\begin{matrix}1 & 0 & 0 & 0 & 0\\\\\\left(1 - p\\right)^{3} & 3 p \\left(1 - p\\right)^{2} & 3 p^{2} \\left(1 - p\\right) & p^{3} & 0\\\\0 & \\left(1 - p\\right)^{3} & 3 p \\left(1 - p\\right)^{2} & 3 p^{2} \\left(1 - p\\right) & p^{3}\\\\0 & 0 & \\left(1 - p\\right)^{3} & 3 p \\left(1 - p\\right)^{2} & p^{3} + 3 p^{2} \\left(1 - p\\right)\\\\0 & 0 & 0 & \\left(1 - p\\right)^{3} & p^{3} + 3 p^{2} \\left(1 - p\\right) + 3 p \\left(1 - p\\right)^{2}\\end{matrix}\\right]$"
],
"text/plain": [
"Matrix([\n",
"[ 1, 0, 0, 0, 0],\n",
"[(1 - p)**3, 3*p*(1 - p)**2, 3*p**2*(1 - p), p**3, 0],\n",
"[ 0, (1 - p)**3, 3*p*(1 - p)**2, 3*p**2*(1 - p), p**3],\n",
"[ 0, 0, (1 - p)**3, 3*p*(1 - p)**2, p**3 + 3*p**2*(1 - p)],\n",
"[ 0, 0, 0, (1 - p)**3, p**3 + 3*p**2*(1 - p) + 3*p*(1 - p)**2]])"
]
},
"execution_count": 52,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"t_matrix(4,3)"
]
},
{
"cell_type": "code",
"execution_count": 53,
"metadata": {},
"outputs": [
{
"data": {
"text/latex": [
"$\\displaystyle \\frac{- 20 p^{9} + 135 p^{8} - 396 p^{7} + 690 p^{6} - 816 p^{5} + 681 p^{4} - 394 p^{3} + 153 p^{2} - 36 p + 4}{p^{12} - 12 p^{11} + 66 p^{10} - 220 p^{9} + 495 p^{8} - 792 p^{7} + 924 p^{6} - 792 p^{5} + 495 p^{4} - 220 p^{3} + 66 p^{2} - 12 p + 1}$"
],
"text/plain": [
"(-20*p**9 + 135*p**8 - 396*p**7 + 690*p**6 - 816*p**5 + 681*p**4 - 394*p**3 + 153*p**2 - 36*p + 4)/(p**12 - 12*p**11 + 66*p**10 - 220*p**9 + 495*p**8 - 792*p**7 + 924*p**6 - 792*p**5 + 495*p**4 - 220*p**3 + 66*p**2 - 12*p + 1)"
]
},
"execution_count": 53,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"expected_uses(4,3)"
]
},
{
"cell_type": "code",
"execution_count": 54,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"[1596591730000/282429536481,\n",
" 155250625/16777216,\n",
" 290088490000/13841287201,\n",
" 49420000/531441,\n",
" 976,\n",
" 86558125/4096]"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"['5.653', '9.254', '20.958', '92.992', '976.000', '21132.355']\n"
]
}
],
"source": [
"eval_expected(4,3)"
]
},
{
"cell_type": "code",
"execution_count": 55,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"['1.682', '4.485', '15.138', '86.668', '970.237', '21127.452']\n"
]
}
],
"source": [
"eval_stderr(4,3)"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.5"
}
},
"nbformat": 4,
"nbformat_minor": 4
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment