/ interactive_tutorials / hamiltonian_systems
Sign in
interactive_tutorials / hamiltonian_systems
Layout refinements for phase space pages and run buttons
- Phase space pages are single centered columns with controls below the axes - Start/stop buttons sit in the top-right corner of each diagram - Sliders grouped into aligned fieldsets Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Jeremy Magland <jmagland@flatironinstitute.org> committed commit 27967abfdbb2 parent 51ce1cd Browse files
4 changed files+224−63
.arewehuman/recipe.md/jeremy-magland-f74a.awh.jsonlmodified+114−1View file
@@ -6515,4 +6515,117 @@
65156515 ["i",31001313,2157,1,"t"]
65166516 ["d",31002030,2157,1]
65176517 {"checkpoint":"23817fb8b5f13900f6707f2712d4ab978c5c0dc90836391c14b867233dca8f52"}
6518-{"title":"recipe","text":"# Hamiltonian Systems Interactive Tutorial\n\nThe landing page simply says \"Introduction to Hamiltonian Systems\" with an invitation to click to get started.\n\nNotes:\n- The url contains the current page, so reloading the page doesn't bring us back to the beginning\n- Have navigation buttons (next/prev) always at the top of each page, and let the arrow keys (left/right) nad home/end also control this. This is an interactive slide presentation.\n- The app is meant to be viewed on a desktop but should also be compatible with mobile devices. On desktop there should be two panels. On the left is the text, equations, etc. On the right is the interactive content, diagrams and controls. But some pages start with centered content, and only expand to two panels when the user clicks something.\n- The title of each slide should be at the top and the panels should be independently scrollable.\n- The next and prev buttons should have a single word hint of the content.\n\n## Page 1: Mass on a spring with no friction\n\nWhen user clicks, we go to the first (non title page). It shows a mass on a spring with no friction with the text Example 1: Mass on a spring with no friction. We see a representation of a mass on a spring held at a particular position. The user clicks to \"start\" and we see the motion start. The user can click to stop it as well.\n\nThis is centered at first with no labels and no equations. Users click a button \"show details\" reveal the two panels with the equations on left and the labeled diagram on the right.\n\nq - the position of the block measured from rest\nm - the mass of the block\nk - the stiffness of the spring\np = m * dq/dt - the momentum\n\nHooke's law:\nF = -k * q - the force imparted by the spring\n\nNewton's second law:\ndp/dt = F = -k * q\n\nThe rate of change in momentum is proportional to the position (opposite direction).\n\nSo we have the system relating position and momentum:\n\ndq/dt = p/m\ndp/dt = -k q\n\nAnd the various quantities should appear on the diagram.\n\nUse two columns for the equations section so that it can fit better, stacking to one on a narrower screen.\n\n## Page 2: Conserved Energy\n\nTitle: Total energy is conserved\n\nIn this page, we show the same spring diagram with a start/stop button, and we depict the kinetic/potential/total energy with bars. But we don't want people to feel dizzy. Again, we just show the unlabeled diagram at the center with the kinetic/potential/total bars with a start/stop button and a details button.\n\nThe details are.\n\nkinetic: p^2/2m and\npotential: 1/2 k * q^2\n\nThey sum up to a constant, the total energy.\n\nDepict that in the diagram and show the equations below.\n\nThe Hamiltonian is the total energy\nH = p^2/2m + 1/2 k q^2\n\nExercise: Prove H is constant by differentiating with respect to it. The user clicks to reveal the solution.\n\n\n## Page 3: Hamilton's Equations\n\nWe write\n\nH = p^2/2m + 1/2 k q^2\n\nAnd in general, Hamilton's equations are:\n\ndq/dt = \\partial H/\\partial p\ndp/dt = -partial H/\\partial q\n\nwhich in this case yields our equations of motion\n\ndq/dt = \\partial H/\\partial p = p/m\ndp/dt = -\\partial H/\\partial q = -kq\n\n## Page 4: Phase space trajectories\n\nOn this page, we will show the trajectory through phase space. We will ahve the diagram again at the top, but this time with only p and q and k labeled, together with initial position q_0. Then below that we will have an axes with q horizontal and p vertical and the q should line up.\n\nThen user can adjust the initial position, k, and m.\n\nKeep the axes fixed. Leave a trail and draw the level curve. The starting position should be a slider that lines up with the q.\n\n## Page 5: Pendulum with no friction\n\nSimilarly, we will have a diagram at the top with a swinging pendulum. The bob will be on a massless rod at an initial position and again a \"Let Go\" button. And then a button to reveal the equations of motion and labels on the diagram.\n\nIn this case\n\nL - rod length\nm - mass of bob\ng - gravitational acceleration\n\nq = \\theta - angular position\np = m L^2 d\\theta/dt - angular momentum\n\nThe Hamiltonian in this case is\n\nH = p^2/(2 m L^2) - m g L cos \\theta (kinetic plus gravitational potential)\n\nThe Hamiltonian system is then:\n\nd\\theta/dt = p/(mL^2)\ndp/dt = -m g L sin \\theta\n\nExercise: Apply Hamilton's equations to H to derive this system\n\n## Page 6: Pendulum phase space\n\nAgain, the pendulum diagram is at the top. Below that we have an axes for q and p. And the user can control the parameters in the same way. But we should also have an initial momentum. And there should be a dropdown that has presets to show the different types of phenomena.\n\n- small swings\n- large swings\n- almost to the top\n- rotation\n- balanced at the top\n- at rest","textSha256":"be05185901dc84cfcbf6ceac8222ef62b3f20493c54ace2f9d3fb21bc1b8996f","seal":"a3f4879db350b7e07356a2acc86241e4e4bf5bbb8482cb058e4e0247142fef04"}
6518+["s",31395034]
6519+{"checkpoint":"1e2e2813439fadc96307a436f9a0c6e9aebfba59bb5950ec0f80dde3f26847ba"}
6520+["d",31706911,3213,4]
6521+["i",31706911,3213,1,"t"]
6522+["i",31706977,3214,1,"t"]
6523+["i",31707057,3215,1,"t"]
6524+["i",31707177,3216,1,"t"]
6525+{"checkpoint":"814d291f47f7b4ad841b4997d0ed8dcb6280b64e9535f88bd954ccec7d58556a"}
6526+["i",31784053,3480,1,"t"]
6527+["i",31784452,3481,1,"t"]
6528+["i",31785416,3482,1,"t"]
6529+["i",31785506,3483,1,"t"]
6530+["i",31785586,3484,1,"t"]
6531+["i",31785773,3485,1,"t"]
6532+["i",31785962,3486,1,"t"]
6533+["i",31786239,3487,1,"t"]
6534+["i",31786339,3488,1,"t"]
6535+["i",31786415,3489,1,"t"]
6536+["i",31786643,3490,1,"t"]
6537+["i",31786846,3491,1,"t"]
6538+["i",31786985,3492,1,"t"]
6539+["i",31787193,3493,1,"t"]
6540+["i",31787288,3494,1,"t"]
6541+{"checkpoint":"bed832971178d66df3cd0d8433519339295c17f30d042a96b1fd2035dd1034a6"}
6542+["i",31793480,3495,1,"t"]
6543+["i",31793625,3496,1,"t"]
6544+["i",31793715,3497,1,"t"]
6545+["i",31793902,3498,1,"t"]
6546+["i",31793971,3499,1,"t"]
6547+["i",31794119,3500,1,"t"]
6548+["i",31794223,3501,1,"t"]
6549+["i",31794294,3502,1,"t"]
6550+["i",31794561,3503,1,"t"]
6551+["i",31794697,3504,1,"t"]
6552+["i",31794824,3505,1,"t"]
6553+["i",31794952,3506,1,"t"]
6554+["i",31795123,3507,1,"t"]
6555+["i",31795195,3508,1,"t"]
6556+["i",31795347,3509,1,"t"]
6557+["i",31795744,3510,1,"t"]
6558+["i",31795916,3511,1,"t"]
6559+["i",31796078,3512,1,"t"]
6560+["i",31796360,3513,1,"t"]
6561+["i",31796501,3514,1,"t"]
6562+["i",31797464,3515,1,"t"]
6563+["i",31797652,3516,1,"t"]
6564+["i",31797723,3517,1,"t"]
6565+["i",31797829,3518,1,"t"]
6566+["i",31797917,3519,1,"t"]
6567+["i",31798227,3520,1,"t"]
6568+["i",31798499,3521,1,"t"]
6569+["i",31798755,3522,1,"t"]
6570+["i",31798809,3523,1,"t"]
6571+["i",31799364,3524,1,"t"]
6572+{"checkpoint":"305b2836599f8602675ba994c7bbe2af238591754ac1d7105a84a94394cd5edf"}
6573+["i",31802501,3503,1,"t"]
6574+["i",31802612,3504,1,"t"]
6575+["i",31802773,3505,1,"t"]
6576+["i",31803055,3506,1,"t"]
6577+{"checkpoint":"580707e69140d51d5a8e99160a7db1beabefe6bedeaebeaff6aab6c0daa06d53"}
6578+["i",31880933,4647,1,"t"]
6579+["i",31881196,4648,1,"t"]
6580+["i",31881409,4649,1,"t"]
6581+["i",31881488,4650,1,"t"]
6582+["i",31881587,4651,1,"t"]
6583+["i",31881802,4652,1,"t"]
6584+["i",31881901,4653,1,"t"]
6585+["i",31881973,4654,1,"t"]
6586+["i",31882107,4655,1,"t"]
6587+["i",31882289,4656,1,"t"]
6588+["i",31882380,4657,1,"t"]
6589+["i",31882539,4658,1,"t"]
6590+["i",31882628,4659,1,"t"]
6591+["i",31882743,4660,1,"t"]
6592+["i",31882876,4661,1,"t"]
6593+["i",31882983,4662,1,"t"]
6594+["i",31883118,4663,1,"t"]
6595+["i",31883214,4664,1,"t"]
6596+["i",31883340,4665,1,"t"]
6597+["i",31883436,4666,1,"t"]
6598+["i",31883577,4667,1,"t"]
6599+["i",31883971,4668,1,"t"]
6600+["i",31884765,4669,1,"t"]
6601+["i",31884940,4670,1,"t"]
6602+["i",31885037,4671,1,"t"]
6603+["i",31885267,4672,1,"t"]
6604+["i",31885376,4673,1,"t"]
6605+["i",31885455,4674,1,"t"]
6606+["i",31886461,4675,1,"t"]
6607+{"checkpoint":"37a0544940ec9117296e73964a46a564428994574b6926ba1fe258130ff5243a"}
6608+["i",31886758,4676,1,"t"]
6609+["i",31886886,4677,1,"t"]
6610+["i",31887115,4678,1,"t"]
6611+["i",31887226,4679,1,"t"]
6612+["i",31887331,4680,1,"t"]
6613+["i",31887498,4681,1,"t"]
6614+["i",31887583,4682,1,"t"]
6615+["i",31887677,4683,1,"t"]
6616+["i",31888331,4684,1,"t"]
6617+["i",31888802,4685,1,"t"]
6618+["i",31889381,4686,1,"t"]
6619+["i",31889435,4687,1,"t"]
6620+{"checkpoint":"61287547181ab12ccb4a76ceafc2292073563882253495dee21e162b8e4fc016"}
6621+["g",31890907,"51ce1cd86bca8892588b7b3333d42c74ca5394b3"]
6622+["d",31890907,4687,1]
6623+["d",31891006,4686,1]
6624+["i",31891120,4686,1,"t"]
6625+["i",31891348,4687,1,"t"]
6626+["i",31891407,4688,1,"t"]
6627+["i",31891859,4689,1,"t"]
6628+{"checkpoint":"6cb2d73b016834cae26599ad071cad5158d534713b44c350b735ea9bec51c7fd"}
6629+["i",32156798,961,67,"o",[66]]
6630+{"checkpoint":"d587e4494077955b828205e12035e05592a9328d5b86fa5b10a8016b76dd0089"}
6631+{"title":"recipe","text":"# Hamiltonian Systems Interactive Tutorial\n\nThe landing page simply says \"Introduction to Hamiltonian Systems\" with an invitation to click to get started.\n\nNotes:\n- The url contains the current page, so reloading the page doesn't bring us back to the beginning\n- Have navigation buttons (next/prev) always at the top of each page, and let the arrow keys (left/right) nad home/end also control this. This is an interactive slide presentation.\n- The app is meant to be viewed on a desktop but should also be compatible with mobile devices. On desktop there should be two panels. On the left is the text, equations, etc. On the right is the interactive content, diagrams and controls. But some pages start with centered content, and only expand to two panels when the user clicks something.\n- The title of each slide should be at the top and the panels should be independently scrollable.\n- The next and prev buttons should have a single word hint of the content.\n- Start/stop buttons sit in the top-right corner of their diagram.\n\n## Page 1: Mass on a spring with no friction\n\nWhen user clicks, we go to the first (non title page). It shows a mass on a spring with no friction with the text Example 1: Mass on a spring with no friction. We see a representation of a mass on a spring held at a particular position. The user clicks to \"start\" and we see the motion start. The user can click to stop it as well.\n\nThis is centered at first with no labels and no equations. Users click a button \"show details\" reveal the two panels with the equations on left and the labeled diagram on the right.\n\nq - the position of the block measured from rest\nm - the mass of the block\nk - the stiffness of the spring\np = m * dq/dt - the momentum\n\nHooke's law:\nF = -k * q - the force imparted by the spring\n\nNewton's second law:\ndp/dt = F = -k * q\n\nThe rate of change in momentum is proportional to the position (opposite direction).\n\nSo we have the system relating position and momentum:\n\ndq/dt = p/m\ndp/dt = -k q\n\nAnd the various quantities should appear on the diagram.\n\nUse two columns for the equations section so that it can fit better, stacking to one on a narrower screen.\n\n## Page 2: Conserved Energy\n\nTitle: Total energy is conserved\n\nIn this page, we show the same spring diagram with a start/stop button, and we depict the kinetic/potential/total energy with bars. But we don't want people to feel dizzy. Again, we just show the unlabeled diagram at the center with the kinetic/potential/total bars with a start/stop button and a details button.\n\nThe details are.\n\nkinetic: p^2/2m and\npotential: 1/2 k * q^2\n\nThey sum up to a constant, the total energy.\n\nDepict that in the diagram and show the equations below.\n\nThe Hamiltonian is the total energy\nH = p^2/2m + 1/2 k q^2\n\nExercise: Prove H is constant by differentiating with respect to it. The user clicks to reveal the solution.\n\n\n## Page 3: Hamilton's Equations\n\nWe write\n\nH = p^2/2m + 1/2 k q^2\n\nAnd in general, Hamilton's equations are:\n\ndq/dt = \\partial H/\\partial p\ndp/dt = -partial H/\\partial q\n\nwhich in this case yields our equations of motion\n\ndq/dt = \\partial H/\\partial p = p/m\ndp/dt = -\\partial H/\\partial q = -kq\n\n## Page 4: Phase space trajectories\n\nOn this page, we will show the trajectory through phase space. We will have the diagram again at the top, but this time with only p and q and k labeled, together with initial position q_0. Then below that we will have an axes with q horizontal and p vertical and the q should line up.\n\nThen user can adjust the initial position, k, and m. These controls should all appear below the axes.\n\nKeep the axes fixed. Leave a trail and draw the level curve. The starting position should be a slider that lines up with the q.\n\n## Page 5: Pendulum with no friction\n\nSimilarly, we will have a diagram at the top with a swinging pendulum. The bob will be on a massless rod at an initial position and again a \"Let Go\" button. And then a button to reveal the equations of motion and labels on the diagram.\n\nIn this case\n\nL - rod length\nm - mass of bob\ng - gravitational acceleration\n\nq = \\theta - angular position\np = m L^2 d\\theta/dt - angular momentum\n\nThe Hamiltonian in this case is\n\nH = p^2/(2 m L^2) - m g L cos \\theta (kinetic plus gravitational potential)\n\nThe Hamiltonian system is then:\n\nd\\theta/dt = p/(mL^2)\ndp/dt = -m g L sin \\theta\n\nExercise: Apply Hamilton's equations to H to derive this system\n\n## Page 6: Pendulum phase space\n\nAgain, the pendulum diagram is at the top. Below that we have an axes for q and p. And the user can control the parameters in the same way. But we should also have an initial momentum. And there should be a dropdown that has presets to show the different types of phenomena. The controls should all be below the axes.\n\n- small swings\n- large swings\n- almost to the top\n- rotation\n- balanced at the top\n- at rest","textSha256":"48605ae9241f9b4ddffd092424c7e779a888e0d3138816cc929e2a7b677f01f0","seal":"a762a9f967fc0e46084f8fb5cbab74ba8e29e60abbddc62aecb0d0377e440dea"}
app/index.htmlmodified+64−52View file
@@ -24,8 +24,10 @@
2424 <h2>Example 1: Mass on a spring with no friction</h2>
2525
2626 <div class="demo">
27- <canvas id="spring-canvas"></canvas>
28- <button id="spring-toggle">Start</button>
27+ <div class="stage">
28+ <canvas id="spring-canvas"></canvas>
29+ <button id="spring-toggle" class="run">Start</button>
30+ </div>
2931 <p><button id="spring-reveal" class="next ready" data-reveal="spring">Show details</button></p>
3032 </div>
3133
@@ -61,9 +63,11 @@
6163 <h2>Total energy is conserved</h2>
6264
6365 <div class="demo">
64- <canvas id="energy-canvas"></canvas>
66+ <div class="stage">
67+ <canvas id="energy-canvas"></canvas>
68+ <button id="energy-toggle" class="run">Start</button>
69+ </div>
6570 <canvas id="energy-bars" class="bars"></canvas>
66- <button id="energy-toggle">Start</button>
6771 <p><button id="energy-reveal" class="next ready" data-reveal="energy">Show details</button></p>
6872 </div>
6973
@@ -121,33 +125,35 @@
121125
122126 </section>
123127
124- <section id="phase" data-hint="Phase" class="page split">
128+ <section id="phase" data-hint="Phase" class="page">
125129 <h2>Phase space trajectories</h2>
126130
127- <div class="text">
131+ <div class="demo">
132+ <div class="stage">
133+ <canvas id="phase-canvas"></canvas>
134+ <button id="phase-toggle" class="run">Start</button>
128135 </div>
136+ <canvas id="phase-plot" class="phase"></canvas>
129137
130- <div class="demo">
131- <canvas id="phase-canvas"></canvas>
132138 <div class="q0-row">
133139 <input id="phase-q0" type="range" min="-1" max="1" step="0.01" aria-label="Initial position q0">
134140 </div>
135141 <p class="slider-caption">Initial position <span data-tex="q_0"></span> = <span id="phase-q0-value"></span></p>
136142
137- <canvas id="phase-plot" class="phase"></canvas>
138-
139- <div class="controls">
140- <label><span data-tex="k"></span>
141- <input id="phase-k" type="range" min="0.5" max="8" step="0.1">
142- <output id="phase-k-value"></output>
143- </label>
144- <label><span data-tex="m"></span>
145- <input id="phase-m" type="range" min="0.25" max="4" step="0.05">
146- <output id="phase-m-value"></output>
147- </label>
143+ <div class="control-groups single">
144+ <fieldset>
145+ <legend>Parameters</legend>
146+ <label class="row"><span data-tex="k"></span>
147+ <input id="phase-k" type="range" min="0.5" max="8" step="0.1">
148+ <output id="phase-k-value"></output>
149+ </label>
150+ <label class="row"><span data-tex="m"></span>
151+ <input id="phase-m" type="range" min="0.25" max="4" step="0.05">
152+ <output id="phase-m-value"></output>
153+ </label>
154+ </fieldset>
148155 </div>
149156
150- <button id="phase-toggle">Start</button>
151157 </div>
152158 </section>
153159
@@ -155,8 +161,10 @@
155161 <h2>Example 2: Pendulum with no friction</h2>
156162
157163 <div class="demo">
158- <canvas id="pendulum-canvas" class="pendulum"></canvas>
159- <button id="pendulum-toggle">Start</button>
164+ <div class="stage">
165+ <canvas id="pendulum-canvas" class="pendulum"></canvas>
166+ <button id="pendulum-toggle" class="run">Start</button>
167+ </div>
160168 <p><button id="pendulum-reveal" class="next ready" data-reveal="pendulum">Show details</button></p>
161169 </div>
162170
@@ -195,12 +203,16 @@
195203 </div>
196204 </section>
197205
198- <section id="pendulum-phase" data-hint="Phase" class="page split">
206+ <section id="pendulum-phase" data-hint="Phase" class="page">
199207 <h2>Pendulum phase space</h2>
200208
201- <div class="text"></div>
202-
203209 <div class="demo">
210+ <div class="stage">
211+ <canvas id="pendulum-phase-canvas" class="pendulum-centered"></canvas>
212+ <button id="pendulum-phase-toggle" class="run">Start</button>
213+ </div>
214+ <canvas id="pendulum-plot" class="phase"></canvas>
215+
204216 <p>
205217 <label class="preset">Preset
206218 <select id="pendulum-preset">
@@ -215,35 +227,35 @@
215227 </label>
216228 </p>
217229
218- <canvas id="pendulum-phase-canvas" class="pendulum-centered"></canvas>
219- <canvas id="pendulum-plot" class="phase"></canvas>
220-
221- <div class="controls">
222- <label><span data-tex="\theta_0"></span>
223- <input id="pendulum-theta0" type="range" min="-3.1416" max="3.1416" step="any">
224- <output id="pendulum-theta0-value"></output>
225- </label>
226- <label><span data-tex="p_0"></span>
227- <input id="pendulum-p0" type="range" min="-12" max="12" step="0.1">
228- <output id="pendulum-p0-value"></output>
229- </label>
230- </div>
231- <div class="controls">
232- <label><span data-tex="m"></span>
233- <input id="pendulum-m" type="range" min="0.5" max="2" step="0.05">
234- <output id="pendulum-m-value"></output>
235- </label>
236- <label><span data-tex="L"></span>
237- <input id="pendulum-L" type="range" min="0.5" max="1.5" step="0.05">
238- <output id="pendulum-L-value"></output>
239- </label>
240- <label><span data-tex="g"></span>
241- <input id="pendulum-g" type="range" min="2" max="20" step="0.1">
242- <output id="pendulum-g-value"></output>
243- </label>
230+ <div class="control-groups">
231+ <fieldset>
232+ <legend>Initial state</legend>
233+ <label class="row"><span data-tex="\theta_0"></span>
234+ <input id="pendulum-theta0" type="range" min="-3.1416" max="3.1416" step="any">
235+ <output id="pendulum-theta0-value"></output>
236+ </label>
237+ <label class="row"><span data-tex="p_0"></span>
238+ <input id="pendulum-p0" type="range" min="-12" max="12" step="0.1">
239+ <output id="pendulum-p0-value"></output>
240+ </label>
241+ </fieldset>
242+ <fieldset>
243+ <legend>Parameters</legend>
244+ <label class="row"><span data-tex="m"></span>
245+ <input id="pendulum-m" type="range" min="0.5" max="2" step="0.05">
246+ <output id="pendulum-m-value"></output>
247+ </label>
248+ <label class="row"><span data-tex="L"></span>
249+ <input id="pendulum-L" type="range" min="0.5" max="1.5" step="0.05">
250+ <output id="pendulum-L-value"></output>
251+ </label>
252+ <label class="row"><span data-tex="g"></span>
253+ <input id="pendulum-g" type="range" min="2" max="20" step="0.1">
254+ <output id="pendulum-g-value"></output>
255+ </label>
256+ </fieldset>
244257 </div>
245258
246- <button id="pendulum-phase-toggle">Start</button>
247259 </div>
248260 </section>
249261 </main>
app/style.cssmodified+42−7View file
@@ -111,6 +111,20 @@ canvas {
111111 margin: 0 0 1.5rem;
112112 }
113113
114+/* A diagram with its Start/Stop button in the top-right corner. */
115+.stage { position: relative; }
116+.stage > canvas { margin-bottom: 0; }
117+.stage + * { margin-top: 1.5rem; }
118+button.run {
119+ position: absolute;
120+ top: 0;
121+ right: 0;
122+ padding: 0.3rem 0.8rem;
123+ font-size: 0.9rem;
124+ background: var(--bg);
125+}
126+button.run:hover { background: var(--accent); }
127+
114128 canvas.bars { height: 100px; margin-top: -0.5rem; }
115129 canvas.phase { height: 260px; }
116130 canvas.pendulum { height: 260px; }
@@ -131,16 +145,37 @@ select {
131145 .q0-row input { display: block; margin: 0; }
132146 .slider-caption { margin: 0.25rem 0 1rem; font-size: 0.9rem; opacity: 0.8; }
133147
134-.controls {
135- display: flex;
136- justify-content: center;
137- flex-wrap: wrap;
138- gap: 0.5rem 2rem;
148+/* Grouped sliders: symbol, slider and value line up in columns. */
149+.control-groups {
150+ display: grid;
151+ grid-template-columns: 1fr 1fr;
152+ gap: 1rem;
139153 margin: 0 0 1.25rem;
154+ text-align: left;
155+}
156+
157+@media (max-width: 560px) {
158+ .control-groups { grid-template-columns: 1fr; }
159+}
160+
161+.control-groups.single { grid-template-columns: 1fr; max-width: 340px; margin-left: auto; margin-right: auto; }
162+
163+.control-groups fieldset {
164+ display: grid;
165+ grid-template-columns: 1.5em 1fr 3em;
166+ align-items: center;
167+ gap: 0.4rem 0.6rem;
168+ align-content: start;
169+ margin: 0;
170+ padding: 0.6rem 0.9rem 0.8rem;
171+ border: 1px solid color-mix(in srgb, var(--fg) 15%, transparent);
172+ border-radius: 8px;
140173 }
141174
142-.controls label { display: flex; align-items: center; gap: 0.5rem; }
143-.controls output { min-width: 2.5em; text-align: left; font-variant-numeric: tabular-nums; }
175+.control-groups legend { padding: 0 0.3rem; font-size: 0.85rem; opacity: 0.7; }
176+.control-groups .row { display: contents; }
177+.control-groups input { width: 100%; margin: 0; }
178+.control-groups output { text-align: right; font-variant-numeric: tabular-nums; }
144179
145180 input[type="range"] { accent-color: var(--accent); }
146181
recipe.mdmodified+4−3View file
@@ -8,6 +8,7 @@ Notes:
88 - The app is meant to be viewed on a desktop but should also be compatible with mobile devices. On desktop there should be two panels. On the left is the text, equations, etc. On the right is the interactive content, diagrams and controls. But some pages start with centered content, and only expand to two panels when the user clicks something.
99 - The title of each slide should be at the top and the panels should be independently scrollable.
1010 - The next and prev buttons should have a single word hint of the content.
11+- Start/stop buttons sit in the top-right corner of their diagram.
1112
1213 ## Page 1: Mass on a spring with no friction
1314
@@ -76,9 +77,9 @@ dp/dt = -\partial H/\partial q = -kq
7677
7778 ## Page 4: Phase space trajectories
7879
79-On this page, we will show the trajectory through phase space. We will ahve the diagram again at the top, but this time with only p and q and k labeled, together with initial position q_0. Then below that we will have an axes with q horizontal and p vertical and the q should line up.
80+On this page, we will show the trajectory through phase space. We will have the diagram again at the top, but this time with only p and q and k labeled, together with initial position q_0. Then below that we will have an axes with q horizontal and p vertical and the q should line up.
8081
81-Then user can adjust the initial position, k, and m.
82+Then user can adjust the initial position, k, and m. These controls should all appear below the axes.
8283
8384 Keep the axes fixed. Leave a trail and draw the level curve. The starting position should be a slider that lines up with the q.
8485
@@ -108,7 +109,7 @@ Exercise: Apply Hamilton's equations to H to derive this system
108109
109110 ## Page 6: Pendulum phase space
110111
111-Again, the pendulum diagram is at the top. Below that we have an axes for q and p. And the user can control the parameters in the same way. But we should also have an initial momentum. And there should be a dropdown that has presets to show the different types of phenomena.
112+Again, the pendulum diagram is at the top. Below that we have an axes for q and p. And the user can control the parameters in the same way. But we should also have an initial momentum. And there should be a dropdown that has presets to show the different types of phenomena. The controls should all be below the axes.
112113
113114 - small swings
114115 - large swings
↑↓ move↵openescclose