1// Presets for the driven Duffing slide, each showing a different phenomenon,
2// grouped for the dropdown. Values are in the sliders' physical units: x0
3// (fraction of rest length), freq = f0 in Hz (negative for k < 0), alpha in
4// s^-2, delta in s^-1, F in s^-2, drive = Omega / 2 pi in Hz.
5//
6// They were chosen from parameter sweeps with the app's integrator, keeping
7// only behavior that does not depend on details: each gives the same kind of
8// motion for several step sizes, including the audio's (one sample), so the
9// animation and the sound agree. The chaotic ones are chaotic (positive
10// Lyapunov exponent) from every starting point x0 in 0..0.5. Where a preset's
11// behavior depends on x0 (two steady states, the subharmonic), its own x0 was
12// checked at each step size. The ranges of x quoted are after the transient.
13// Finally each was run through the app's own code paths (the audio worklet
14// and the animation's stepping), which agree. A double-well pair (in one
15// well / across both) was left out: its two motions coexist only next to
16// chaotic regions, and the sound and animation landed on different ones.
17export const DRIVEN_PRESETS = [
18 {
19 name: 'Default',
20 params: { x0: 0, freq: 220, alpha: 3e7, delta: 0, F: 5e4, drive: 220 },
21 },
22 {
23 // driven 10 Hz above f0 from rest, undamped: the free and driven motions
24 // (220 and 230 Hz, equally strong) beat at 10 Hz, x within +/-0.11
25 group: 'Linear spring',
26 name: 'Beats',
27 params: { x0: 0, freq: 220, alpha: 0, delta: 0, F: 1e4, drive: 230 },
28 },
29 {
30 // driven at f0: the swing builds up to F / (delta Omega) = 0.36
31 group: 'Linear spring',
32 name: 'Resonance',
33 params: { x0: 0, freq: 220, alpha: 0, delta: 20, F: 1e4, drive: 220 },
34 },
35 {
36 // the hardening spring bends the resonance to the right, so at 450 Hz two
37 // steady swings coexist: +/-0.03 from x0 up to 0.3, +/-0.55 from x0 of 0.4
38 // or more. delta = 20 settles them in about 0.1 s (10 s animated).
39 group: 'Hardening spring',
40 name: 'Two steady states: small',
41 params: { x0: 0, freq: 220, alpha: 3e7, delta: 20, F: 20e4, drive: 450 },
42 },
43 {
44 group: 'Hardening spring',
45 name: 'Two steady states: large',
46 params: { x0: 0.4, freq: 220, alpha: 3e7, delta: 20, F: 20e4, drive: 450 },
47 },
48 {
49 // from x0 = 0.3 (or 0.35) the block swings at a third of the drive:
50 // 333 Hz, +/-0.33, with the 1000 Hz drive 46 dB weaker; from x0 below
51 // 0.25 it only quivers at the drive frequency
52 group: 'Hardening spring',
53 name: 'Subharmonic (⅓ of the drive)',
54 params: { x0: 0.3, freq: 220, alpha: 3e7, delta: 5, F: 30e4, drive: 1000 },
55 },
56 {
57 // driven below f0, where the softening resonance bends to: the swing grows
58 // over the barrier (at 0.31) from every x0 in 0..0.5, in about 0.02 s
59 // (from some negative x0, which this slide cannot set, it stays bounded)
60 group: 'Softening spring',
61 name: 'Escape from the well',
62 params: { x0: 0, freq: 220, alpha: -2e7, delta: 10, F: 4e4, drive: 190 },
63 },
64 {
65 // k < 0 with wells at +/-0.31 (alpha = 2e7). Driven near the resonance
66 // within a well (about 280 Hz), the block swings in the right-hand well,
67 // x from 0.16 to 0.41 (0.25 peak to peak), never crossing
68 group: 'Double well (k < 0)',
69 name: 'Swinging in one well',
70 params: { x0: 0.2, freq: -220, alpha: 2e7, delta: 10, F: 3e4, drive: 280 },
71 },
72 {
73 // hopping irregularly between the wells (x < 0 about half the time, a
74 // broadband spectrum); chaotic from every x0 in 0..0.5, Lyapunov exponent
75 // about 0.6 per drive period
76 group: 'Double well (k < 0)',
77 name: 'Chaos: hopping between wells',
78 params: { x0: 0.3, freq: -220, alpha: 2e7, delta: 10, F: 12.5e4, drive: 295 },
79 },
80 {
81 // no linear stiffness (Ueda's oscillator, x'' + k x' + x^3 = B cos t, here
82 // driven at 60 Hz). Raising F: period 1 (F = 11e4; a lopsided swing,
83 // -0.32 to 0.50), period 2 (13.5e4; a 150 Hz line, an odd multiple of
84 // 30 Hz), chaos (20e4; x within +/-0.64, Lyapunov exponent about 0.7),
85 // each from every x0 in 0..0.5
86 group: 'No linear stiffness (f₀ = 0)',
87 name: 'Period 1',
88 params: { x0: 0, freq: 0, alpha: 0.4e7, delta: 19, F: 11e4, drive: 60 },
89 },
90 {
91 group: 'No linear stiffness (f₀ = 0)',
92 name: 'Period doubling',
93 params: { x0: 0, freq: 0, alpha: 0.4e7, delta: 19, F: 13.5e4, drive: 60 },
94 },
95 {
96 group: 'No linear stiffness (f₀ = 0)',
97 name: 'Chaos in a single well',
98 params: { x0: 0, freq: 0, alpha: 0.4e7, delta: 19, F: 20e4, drive: 60 },
99 },
100];