A Byte of PhysicsLogo

Nonlinear oscillators

Nonlinear oscillators use force functions that are not proportional to displacement. Their period can depend on amplitude, their phase-space paths need not be ellipses, and simple superposition no longer applies. The useful implementation change is local: preserve the state/integrator architecture and replace the force law with a parameterized, testable function.

Think like a programmer

Swap the force callback, not the whole solver. Store mass, linear and nonlinear coefficients, damping/drive policy, initial state, integrator/step, output times, and parameter-sweep provenance. Keep linear-limit regression fixtures, force/potential consistency where conservative, period-event definition, phase-space samples, energy/transfer ledger, and refinement results beside the trajectory. Do not infer nonlinearity from a distorted rendered spring alone.

Model checklist

Inputs
Mass, linear stiffness, cubic stiffness, damping/drive inputs, initial position/velocity, time step/integrator, output/event policy, parameter sweep, and conservative-potential convention.
State
Position, velocity, acceleration, nonlinear force terms, phase-space samples, energy/transfer ledger, period/event records, and refinement history.
Rule
Evaluate the declared force from the current state, advance position/velocity with the same integrator architecture, and derive period/phase-space/energy diagnostics at named times.
Output
Trajectory, amplitude-dependent period or asymmetry metric, force contributions, phase-space trace, energy/residual data, and linear-limit comparison.
Check
Zero cubic coefficient exactly recovers linear acceleration; reversing displacement reverses an odd restoring force; for a conservative undamped/undriven model the named energy is bounded under refinement; period events use a declared crossing direction; changing amplitude or cubic coefficient is isolated from changes in numerical step.
\[m\ddot x+c\dot x+kx+\beta x^3=F(t),\qquad U(x)=\frac12kx^2+\frac14\beta x^4\;\text{when conservative}\]

Oscillator state sampler

Change stiffness, damping, and displacement. The force is restoring; damping affects velocity once the system is moving.

Stiffness 20 N/m; damping 1; displacement 0.40 m; acceleration -8.00 m/s²; natural angular frequency 4.47 rad/s; energy 1.60 J.

A positive cubic stiffness makes the restoring force grow more rapidly at large amplitude; a negative value can soften the response over a limited stable regime. The sign and units of the coefficient matter. Measure period from a named event, such as successive positive-direction zero crossings or same-side turning points, rather than from visually chosen peaks. Compare the same event definition across amplitudes and refined step sizes.

The conservative potential is a useful cross-check only when damping and drive are absent. With drive or damping, track energy transfer through explicit power terms. Nonlinear systems can have multiple response states, jump phenomena, or sensitive parameter regions; state which initial condition and sweep direction produced a result.

Try this experiment

Prediction: A cubic stiffness term can make period vary with amplitude.

Choose a positive cubic coefficient and two initial amplitudes. Use the same crossing rule to measure period, then repeat at smaller step. Set the cubic coefficient to zero and assert that acceleration matches the linear helper. Finally add a drive or damping term and explain why the conservative energy expression alone is no longer an invariant.

Where this model breaks

Nonlinear models have more parameter sensitivity and numerical stiffness. Qualitative surprises require convergence checks before physical interpretation. A cubic spring is not a universal model of a real material; large displacement, friction, hysteresis, contact, coupled modes, parameter uncertainty, and three-dimensional deformation can require different force laws and state variables.

Summary

Keep the state update architecture and replace only the force law to explore nonlinear behavior. Verify the linear limit first, then use declared event, energy/transfer, phase-space, parameter-sweep, and fixed-time refinement diagnostics before interpreting a changed trajectory.

Glossary

Self-check

  1. What code boundary should hold the force law?
  2. What behavior can become amplitude-dependent?
  3. Which regression test is essential?
  4. Why must a period measurement define its crossing or turning event?

Sources

Model contract

Treat the lesson as a small function before treating it as a fact to memorize. Give every value a unit, keep only the state needed for the next step, and make the output easy to inspect.

\[\text{observable output} = f(\text{inputs},\,\text{state})\]
Inputs
Quantities you set or measure, with units and useful bounds.
State
Values the program must retain to reproduce the next result.
Rule
The relationship or update that turns inputs and state into a result.
Check
A known limit, unit check, invariant, or measured result that can expose a bad model.

Implement the idea as a model

For Nonlinear Oscillators, write down the quantities you can control, the values your program must retain, and the result a reader could inspect. In Oscillations, the useful program is not the drawing: it is the smallest explicit model that makes a prediction you can test.

Guided experiment

Prediction: changing one declared input while holding the others fixed should change only the outputs that the model connects to that input. Choose one input, predict the direction of change, then check a limiting case such as zero, a symmetric arrangement, or a familiar low-speed or small-change approximation.

Where this model breaks

This lesson is a teaching model, not a complete simulator. Before using it outside the stated question, check which interactions, scales, uncertainties, boundary conditions, and measurement limits it leaves out.

Summary

Treat Nonlinear Oscillators as a contract: named inputs and units enter a rule, the rule produces an observable result, and a known limit or invariant checks whether the implementation deserves trust.

Glossary

  • Input: a measured value or chosen parameter supplied to a model.
  • State: the smallest set of values needed to continue or reproduce a model.
  • Validation: comparing an output with a known result, limit, invariant, or measurement.

Self-check

  1. Which values are inputs, and which values must remain state?
  2. What observable result would tell you the model is behaving as expected?
  3. Which assumption would you test first before applying the model to a real system?

Model review: turn Nonlinear Oscillators into a test

Explore amplitude-dependent oscillator behavior by replacing a force callback while preserving solver state.

  1. Name the inputs and units that the oscillations model needs.
  2. Separate the state you must keep from values you can calculate when needed.
  3. Write one rule that maps the current state and inputs to an observable result.
  4. Choose a limiting case, unit check, invariant, or known result before trusting an output.
  5. State one assumption you would change before using this simplified model for a real decision.

Share to: