Commit 83930f69 authored by Weng's avatar Weng
Browse files

Upload New File

parent e5b6ca32
%% 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.
%% 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))
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
293
%% Cell type:markdown id:25e91ad8 tags:
Discrete version $(\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))
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
218
%% Cell type:code id:c2cd69c9 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