-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.html
390 lines (343 loc) · 12.4 KB
/
index.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
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:svg="http://www.w3.org/2000/svg"
xml:lang="en">
<head>
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<meta http-equiv='cache-control' content='no-cache'>
<title>Electric Field</title>
<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<link rel="stylesheet" href="//ajax.googleapis.com/ajax/libs/jqueryui/1.11.2/themes/smoothness/jquery-ui.css" />
<script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.11.2/jquery-ui.min.js"></script>
<!-- firebug lite, for debugging on random browswers. -->
<!-- <script type='text/javascript'
src='http://getfirebug.com/releases/lite/1.2/firebug-lite-compressed.js'></script> -->
<script type="text/javascript" charset="utf-8">
if (window['loadFirebugConsole']) {
window.loadFirebugConsole();
} else {
if (!window['console']) window.console = {};
if (!window.console['time'] ) window.console.time = function(){};
if (!window.console['timeEnd'] ) window.console.timeEnd = function(){};
if (!window.console['debug'] ) window.console.debug = function(){};
if (!window.console['info'] ) window.console.info = function(){};
if (!window.console['log'] ) window.console.log = function(){};
if (!window.console['warn'] ) window.console.warn = function(){};
if (!window.console['profile'] ) window.console.profile = function(){};
if (!window.console['profileEnd']) window.console.profileEnd = function(){};
if (!window.console['trace'] ) window.console.trace = function(){};
if (!window.console['error'] ) window.console.error = function(){};
}
</script>
<script type="text/javascript" src="script.js"></script>
<script type="text/javascript">
$(function(){
$("#do-popup").click(function(){
$('#PopupWindow').css('display','block');
return false;
})
$(window).click(function(){
$('#PopupWindow').css('display','none');
})
});
</script>
<style type="text/css">
div#sim{
/* width:800px ; height: 600px; align: center;border: 1*/
position: absolute;
left: 0px;
top: 0px;
cursor: default;
overflow: hidden;
width: 100%;
height: 100vh;
/* margin-bottom: 100px;*/
z-index: 1;
}
div#controls
{
position: fixed;
bottom: 0;
margin:10px;
border: 1px solid;
z-index: 3;
overflow-x:none;
pointer-events:none;
-moz-user-select: none; -webkit-user-select: none; -ms-user-select:none; user-select:none;
background-color: white;
}
input, button, label, select {
pointer-events:all;
}
.bttn {
pointer-events:all;
}
div#controls a {
pointer-events:all;
}
div#totalenergy
{
position: fixed;
bottom: 0;
right: 0;
margin:10px;
z-index: 2;
pointer-events:none;
color: orange;
}
div#debug
{
display:none;
position: fixed;
top: 0;
left: 0;
margin:10px;
z-index: 2;
pointer-events:none;
color: orange;
}
.bttn {
background-color: gray;
color: white;
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
border-radius: 5px;
border: 1px solid black;
padding: 3px;
display:inline-block;
width:160px;
text-align: center;
}
.bttn:hover {
background-color: darkgreen;
}
div#controls .addcharge {
pointer-events:all;
}
.round-button {
width:25px;
display:inline-block;
vertical-align: text-top;}
.round-button.big {
width:40px;
display:inline-block;
vertical-align: text-top;
}
.round-button-circle {
margin-top: 10px;
width: 25px;
height:0;
padding-bottom: 100%;
border-radius: 50%;
border:1px solid black;
overflow:hidden;
background: red;
box-shadow: 0 0 3px gray;
}
.round-button-circle.big {
margin-top: 2.5px;
width: 40px;
}
.round-button-circle:hover {
background:darkred;
}
.round-button-circle.neg {
background: blue;
box-shadow: 0 0 3px gray;
}
.round-button-circle.neg:hover {
background:darkblue;
}
.round-button span {
display:block;
float:left;
width:100%;
padding-top:50%;
padding-bottom:50%;
line-height:1em;
margin-top:-0.5em;
text-align:center;
color:#e2eaf3;
font-family:Verdana;
font-size:1.0em;
text-decoration:none;
}
#PopupWindow {
display: none;
position: absolute;
width: 80%; height: 80%;
left: 10%; top: 30px;
/* margin: -155px 0 0 -300px;*/
border: solid 3px blue;
background-color: #ffffff;
overflow-y:scroll;
z-index:10;
box-shadow: 20px 20px 30px gray;
}
</style>
</head>
<body>
<div id="everything">
<!-- The main viewing area is a canvas. -->
<div>
<div class="notpad" id="sim" ></div>
</div>
<!-- controls -->
<div class="controls" id="controls">
<div style="display:inline-block">
<div class="round-button"><div class="round-button-circle"><span q="1" class="btn addcharge" href="#">+1</span></div></div>
<div class="round-button big"><div class="round-button-circle big"><span q="2" class="btn addcharge" href="#">+2</span></div></div>
<div class="round-button"><div class="round-button-circle neg"><span q="-1" class="btn addcharge" href="#">-1</span></div></div>
<div class="round-button big"><div class="round-button-circle neg big"><span q="-2" class="btn addcharge" href="#">-2</span></div></div>
<br/>Drag these charges in.
<br/>Drag out of window to remove.
</div>
<div style="display:inline-block">
<div style="margin:5px"><span class="bttn" id="ctl-zoom-in">Zoom In</span></div>
<div style="margin:5px"><span class="bttn" id="ctl-zoom-out">Zoom Out</span></div>
<div style="margin:5px"><label><input type ="checkbox" id="ctl-do-eqipotential" />Show Equipotential Lines</label></div>
</div>
<div style="display:inline-block; vertical-align: top;">
<div style="margin:5px"><a class="bttn" id="do-popup" href="#">More Help</a></div>
<div style="margin:5px"><a class="bttn" id="downloadlink" href='#' download="FieldLines.png">Download Image</a></div>
<div style="margin:5px"><a class="bttn" id="linktothis" href='#'>Link to this arrangement</a></div>
</div>
<div style="display:inline-block; vertical-align: top; width:100px; margin-top: 5px;">
Lines per unit charge: <span id='lines_per_unit_charge'>10</span><br/>
<div id='lines_slider' style="margin: 5px; pointer-events:all; "></div>
</div>
<div style="display:inline-block; vertical-align: top; width:100px; margin-top: 5px;">
EstMode: <select id="estMode">
<option value="1"> Euler </option>
<option value="4" selected="selected"> RK4 </option>
</select>
</div>
<div style="display:inline-block; vertical-align: top; margin-top: 5px;">
<b>Electric Field Lines</b><br/>
by
<a href="http://faculty.otterbein.edu/NTagg">Nathaniel Tagg</a><br/>
<a href="http://www.otterbein.edu/public/Academics/Departments/Physics.aspx">Otterbein University Physics</a><br/>
</div>
<div style="display:inline-block">
<a href="http://www.otterbein.edu/public/Academics/Departments/Physics.aspx"><img style="height:50px" src="Otterbein.png" /></a>
</div>
<!-- Help and info -->
<div id="debug"></div>
</div> <!-- controls box -->
<div id="totalenergy"></div>
<div id="PopupWindow">
<div style="display:inline-block">
<h3>Electric Field Lines</h3>
Applet by <br/>
<a href="http://faculty.otterbein.edu/NTagg">Nathaniel Tagg</a><br/>
<a href="http://www.otterbein.edu/public/Academics/Departments/Physics.aspx">Otterbein University Physics</a><br/>
</div>
<div style="display:inline-block">
<a href="http://www.otterbein.edu/public/Academics/Departments/Physics.aspx"><img style="height:50px" src="Otterbein.png" /></a>
</div>
<h2>
Instructions:
</h2>
<ul>
<li> Click a charge and drag it to a new position to see the electric field lines move. </li>
<li> Drag a charge outside the window to remove it from the view. </li>
<li> Click the charge buttons to add new charges to the window. </li>
<li> Total electrostatic energy of this charge configuration is shown in the lower right. Negative energies
represent bound states; postive energies represent unstable (explosive) states.</li>
</ul>
<h2>
About electric field lines:
</h2>
<p>
Electric field lines are one way of representing the electric field. The field is a vector field, so every point
in space has both a <b>magnitude</b> and a <b>direction</b>. To get a feel for the direction of the field, look
at the direction of the field lines near that point. To get a feel for the magnitude of the field, look to see how
many field lines go through that region.
</p>
<p>
This applet does not get the field line density (number of lines in an area) exactly correct, but you
should be able to get a feel for things. Try moving charges around a bit to see how the lines move.
</p>
<h2>
For instructors:
</h2>
<ul>
<li> You can create custom arrangements by moving the charges where you like, and then right-clicking the "link to this arrangement" button. Select "Copy this URL" and distribute to students or save for your own use. </li>
<li> Here's a useful example: <br/>
<a href="?q1=-1,-1,-0.3
&q2=-1,-1,-0.15
&q3=-1,-1,0
&q4=-1,-1,0.15
&q5=-1,-1,0.3
&q6=1,1,-0.15
&q7=1,1,-0.3
&q8=1,1,0
&q9=1,1,0.15
&q10=1,1,0.3
&q11=-1,-1,-0.45
&q12=-1,-1,-0.6
&q14=-1,-1,0.45
&q15=-1,-1,0.6
&q16=1,1,-0.45
&q17=1,1,-0.6
&q19=1,1,0.45
&q20=1,1,0.6">
Charged plates</a><br/>
</li>
<li> If you want precise positioning, the URL format is <br/>
<span style="font-family:courier">index.html?q1=[charge1],[x1],[y1]&q2=[charge2],[x2],[y2]&....</span><br/>
where charge1 is the size of the first charge, x1 and y1 are the coordinates. (0,0) is the center of the screen.</li>
<li> Add "&lines=10" to set the number of lines per unit charge to 10.</li>
<li> Add "&hide1=1" to hide the labels on the charges (which is useful for online quizzes)</li>
</ul>
</p>
<h3>
Suggested activity: (AP physics or college physics):
</h3>
<p>
<a href="fieldline_activity.pdf">(PDF)</a>
<a href="fieldline_activity.docx">(Word)</a>
<a href="fieldline_activity.pages.zip">(Pages)</a>
</p>
Students are given some charge configurations and attempt to draw the field lines on their own. Once they have
completed an attempt, they look at this simulation. Then they are directed correct their work based on what the simulation shows.
</p>
<p>
This activity is surprisingly challenging, even for students who understand electric fields mathematically, and improves
their appreciation for electrostatics as being about more than just Coulomb's law.
</p>
<h2>
About the simulation:
</h2>
<p>
Interestingly, drawing field lines is not closed-form soluable. This applet works by a 'shooting' approximation.
</p>
<p>
The first charge is generated with a set of field lines coming out with equal spacing. This lines are then traced
along the direction of the field until the line either connects to another charge or gets very far out of the simulation
box.
</p>
<p>
However, this creates connecting lines to some of the other charges, using up some of the 'nodes' that should
be radiating from that charge. The simulation attempts to fast and dirty work to try to even out the remaining
lines. Generally speaking, however, it is NOT possible to have lines radiating outward at equal angles from all charges
when the charges have finite size.
</p>
<p>
This simulation could probably be improved by iterating on the field lines, and backtracking foward and back between
charges to try to even out the spacing, but this would make the simulation non-responsive.
</p>
<p>
Another problem occurs when a field line is shot out straight at another charge. These lines are valid field lines,
but diverge almost randomly at the midpoint between charges. For instance, see this
<a href="index.html?q0=1,-1,1&q1=1,0.966785290628707,1.0260972716488732">example</a>.
</p>
<p>
Source code is available for forking at <a href="https://github.com/nathanieltagg/fieldlines">https://github.com/nathanieltagg/fieldlines</a>
</p>
<p>
Nathaniel Tagg, Dec 2014
</p>
</div>
</body>