|
|
|
|
|
by drostie
4019 days ago
|
|
Very cool. There is one thing that I didn't see here which was either a bug or a clever tuning of the numeric parameters: overdamping. When solving the equation: x''(t) = -2a * x'(t) - k * x(t)
(spring force k, linear friction a), the solution is generally a sum of solutions x = C exp(w t) for some arbitrary constant C and w = w(a, k). Plugging this in produces: w^2 + 2 a w + k = 0
(w + a)^2 + k - a^2 = 0
w = -a ± sqrt(a^2 - k)
For `k > a^2`, the system is "underdamped" and you see sinusoidal oscillations, and increasing `a` will make the system relax to equilibrium faster. But for `k < a^2`, the system is "overdamped" and increasing `a` will make the system relax slower. (If you find this hard to imagine, think about what happens as `a` tends to infinity: there is so much friction that the spring just barely crawls to its final destination. Comparisons involving molasses and other high-viscosity substances might be apt.When turning the frequency all the way down, I couldn't find a point where the friction started to make the relaxation to equilibrium slower rather than faster. |
|
Edit: that being said, it looks like in the heavily damped case it takes much less than the full duration to finish. That is probably a bug.