Commit bd912a17 authored by Weng's avatar Weng
Browse files

Upload New File

parent 4fab8bc7
%% 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 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
import numpy as np
from math import ceil, floor
N=54 #size of the deck
epsilon=0.2 #deviation
possible_solutions=set()
alphas = np.linspace(1/4, 1/2, 100).tolist()
for alpha in alphas:
s=ceil(alpha*N*(1-epsilon))
for a in range(1,s):
t=floor(alpha*N*(1+epsilon))+1
for b in range(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\}$
%% Cell type:code id:e2fecd60 tags:
``` python
N=54 #size of the deck
epsilon=0.2 #deviation
possible_solutions=set()
alphas = [0.25,0.33,0.5]
for alpha in alphas:
s=ceil(alpha*N*(1-epsilon))
for a in range(1,s):
t=floor(alpha*N*(1+epsilon))+1
for b in range(t+1,N):
if (b<(N-s)/2*(1-epsilon)+s):
possible_solutions.add((a,b))
```
%% Cell type:code id:7a425763 tags:
``` python
len(possible_solutions)
```
%% Output
183
%% Cell type:code id:c2cd69c9 tags:
``` python
N=54 #size of the deck
epsilon=0.2 #deviation
possible_solutions=set()
alphas = [0.25,0.33,0.5]
for alpha in alphas:
s=ceil(alpha*N*(1-epsilon))
for a in range(1,s):
t=floor(alpha*N*(1+epsilon))+1
for b in range(t+1,N):
if (b<(N-s)/2*(1-epsilon)+s):
print((a,b,b-a-1,N-a-1,alpha))
possible_solutions.add((a,b,b-a-1,N-a-1,alpha))
len(possible_solutions)
```
%% Output
(1, 18, 16, 52, 0.25)
(1, 19, 17, 52, 0.25)
(1, 20, 18, 52, 0.25)
(1, 21, 19, 52, 0.25)
(1, 22, 20, 52, 0.25)
(1, 23, 21, 52, 0.25)
(1, 24, 22, 52, 0.25)
(1, 25, 23, 52, 0.25)
(1, 26, 24, 52, 0.25)
(1, 27, 25, 52, 0.25)
(1, 28, 26, 52, 0.25)
(2, 18, 15, 51, 0.25)
(2, 19, 16, 51, 0.25)
(2, 20, 17, 51, 0.25)
(2, 21, 18, 51, 0.25)
(2, 22, 19, 51, 0.25)
(2, 23, 20, 51, 0.25)
(2, 24, 21, 51, 0.25)
(2, 25, 22, 51, 0.25)
(2, 26, 23, 51, 0.25)
(2, 27, 24, 51, 0.25)
(2, 28, 25, 51, 0.25)
(3, 18, 14, 50, 0.25)
(3, 19, 15, 50, 0.25)
(3, 20, 16, 50, 0.25)
(3, 21, 17, 50, 0.25)
(3, 22, 18, 50, 0.25)
(3, 23, 19, 50, 0.25)
(3, 24, 20, 50, 0.25)
(3, 25, 21, 50, 0.25)
(3, 26, 22, 50, 0.25)
(3, 27, 23, 50, 0.25)
(3, 28, 24, 50, 0.25)
(4, 18, 13, 49, 0.25)
(4, 19, 14, 49, 0.25)
(4, 20, 15, 49, 0.25)
(4, 21, 16, 49, 0.25)
(4, 22, 17, 49, 0.25)
(4, 23, 18, 49, 0.25)
(4, 24, 19, 49, 0.25)
(4, 25, 20, 49, 0.25)
(4, 26, 21, 49, 0.25)
(4, 27, 22, 49, 0.25)
(4, 28, 23, 49, 0.25)
(5, 18, 12, 48, 0.25)
(5, 19, 13, 48, 0.25)
(5, 20, 14, 48, 0.25)
(5, 21, 15, 48, 0.25)
(5, 22, 16, 48, 0.25)
(5, 23, 17, 48, 0.25)
(5, 24, 18, 48, 0.25)
(5, 25, 19, 48, 0.25)
(5, 26, 20, 48, 0.25)
(5, 27, 21, 48, 0.25)
(5, 28, 22, 48, 0.25)
(6, 18, 11, 47, 0.25)
(6, 19, 12, 47, 0.25)
(6, 20, 13, 47, 0.25)
(6, 21, 14, 47, 0.25)
(6, 22, 15, 47, 0.25)
(6, 23, 16, 47, 0.25)
(6, 24, 17, 47, 0.25)
(6, 25, 18, 47, 0.25)
(6, 26, 19, 47, 0.25)
(6, 27, 20, 47, 0.25)
(6, 28, 21, 47, 0.25)
(7, 18, 10, 46, 0.25)
(7, 19, 11, 46, 0.25)
(7, 20, 12, 46, 0.25)
(7, 21, 13, 46, 0.25)
(7, 22, 14, 46, 0.25)
(7, 23, 15, 46, 0.25)
(7, 24, 16, 46, 0.25)
(7, 25, 17, 46, 0.25)
(7, 26, 18, 46, 0.25)
(7, 27, 19, 46, 0.25)
(7, 28, 20, 46, 0.25)
(8, 18, 9, 45, 0.25)
(8, 19, 10, 45, 0.25)
(8, 20, 11, 45, 0.25)
(8, 21, 12, 45, 0.25)
(8, 22, 13, 45, 0.25)
(8, 23, 14, 45, 0.25)
(8, 24, 15, 45, 0.25)
(8, 25, 16, 45, 0.25)
(8, 26, 17, 45, 0.25)
(8, 27, 18, 45, 0.25)
(8, 28, 19, 45, 0.25)
(9, 18, 8, 44, 0.25)
(9, 19, 9, 44, 0.25)
(9, 20, 10, 44, 0.25)
(9, 21, 11, 44, 0.25)
(9, 22, 12, 44, 0.25)
(9, 23, 13, 44, 0.25)
(9, 24, 14, 44, 0.25)
(9, 25, 15, 44, 0.25)
(9, 26, 16, 44, 0.25)
(9, 27, 17, 44, 0.25)
(9, 28, 18, 44, 0.25)
(10, 18, 7, 43, 0.25)
(10, 19, 8, 43, 0.25)
(10, 20, 9, 43, 0.25)
(10, 21, 10, 43, 0.25)
(10, 22, 11, 43, 0.25)
(10, 23, 12, 43, 0.25)
(10, 24, 13, 43, 0.25)
(10, 25, 14, 43, 0.25)
(10, 26, 15, 43, 0.25)
(10, 27, 16, 43, 0.25)
(10, 28, 17, 43, 0.25)
(1, 23, 21, 52, 0.33)
(1, 24, 22, 52, 0.33)
(1, 25, 23, 52, 0.33)
(1, 26, 24, 52, 0.33)
(1, 27, 25, 52, 0.33)
(1, 28, 26, 52, 0.33)
(1, 29, 27, 52, 0.33)
(1, 30, 28, 52, 0.33)
(2, 23, 20, 51, 0.33)
(2, 24, 21, 51, 0.33)
(2, 25, 22, 51, 0.33)
(2, 26, 23, 51, 0.33)
(2, 27, 24, 51, 0.33)
(2, 28, 25, 51, 0.33)
(2, 29, 26, 51, 0.33)
(2, 30, 27, 51, 0.33)
(3, 23, 19, 50, 0.33)
(3, 24, 20, 50, 0.33)
(3, 25, 21, 50, 0.33)
(3, 26, 22, 50, 0.33)
(3, 27, 23, 50, 0.33)
(3, 28, 24, 50, 0.33)
(3, 29, 25, 50, 0.33)
(3, 30, 26, 50, 0.33)
(4, 23, 18, 49, 0.33)
(4, 24, 19, 49, 0.33)
(4, 25, 20, 49, 0.33)
(4, 26, 21, 49, 0.33)
(4, 27, 22, 49, 0.33)
(4, 28, 23, 49, 0.33)
(4, 29, 24, 49, 0.33)
(4, 30, 25, 49, 0.33)
(5, 23, 17, 48, 0.33)
(5, 24, 18, 48, 0.33)
(5, 25, 19, 48, 0.33)
(5, 26, 20, 48, 0.33)
(5, 27, 21, 48, 0.33)
(5, 28, 22, 48, 0.33)
(5, 29, 23, 48, 0.33)
(5, 30, 24, 48, 0.33)
(6, 23, 16, 47, 0.33)
(6, 24, 17, 47, 0.33)
(6, 25, 18, 47, 0.33)
(6, 26, 19, 47, 0.33)
(6, 27, 20, 47, 0.33)
(6, 28, 21, 47, 0.33)
(6, 29, 22, 47, 0.33)
(6, 30, 23, 47, 0.33)
(7, 23, 15, 46, 0.33)
(7, 24, 16, 46, 0.33)
(7, 25, 17, 46, 0.33)
(7, 26, 18, 46, 0.33)
(7, 27, 19, 46, 0.33)
(7, 28, 20, 46, 0.33)
(7, 29, 21, 46, 0.33)
(7, 30, 22, 46, 0.33)
(8, 23, 14, 45, 0.33)
(8, 24, 15, 45, 0.33)
(8, 25, 16, 45, 0.33)
(8, 26, 17, 45, 0.33)
(8, 27, 18, 45, 0.33)
(8, 28, 19, 45, 0.33)
(8, 29, 20, 45, 0.33)
(8, 30, 21, 45, 0.33)
(9, 23, 13, 44, 0.33)
(9, 24, 14, 44, 0.33)
(9, 25, 15, 44, 0.33)
(9, 26, 16, 44, 0.33)
(9, 27, 17, 44, 0.33)
(9, 28, 18, 44, 0.33)
(9, 29, 19, 44, 0.33)
(9, 30, 20, 44, 0.33)
(10, 23, 12, 43, 0.33)
(10, 24, 13, 43, 0.33)
(10, 25, 14, 43, 0.33)
(10, 26, 15, 43, 0.33)
(10, 27, 16, 43, 0.33)
(10, 28, 17, 43, 0.33)
(10, 29, 18, 43, 0.33)
(10, 30, 19, 43, 0.33)
(11, 23, 11, 42, 0.33)
(11, 24, 12, 42, 0.33)
(11, 25, 13, 42, 0.33)
(11, 26, 14, 42, 0.33)
(11, 27, 15, 42, 0.33)
(11, 28, 16, 42, 0.33)
(11, 29, 17, 42, 0.33)
(11, 30, 18, 42, 0.33)
(12, 23, 10, 41, 0.33)
(12, 24, 11, 41, 0.33)
(12, 25, 12, 41, 0.33)
(12, 26, 13, 41, 0.33)
(12, 27, 14, 41, 0.33)
(12, 28, 15, 41, 0.33)
(12, 29, 16, 41, 0.33)
(12, 30, 17, 41, 0.33)
(13, 23, 9, 40, 0.33)
(13, 24, 10, 40, 0.33)
(13, 25, 11, 40, 0.33)
(13, 26, 12, 40, 0.33)
(13, 27, 13, 40, 0.33)
(13, 28, 14, 40, 0.33)
(13, 29, 15, 40, 0.33)
(13, 30, 16, 40, 0.33)
(14, 23, 8, 39, 0.33)
(14, 24, 9, 39, 0.33)
(14, 25, 10, 39, 0.33)
(14, 26, 11, 39, 0.33)
(14, 27, 12, 39, 0.33)
(14, 28, 13, 39, 0.33)
(14, 29, 14, 39, 0.33)
(14, 30, 15, 39, 0.33)
(1, 34, 32, 52, 0.5)
(2, 34, 31, 51, 0.5)
(3, 34, 30, 50, 0.5)
(4, 34, 29, 49, 0.5)
(5, 34, 28, 48, 0.5)
(6, 34, 27, 47, 0.5)
(7, 34, 26, 46, 0.5)
(8, 34, 25, 45, 0.5)
(9, 34, 24, 44, 0.5)
(10, 34, 23, 43, 0.5)
(11, 34, 22, 42, 0.5)
(12, 34, 21, 41, 0.5)
(13, 34, 20, 40, 0.5)
(14, 34, 19, 39, 0.5)
(15, 34, 18, 38, 0.5)
(16, 34, 17, 37, 0.5)
(17, 34, 16, 36, 0.5)
(18, 34, 15, 35, 0.5)
(19, 34, 14, 34, 0.5)
(20, 34, 13, 33, 0.5)
(21, 34, 12, 32, 0.5)
243
%% Cell type:code id:5a1398fa tags:
``` python
```
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment