"# Generalization of Prior Commitment by Simon Aronson"
]
},
{
"cell_type": "markdown",
"id": "3f0faf1f",
"metadata": {},
"source": [
"This notebook investigates the mathematical conditions for a practically feasible version of a card trick involving two Jokers. The possible positions $a$ and $b$ of the Jokers in a deck of $N$ cards are analyzed.\n",
"\n",
"The first spectator is asked to cut off approximately a fraction $\\alpha$ of the deck, allowing for a relative deviation $\\varepsilon$. The second spectator then cuts off approximately half of the remaining cards. For different values of $\\alpha$, the notebook determines which Joker positions $(a,b)$ ensure that both cuts occur in the required regions of the deck.\n",
"\n",
"The notebook computes the set of all admissible pairs $(a,b)$ and to identify suitable configurations for performing the trick in practice."
]
},
{
"cell_type": "markdown",
"id": "70488098",
"metadata": {},
"source": [
"## Version with $\\alpha \\in [0.25,0.5]$"
]
},
{
"cell_type": "code",
"execution_count": 3,
"id": "2c46c5fb",
"metadata": {},
"outputs": [],
"source": [
"import numpy as np\n",
"from math import ceil, floor\n",
"\n",
"N=54 #size of the deck\n",
"epsilon=0.2 #deviation\n",
"\n",
"possible_solutions=set()\n",
"alphas = np.linspace(1/4, 1/2, 100).tolist()\n",
"for alpha in alphas:\n",
" s=ceil(alpha*N*(1-epsilon))\n",
" for a in range(1,s):\n",
" t=floor(alpha*N*(1+epsilon))+1\n",
" for b in range(t+1,N):\n",
" if (b<(N-s)/2*(1-epsilon)+s):\n",
" possible_solutions.add((a,b))"
]
},
{
"cell_type": "code",
"execution_count": 4,
"id": "c8192676",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"272"
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"len(possible_solutions)"
]
},
{
"cell_type": "markdown",
"id": "25e91ad8",
"metadata": {},
"source": [
"## Discrete version with $\\alpha\\in\\{0.25,0.33,0.5\\}$"
# Generalization of Prior Commitment by Simon Aronson
%% Cell type:markdown id:3f0faf1f tags:
This notebook investigates the mathematical conditions for a practically feasible version of a card trick involving two Jokers. The possible positions $a$ and $b$ of the Jokers in a deck of $N$ cards are analyzed.
The first spectator is asked to cut off approximately a fraction $\alpha$ of the deck, allowing for a relative deviation $\varepsilon$. The second spectator then cuts off approximately half of the remaining cards. For different values of $\alpha$, the notebook determines which Joker positions $(a,b)$ ensure that both cuts occur in the required regions of the deck.
The notebook computes the set of all admissible pairs $(a,b)$ and to identify suitable configurations for performing the trick in practice.
%% Cell type:markdown id:70488098 tags:
## Version with $\alpha \in [0.25,0.5]$
%% Cell type:code id:2c46c5fb tags:
``` python
importnumpyasnp
frommathimportceil,floor
N=54#size of the deck
epsilon=0.2#deviation
possible_solutions=set()
alphas=np.linspace(1/4,1/2,100).tolist()
foralphainalphas:
s=ceil(alpha*N*(1-epsilon))
forainrange(1,s):
t=floor(alpha*N*(1+epsilon))+1
forbinrange(t+1,N):
if(b<(N-s)/2*(1-epsilon)+s):
possible_solutions.add((a,b))
```
%% Cell type:code id:c8192676 tags:
``` python
len(possible_solutions)
```
%% Output
272
%% Cell type:markdown id:25e91ad8 tags:
## Discrete version with $\alpha\in\{0.25,0.33,0.5\}$