/ interactive_tutorials / hardening_softening
Sign in
interactive_tutorials / hardening_softening
hardening_softening / app / phase-presets.js
36 lines · 1.9 KBBlameHistoryRaw
1// Presets for the phase-space slide: conservative and damped springs, then
2// the driven presets of the previous slide (their x0 is not used here, since
3// the orbits start from a set of displacements; see js/orbits.js). Values are
4// in the sliders' physical units (see driven-presets.js).
6import { DRIVEN_PRESETS } from './driven-presets.js';
8const strip = ({ x0, ...rest }) => rest;
9const free = (freq, alpha, delta) => ({ freq, alpha, delta, F: 0, drive: 220 });
11// the lab's starting settings: a double well, undamped, driven at 490 Hz
12export const PHASE_DEFAULT = { freq: -220, alpha: 2e7, delta: 0, F: 5.6e4, drive: 490 };
14export const PHASE_PRESETS = [
15 { name: 'Double well, undamped drive', params: PHASE_DEFAULT },
16 // closed curves of constant energy
17 { group: 'Conservative', name: 'Linear spring', params: free(220, 0, 0) },
18 { group: 'Conservative', name: 'Hardening spring', params: free(220, 3e7, 0) },
19 // barrier at sqrt((2 pi 220)^2 / 3e7) = 0.25: orbits from farther out escape
20 { group: 'Conservative', name: 'Softening spring', params: free(220, -3e7, 0) },
21 // wells at +/-0.31: orbits within one well, and around both
22 { group: 'Conservative', name: 'Double well', params: free(-220, 2e7, 0) },
23 // delta = 60: the swing shrinks by e in 1/30 s, about 7 turns of the spiral
24 { group: 'Damped', name: 'Hardening spring', params: free(220, 3e7, 60) },
25 // which well each start ends up in
26 { group: 'Damped', name: 'Double well', params: free(-220, 2e7, 60) },
27 // the driven presets, without x0; the hardening pair's two presets differ
28 // only in x0, so one is enough here (both steady swings appear)
29 ...DRIVEN_PRESETS
30 .filter((pr) => pr.name !== 'Two steady states: large')
31 .map((pr) => ({
32 group: `Driven: ${(pr.group ?? 'default').toLowerCase()}`,
33 name: pr.name === 'Two steady states: small' ? 'Two steady states' : pr.name,
34 params: strip(pr.params),
35 })),
36];
↑↓ move↵openescclose