"# 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 is used to verify the theoretically derived conditions numerically and to identify suitable configurations for performing the trick in practice."
]
},
{
"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))\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": [
"293"
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"len(possible_solutions)"
]
},
{
"cell_type": "markdown",
"id": "25e91ad8",
"metadata": {},
"source": [
"Discrete version $(\\alpha\\in\\{0.25,0.33,0.5\\})$"
]
},
{
"cell_type": "code",
"execution_count": 5,
"id": "e2fecd60",
"metadata": {},
"outputs": [],
"source": [
"N=54 #size of the deck\n",
"epsilon=0.2 #deviation\n",
"\n",
"possible_solutions=set()\n",
"alphas = [0.25,0.33,0.5]\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))\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": 6,
"id": "7a425763",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"218"
]
},
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"len(possible_solutions)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "c2cd69c9",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"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.10.12"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
%% Cell type:markdown id:40004058 tags:
# 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 is used to verify the theoretically derived conditions numerically and to identify suitable configurations for performing the trick in practice.