-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdial-keypad-time.html
164 lines (145 loc) · 6.71 KB
/
dial-keypad-time.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Phone Dialing Time Derivation</title>
<script type="text/javascript" src="https://polyfill.io/v3/polyfill.min.js?features=es6"></script>
<script type="text/javascript" id="MathJax-script" async
src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script>
</head>
<body>
<h1>Problem Formulation</h1>
<p>
We aim to derive the relationship that governs the time taken to dial a phone number based on the arrangement of numbers on a phone keypad. The user is assumed to be right-handed and follows a sequential dialing pattern without pauses. Key considerations include:
<ul>
<li>Key layout on the phone (standard 3x4 numeric keypad, where 1 is at the top left, 0 at the bottom middle)</li>
<li>The distance moved by the finger between each digit</li>
<li>The time per movement, which is influenced by the distance and speed</li>
</ul>
We will explore these parameters to express the total dialing time for a phone number.
</p>
<h2>Variables and Assumptions</h2>
<ul>
<li>\( N \): Number of digits in the phone number (e.g., 10 for a standard number)</li>
<li>\( D_{i, i+1} \): Distance moved by the finger from digit \( i \) to \( i+1 \)</li>
<li>\( v \): Average speed of finger movement between keys (assume consistent speed)</li>
<li>\( t_{\text{press}} \): Time taken to press a single key</li>
<li>\( T \): Total time taken to dial the phone number</li>
</ul>
<h3>Phone Keypad Layout and Distance Calculation</h3>
<p>
A standard phone keypad layout has keys arranged as follows:
</p>
<pre>
1 2 3
4 5 6
7 8 9
* 0 #
</pre>
<p>
Each key has a unique coordinate on this grid. For example, the digit 1 is at position \( (0,0) \), 2 at \( (0,1) \), and so on.
We define the coordinates of each digit \( i \) as \( (x_i, y_i) \).
</p>
<p>**Distance Between Digits**</p>
<p>
The Euclidean distance between two consecutive digits \( i \) and \( i+1 \) is given by:
\[
D_{i, i+1} = \sqrt{(x_{i+1} - x_i)^2 + (y_{i+1} - y_i)^2}
\]
</p>
<h2>Total Dialing Time Calculation</h2>
<p>The total dialing time \( T \) consists of two parts:</p>
<ul>
<li>The time to move between each consecutive pair of digits, based on the distance and speed \( v \).</li>
<li>The time spent pressing each digit, assumed to be \( t_{\text{press}} \) for each key press.</li>
</ul>
<p>Thus, the total dialing time \( T \) is:</p>
<p>
\[
T = (N \cdot t_{\text{press}}) + \sum_{i=1}^{N-1} \frac{D_{i, i+1}}{v}
\]
</p>
where:
<ul>
<li>\( N \): Total number of digits in the phone number</li>
<li>\( D_{i, i+1} \): Distance between consecutive digits \( i \) and \( i+1 \)</li>
<li>\( v \): Finger movement speed</li>
<li>\( t_{\text{press}} \): Time to press each key</li>
</ul>
<h3>Example Calculation</h3>
<p>
Let's assume:
<ul>
<li>A phone number with 10 digits</li>
<li>Average finger movement speed \( v = 0.5 \) meters per second</li>
<li>Press time \( t_{\text{press}} = 0.2 \) seconds</li>
<li>Sample phone number: 1234567890, with coordinates:
<ul>
<li>1: (0,0), 2: (0,1), 3: (0,2)</li>
<li>4: (1,0), 5: (1,1), 6: (1,2)</li>
<li>7: (2,0), 8: (2,1), 9: (2,2)</li>
<li>0: (3,1)</li>
</ul>
</li>
</ul>
</p>
<h3>Sample Calculation for Total Dialing Time</h3>
<p>Using the phone number <code>1234567890</code> and the Euclidean distance formula, we calculate each \( D_{i, i+1} \) and sum them.</p>
<h4>Steps:</h4>
<ol>
<li>\( D_{1,2} = \sqrt{(0 - 0)^2 + (1 - 0)^2} = 1 \) unit</li>
<li>\( D_{2,3} = \sqrt{(0 - 0)^2 + (2 - 1)^2} = 1 \) unit</li>
<li>\( D_{3,4} = \sqrt{(1 - 0)^2 + (0 - 2)^2} = \sqrt{5} \approx 2.24 \) units</li>
<li>Continue calculating for all pairs.</li>
</ol>
<p>Assuming each unit distance is approximately 0.05 meters:</p>
<p>
\[
T \approx (10 \cdot 0.2) + \sum_{i=1}^{9} \frac{D_{i, i+1} \times 0.05}{0.5}
\]
</p>
<h3>Graphical Representation of Dialing Time vs. Number Length</h3>
<canvas id="dialingGraph" width="800" height="400"></canvas>
<script>
const canvas = document.getElementById('dialingGraph');
const ctx = canvas.getContext('2d');
// Constants for simulation
const t_press = 0.2; // Time to press each digit in seconds
const v = 0.5; // Finger movement speed in m/s
const unitDistance = 0.05; // Assume each key-to-key distance unit is 0.05 meters
// Sample distances between digits in a random phone number, in "distance units"
const distances = [1, 1, 2.24, 1, 1, 2.24, 1, 1, 2.24]; // Based on phone number 1234567890
// Calculate total dialing time
let dialingTimes = [];
for (let N = 1; N <= 15; N++) { // Simulate dialing times for numbers of length 1 to 15
let totalDistance = distances.slice(0, N-1).reduce((a, b) => a + b, 0) * unitDistance;
let T = N * t_press + totalDistance / v;
dialingTimes.push(T);
}
// Draw graph
function drawGraph(dialingTimes) {
ctx.clearRect(0, 0, canvas.width, canvas.height);
ctx.beginPath();
ctx.moveTo(50, 350);
ctx.lineTo(750, 350);
ctx.moveTo(50, 350);
ctx.lineTo(50, 50);
ctx.stroke();
ctx.strokeStyle = "blue";
ctx.beginPath();
dialingTimes.forEach((T, i) => {
const x = 50 + i * (700 / dialingTimes.length);
const y = 350 - (T / Math.max(...dialingTimes)) * 300;
ctx.lineTo(x, y);
});
ctx.stroke();
ctx.fillStyle = "black";
ctx.fillText("Dialing Time (seconds)", 400, 30);
ctx.fillText("Number Length (digits)", 350, 370);
}
drawGraph(dialingTimes);
</script>
<p>The graph shows how dialing time increases as the number length grows, primarily due to the increased number of presses and distance traveled between digits.</p>
</body>
</html>