Second-Order Non-Homogeneous ODE Solver

Non-Homogeneous ODE Solver

Non-Homogeneous ODE Solver

Solve $ay” + by’ + cy = g(t)$ using the Method of Undetermined Coefficients.

System (LHS)

ay” + by’ + cy = …

Forcing Function g(t)

Initial Conditions

Solution Components

Complementary Solution (y_h)
$$ y_h(t) = … $$
Particular Solution (y_p)
$$ y_p(t) = … $$
Total Solution y(t) with Constants
$$ y(t) = … $$

System Response

Total y(t)
Forcing g(t)
Time (t) →

Method of Undetermined Coefficients

Non-homogeneous differential equations describe systems driven by an external force, such as a motor vibrating a bridge or a voltage source in a circuit. The general solution consists of two parts: $$ y(t) = y_h(t) + y_p(t) $$

1. The Homogeneous Solution ($y_h$): This represents the system’s natural behavior (transient response). We find this by setting the right-hand side to zero and solving $ay” + by’ + cy = 0$ using the characteristic equation $ar^2 + br + c = 0$.

2. The Particular Solution ($y_p$): This represents the steady-state response driven by the forcing function $g(t)$. The Method of Undetermined Coefficients involves making an educated “guess” for the form of $y_p$ based on $g(t)$, substituting it into the ODE, and solving for the coefficients.

Common Guesses Table

  • If $g(t) = Ke^{rt}$, guess $y_p = Ae^{rt}$.
  • If $g(t) = K \sin(\omega t)$, guess $y_p = A\sin(\omega t) + B\cos(\omega t)$.
  • If $g(t) = P_n(t)$ (polynomial), guess a polynomial of degree $n$.

Warning (Resonance): If your guess contains a term that is already part of the homogeneous solution $y_h$, you must multiply your guess by $t$ (or $t^2$) until it is unique. This tool handles this automatically!

FAQ

Why does the solver modify my guess with ‘t’?
This happens when the forcing frequency matches the system’s natural frequency (Resonance). Mathematically, the assumed form is already a solution to the homogeneous equation (resulting in 0), so it cannot equal the non-zero $g(t)$. Multiplying by $t$ creates a linearly independent function.
Can this solve for g(t) = tan(t)?
No. The Method of Undetermined Coefficients only works for specific functions (polynomials, exponentials, sines, cosines). For functions like $\tan(t)$ or $\ln(t)$, you would need the Variation of Parameters method, which involves integration rather than algebra.

UNDERGRADUATE