Split View: 공업수학 완전 정복 1편: 상미분방정식(ODE) - 기초부터 라플라스 변환까지
공업수학 완전 정복 1편: 상미분방정식(ODE) - 기초부터 라플라스 변환까지
공업수학 완전 정복 1편: 상미분방정식(ODE)
공학도라면 피해갈 수 없는 과목이 바로 공업수학입니다. 특히 상미분방정식(ODE, Ordinary Differential Equation)은 전자회로 분석, 제어 시스템 설계, 기계 진동 해석 등 거의 모든 공학 분야의 수학적 기반이 됩니다. 이 글에서는 ODE의 기초 개념부터 라플라스 변환까지, 공학 응용 예제를 중심으로 체계적으로 설명합니다.
1. 미분방정식 기초
미분방정식이란?
미분방정식은 미지함수와 그 도함수들 사이의 관계를 나타내는 방정식입니다. 예를 들어:
이처럼 미분방정식은 자연 현상과 공학 시스템을 수학적으로 모델링하는 핵심 도구입니다.
분류: ODE vs PDE
상미분방정식(ODE): 하나의 독립변수에 대한 도함수만 포함합니다.
편미분방정식(PDE): 두 개 이상의 독립변수에 대한 편미분을 포함합니다.
이번 글에서는 ODE에 집중합니다.
차수(Order)와 급(Degree)
차수는 방정식에 등장하는 가장 높은 도함수의 차수입니다.
- 1차 ODE: (최고 도함수가 )
- 2차 ODE: (최고 도함수가 )
**급(degree)**은 최고 차수 도함수의 지수입니다. 대부분의 공학 문제에서 급은 1입니다.
선형 vs 비선형
선형 ODE: 미지함수와 그 도함수가 1차 항으로만 나타납니다.
비선형 ODE: , , 등 비선형 항이 포함됩니다.
일반해, 특수해, 특이해
- 일반해: 임의의 상수를 포함하는 완전한 해
- 특수해: 초기조건을 적용하여 상수를 결정한 해
- 특이해: 일반해로부터 얻을 수 없는 특별한 해
공학에서 ODE의 등장
공학 시스템은 대부분 ODE로 기술됩니다.
RC 충전 회로:
스프링-질량-감쇠기 시스템:
인구 성장 모델:
RL 회로:
이 모든 방정식이 ODE이며, 풀이 방법을 배우면 공학 시스템의 동적 거동을 완전히 분석할 수 있습니다.
2. 1차 상미분방정식
2.1 변수분리법 (Separation of Variables)
형태:
풀이 과정:
양변을 적분합니다:
예제: RC 충전 회로
회로 방정식:
변수분리:
적분:
초기조건 적용:
이 결과는 RC 회로의 **과도 응답(transient response)**을 나타냅니다. 시정수 로 결정되는 속도로 전압이 로 수렴합니다.
물리적 의미:
- 일 때: (63.2% 충전)
- 일 때: (거의 완전 충전)
2.2 적분인자법 (Integrating Factor Method)
선형 1차 ODE의 표준형:
적분인자:
유도 과정:
양변에 를 곱합니다:
좌변은 곱의 미분 규칙에 의해:
적분하면:
예제: RL 회로
표준형으로 변환:
적분인자:
적분:
초기조건 적용:
시정수 로 전류가 정상 상태 에 수렴합니다.
2.3 완전 미분방정식 (Exact ODE)
형태:
완전 조건:
이 조건을 만족하면 인 퍼텐셜 함수 가 존재합니다.
풀이법:
- 에서 를 에 대해 적분
- 조건으로 적분 상수 결정
- 일반해:
예제:
완전 여부 확인:
완전 방정식이므로:
이므로 ,
일반해:
2.4 베르누이 방정식 (Bernoulli Equation)
형태:
치환: 으로 놓으면 선형 ODE로 변환됩니다.
이므로 원래 방정식을 으로 나누면:
이는 에 대한 선형 1차 ODE로, 적분인자법으로 풀 수 있습니다.
응용: 물류 성장 모델 는 인 베르누이 방정식입니다.
3. 2차 선형 상미분방정식
3.1 제차 방정식 (Homogeneous)
표준형:
특성방정식 유도: 를 대입합니다.
판별식 의 부호에 따라 세 가지 경우가 생깁니다.
경우 1: 서로 다른 두 실근 ()
이면:
경우 2: 중복 실근 ()
이면:
를 추가해야 하는 이유는 **론스키안(Wronskian)**이 0이 되지 않도록 독립적인 두 번째 해를 구성해야 하기 때문입니다.
경우 3: 켤레 복소근 ()
(단, , )이면:
오일러 공식 를 이용해 실수해로 변환한 형태입니다.
3.2 RLC 회로 완전 분석
회로 방정식 (전하 기준):
표준형으로 정리:
특성방정식:
감쇠 계수 , 공진 주파수 로 정의하면:
과감쇠 (Overdamped): ()
두 지수항의 합으로, 진동 없이 단조 감소합니다.
임계감쇠 (Critically Damped): ()
진동 없이 가장 빠르게 평형 상태로 복귀합니다. 제어 시스템 설계에서 매우 중요합니다.
부족감쇠 (Underdamped): ()
감쇠 진동 주파수 로 정의하면:
진동하면서 감쇠합니다. 통신 회로, 진동 시스템에서 흔히 나타납니다.
물리적 의미 요약:
| 조건 | 명칭 | 응답 특성 |
|---|---|---|
| 과감쇠 | 진동 없이 느리게 감쇠 | |
| 임계감쇠 | 진동 없이 가장 빠른 감쇠 | |
| 부족감쇠 | 진동하며 감쇠 | |
| 무감쇠 | 지속 진동 |
3.3 비제차 방정식 (Non-homogeneous)
형태:
완전 해:
- : 제차 방정식의 일반해 (여함수, complementary function)
- : 특수해 (particular solution)
미결정계수법 (Method of Undetermined Coefficients)
의 형태에 따라 의 형태를 추측합니다.
| 의 형태 | 의 추측 형태 |
|---|---|
| 또는 | |
주의: 의 형태가 의 항과 겹치면 를 곱해서 수정합니다.
예제:
제차해:
의 추측형이 와 겹치므로 수정:
대입 후 계산하면: ,
이는 공진(resonance) 현상으로, 진폭이 시간에 비례하여 증가합니다.
강제 진동 응답:
정상 상태 특수해:
여기서 진동수비 , 감쇠비 .
(공진 조건)에서 진폭이 최대가 됩니다.
매개변수 변환법 (Variation of Parameters)
미결정계수법을 적용할 수 없는 일반적인 에 사용합니다.
가 주어질 때:
론스키안(Wronskian):
이 공식은 모든 연속 함수 에 대해 적용 가능합니다.
4. 연립 미분방정식
4.1 행렬 표현
개의 1차 ODE로 이루어진 연립 방정식:
여기서 , 는 계수 행렬.
4.2 고유값/고유벡터 풀이
해의 형태:
대입하면:
즉, 는 의 고유값, 는 대응하는 고유벡터입니다.
특성방정식:
예제: 두 개의 연결된 탱크 시스템
특성방정식:
고유벡터: ,
일반해:
4.3 회로망 해석 적용
두 루프가 있는 회로 (키르히호프 전압 법칙):
여기서 은 상호 인덕턴스. 이를 행렬 형태로 정리하여 고유값법 또는 라플라스 변환으로 풀 수 있습니다.
5. 라플라스 변환 (Laplace Transform)
5.1 정의와 수렴
정의:
는 복소 변수이며, 적분이 수렴하려면 (수렴 좌평면)를 만족해야 합니다.
왜 라플라스 변환을 쓰는가?
- 미분 연산이 대수 연산으로 변환됩니다
- 초기조건을 자동으로 처리합니다
- 복잡한 ODE를 쉬운 대수 방정식으로 풀 수 있습니다
- 전달 함수(Transfer Function) 개념의 기반입니다
5.2 주요 변환쌍
| (단위 계단) | |
| (임펄스) | |
| (지연 계단) |
유도 예시:
일 때 수렴합니다.
5.3 주요 성질
선형성:
시간 이동 (제1 이동 정리):
주파수 이동 (제2 이동 정리):
미분 변환 (가장 중요한 성질):
초기조건이 -도메인에서 자동으로 포함됩니다.
적분 변환:
합성곱 정리(Convolution Theorem):
여기서
이 정리는 시스템의 임펄스 응답과 입력 신호의 합성곱이 출력임을 수학적으로 증명합니다.
최종값 정리:
정상 상태 값을 -도메인 풀이 없이 구할 수 있습니다.
초기값 정리:
5.4 역 라플라스 변환
부분 분수 분해(Partial Fraction Decomposition):
에서 분모를 인수분해하여 표 변환쌍의 합으로 분해합니다.
경우 1: 서로 다른 실수 극점
경우 2: 중복 극점 (가 중근)
경우 3: 켤레 복소 극점
헤비사이드 전개 정리(Heaviside Expansion):
분모가 서로 다른 1차 인수의 곱일 때:
5.5 라플라스 변환으로 ODE 풀기
예제: RLC 직렬 회로 과도 응답
초기조건: ,
풀이:
양변에 라플라스 변환 적용:
초기조건 대입:
잠깐, 초기조건 수정: , (캐패시터에 전하 없음)이면 임펄스 입력으로 인해:
, , (부족감쇠 경우)로 정의하면:
역 라플라스 변환 (표에서 ):
이것이 RLC 회로의 임펄스 응답이며, 동시에 그린 함수이기도 합니다.
6. Python으로 ODE 수치 풀기
6.1 scipy.integrate.solve_ivp 활용
import numpy as np
from scipy.integrate import solve_ivp
import matplotlib.pyplot as plt
# RLC 회로 시뮬레이션 (2차 ODE -> 연립 1차 ODE)
# L * q'' + R * q' + q/C = Vs (계단 입력)
# 상태 변수: y[0] = q (전하), y[1] = i = dq/dt (전류)
def rlc_circuit(t, y, R, L, C, Vs):
q, dq_dt = y
# q'' = (Vs - R*i - q/C) / L
d2q_dt2 = (Vs - R * dq_dt - q / C) / L
return [dq_dt, d2q_dt2]
# 회로 파라미터
R = 100 # 저항 (Ohm)
L = 0.1 # 인덕턴스 (H)
C = 1e-6 # 캐패시턴스 (F)
Vs = 10.0 # 전원 전압 (V)
# 공진 주파수와 감쇠비 계산
omega_0 = 1.0 / np.sqrt(L * C)
alpha = R / (2 * L)
zeta = alpha / omega_0
print(f"공진 주파수: {omega_0/(2*np.pi):.1f} Hz")
print(f"감쇠비 zeta: {zeta:.3f}")
if zeta > 1:
print("-> 과감쇠")
elif zeta == 1:
print("-> 임계감쇠")
else:
print("-> 부족감쇠")
# 수치 풀이
y0 = [0.0, 0.0] # 초기조건: q(0) = 0, i(0) = 0
t_span = (0, 0.01)
t_eval = np.linspace(0, 0.01, 2000)
sol = solve_ivp(
rlc_circuit, t_span, y0,
t_eval=t_eval,
args=(R, L, C, Vs),
method='RK45',
rtol=1e-8,
atol=1e-10
)
# 전압 계산: v_C = q/C
v_C = sol.y[0] / C
i = sol.y[1]
# 시각화
fig, axes = plt.subplots(2, 1, figsize=(10, 8))
axes[0].plot(sol.t * 1e3, v_C, 'b-', linewidth=2, label='커패시터 전압')
axes[0].axhline(y=Vs, color='r', linestyle='--', label=f'정상 상태 {Vs}V')
axes[0].set_xlabel('시간 (ms)')
axes[0].set_ylabel('전압 (V)')
axes[0].set_title('RLC 직렬 회로 - 계단 응답')
axes[0].legend()
axes[0].grid(True, alpha=0.3)
axes[1].plot(sol.t * 1e3, i * 1e3, 'g-', linewidth=2, label='전류')
axes[1].set_xlabel('시간 (ms)')
axes[1].set_ylabel('전류 (mA)')
axes[1].set_title('RLC 회로 전류')
axes[1].legend()
axes[1].grid(True, alpha=0.3)
plt.tight_layout()
plt.savefig('rlc_response.png', dpi=150)
plt.show()
6.2 sympy로 해석해 구하기
import sympy as sp
# 기호 정의
t, s = sp.symbols('t s')
R_sym, L_sym, C_sym = sp.symbols('R L C', positive=True)
Vs_sym = sp.Symbol('Vs')
# RC 회로 해석해 (sympy로 미분방정식 풀기)
v = sp.Function('v')
tau = sp.Symbol('tau', positive=True)
# dv/dt = (Vs - v) / (R*C)
ode = sp.Eq(v(t).diff(t), (Vs_sym - v(t)) / (R_sym * C_sym))
# 초기조건 v(0) = 0
solution = sp.dsolve(ode, v(t), ics={v(0): 0})
print("RC 회로 해:")
print(solution)
sp.pprint(solution)
# 라플라스 변환 계산
f = sp.exp(-t) * sp.sin(2*t)
F = sp.laplace_transform(f, t, s, noconds=True)
print(f"\nL{{e^(-t) sin(2t)}} = {F}")
# 역 라플라스 변환
F_inv = sp.inverse_laplace_transform(
1 / (s**2 + 2*s + 5), s, t
)
print(f"L^(-1){{1/(s^2+2s+5)}} = {F_inv}")
6.3 다양한 적분기 비교
import numpy as np
import matplotlib.pyplot as plt
# 오일러법 vs RK4 비교
# 예제: y' = -y, y(0) = 1, 정확해 y = e^(-t)
def f(t, y):
return -y
def euler_method(f, t0, y0, h, n):
t = np.zeros(n+1)
y = np.zeros(n+1)
t[0], y[0] = t0, y0
for i in range(n):
y[i+1] = y[i] + h * f(t[i], y[i])
t[i+1] = t[i] + h
return t, y
def rk4_method(f, t0, y0, h, n):
t = np.zeros(n+1)
y = np.zeros(n+1)
t[0], y[0] = t0, y0
for i in range(n):
k1 = h * f(t[i], y[i])
k2 = h * f(t[i] + h/2, y[i] + k1/2)
k3 = h * f(t[i] + h/2, y[i] + k2/2)
k4 = h * f(t[i] + h, y[i] + k3)
y[i+1] = y[i] + (k1 + 2*k2 + 2*k3 + k4) / 6
t[i+1] = t[i] + h
return t, y
h = 0.5
n = 10
t0, y0 = 0.0, 1.0
t_euler, y_euler = euler_method(f, t0, y0, h, n)
t_rk4, y_rk4 = rk4_method(f, t0, y0, h, n)
t_exact = np.linspace(0, n*h, 200)
y_exact = np.exp(-t_exact)
plt.figure(figsize=(10, 5))
plt.plot(t_exact, y_exact, 'k-', linewidth=2, label='정확해')
plt.plot(t_euler, y_euler, 'r--o', label=f'오일러법 (h={h})')
plt.plot(t_rk4, y_rk4, 'b--s', label=f'RK4 (h={h})')
plt.xlabel('t')
plt.ylabel("y(t)")
plt.title("오일러법 vs RK4 비교: y' = -y")
plt.legend()
plt.grid(True, alpha=0.3)
plt.tight_layout()
plt.show()
# 오차 비교
print(f"t=5에서 오일러법 오차: {abs(y_euler[-1] - np.exp(-5)):.6f}")
print(f"t=5에서 RK4 오차: {abs(y_rk4[-1] - np.exp(-5)):.6f}")
6.4 라플라스 변환을 Python으로 자동화
import sympy as sp
s, t = sp.symbols('s t', real=True)
a, omega = sp.symbols('a omega', positive=True)
# 라플라스 변환 표 자동 생성
functions = {
'1': sp.Integer(1),
't': t,
't^2': t**2,
't^n': t**3,
'e^(at)': sp.exp(a*t),
'sin(wt)': sp.sin(omega*t),
'cos(wt)': sp.cos(omega*t),
't*e^(at)': t * sp.exp(a*t),
'e^(at)*sin(wt)': sp.exp(a*t) * sp.sin(omega*t),
}
print("라플라스 변환표:")
print("-" * 50)
for name, func in functions.items():
F = sp.laplace_transform(func, t, s, noconds=True)
print(f"L{{{name}}} = {sp.simplify(F)}")
7. 공학 응용 종합 예제
7.1 전원이 있는 RLC 회로 과도 분석
문제: , , 인 직렬 RLC 회로에 에서 DC 전원이 연결된다. 초기조건은 , 이다.
라플라스 변환으로 풀기:
키르히호프 전압 법칙:
로 치환하여 전하 로 정리:
라플라스 변환:
수치 대입: ,
이므로 부족감쇠입니다.
부분 분수 분해 후 역 라플라스 변환:
7.2 스프링-질량-감쇠기 공진 분석
문제: , , ,
고유 진동수:
감쇠비: (부족감쇠)
정상 상태 응답 진폭:
(공진)일 때:
공진 없을 때 정적 처짐 의 2.5배입니다. 이것이 공진의 위험성입니다.
정리 및 다음 단계
이번 글에서 다룬 내용:
- 미분방정식 기초: 분류, 차수, 선형성, 해의 종류
- 1차 ODE 풀이법: 변수분리법, 적분인자법, 완전 ODE, 베르누이 방정식
- 2차 선형 ODE: 특성방정식, 세 가지 경우, RLC 회로 완전 분석
- 비제차 방정식: 미결정계수법, 매개변수 변환법, 강제 진동
- 연립 ODE: 행렬 표현, 고유값/고유벡터 풀이
- 라플라스 변환: 정의, 변환쌍, 성질, 역변환, ODE 풀이
- Python 구현: scipy, sympy로 수치/기호 풀이
다음 편에서는 **푸리에 급수/변환과 편미분방정식(PDE)**을 다룰 예정입니다. 신호처리와 전자기학의 핵심 수학 도구입니다.
참고 자료
- Kreyszig, E. "Advanced Engineering Mathematics", 10th Edition, Wiley
- Boyce, W. & DiPrima, R. "Elementary Differential Equations", 11th Edition, Wiley
- Simmons, G. "Differential Equations with Applications and Historical Notes", 3rd Edition
- SciPy ODE 솔버 공식 문서
- SymPy 라플라스 변환 문서
Engineering Mathematics 1: Ordinary Differential Equations & Laplace Transform - Complete Guide
Engineering Mathematics 1: Ordinary Differential Equations (ODE)
Engineering mathematics is an unavoidable subject for any engineering student. In particular, Ordinary Differential Equations (ODEs) form the mathematical foundation of virtually every engineering discipline — from circuit analysis and control system design to mechanical vibration analysis. This article systematically explains ODEs from the basics to Laplace transforms, centered on engineering application examples.
1. Fundamentals of Differential Equations
What is a Differential Equation?
A differential equation is an equation that expresses a relationship between an unknown function and its derivatives. For example:
Differential equations are a core tool for mathematically modeling natural phenomena and engineering systems.
Classification: ODE vs PDE
Ordinary Differential Equation (ODE): Contains derivatives with respect to only one independent variable.
Partial Differential Equation (PDE): Contains partial derivatives with respect to two or more independent variables.
This article focuses on ODEs.
Order and Degree
The order is the highest derivative appearing in the equation.
- First-order ODE: (highest derivative is )
- Second-order ODE: (highest derivative is )
The degree is the exponent of the highest-order derivative. In most engineering problems, the degree is 1.
Linear vs Nonlinear
Linear ODE: The unknown function and its derivatives appear only as first-degree terms.
Nonlinear ODE: Contains nonlinear terms such as , , , etc.
General Solution, Particular Solution, Singular Solution
- General solution: A complete solution containing arbitrary constants
- Particular solution: A solution obtained by applying initial conditions to determine the constants
- Singular solution: A special solution that cannot be obtained from the general solution
ODEs in Engineering
Most engineering systems are described by ODEs.
RC charging circuit:
Spring-mass-damper system:
Population growth model:
RL circuit:
All of these are ODEs. Learning how to solve them allows you to fully analyze the dynamic behavior of engineering systems.
2. First-Order Ordinary Differential Equations
2.1 Separation of Variables
Form:
Solution procedure:
Integrate both sides:
Example: RC Charging Circuit
Circuit equation:
Separation of variables:
Integration:
Applying initial condition :
This result represents the transient response of an RC circuit. The voltage converges to at a rate determined by the time constant .
Physical interpretation:
- At : (63.2% charged)
- At : (almost fully charged)
2.2 Integrating Factor Method
Standard form of a first-order linear ODE:
Integrating factor:
Derivation:
Multiply both sides by :
The left side, by the product rule:
Integrating:
Example: RL Circuit
Converting to standard form:
Integrating factor:
Integrating:
Applying initial condition :
The current converges to steady state with time constant .
2.3 Exact ODEs
Form:
Exactness condition:
When this condition is satisfied, there exists a potential function such that .
Solution procedure:
- Integrate with respect to to find
- Use the condition to determine the integration constant
- General solution:
Example:
Checking exactness:
Since it is exact:
Since , we have ,
General solution:
2.4 Bernoulli Equation
Form:
Substitution: Setting transforms this into a linear ODE.
Since , dividing the original equation by :
This is a first-order linear ODE in , solvable by the integrating factor method.
Application: The logistic growth model is a Bernoulli equation with .
3. Second-Order Linear Ordinary Differential Equations
3.1 Homogeneous Equations
Standard form:
Characteristic equation derivation: Substitute .
Three cases arise depending on the sign of the discriminant .
Case 1: Two distinct real roots ()
For :
Case 2: Repeated real root ()
For :
The term must be added so that the Wronskian is nonzero, constructing an independent second solution.
Case 3: Complex conjugate roots ()
For (where , ):
This form is converted to real solutions using Euler's formula .
3.2 Complete Analysis of RLC Circuits
Circuit equation (in terms of charge ):
In standard form:
Characteristic equation:
Defining the damping coefficient and resonant frequency :
Overdamped: ()
A sum of two exponential terms — decays monotonically without oscillation.
Critically Damped: ()
Returns to equilibrium most rapidly without oscillation. Very important in control system design.
Underdamped: ()
Defining the damped oscillation frequency :
Oscillates while decaying. Commonly seen in communication circuits and vibration systems.
Summary of physical interpretation:
| Condition | Name | Response Characteristics |
|---|---|---|
| Overdamped | Slow decay without oscillation | |
| Critically damped | Fastest decay without oscillation | |
| Underdamped | Oscillates and decays | |
| Undamped | Continuous oscillation |
3.3 Non-homogeneous Equations
Form:
Complete solution:
- : General solution of the homogeneous equation (complementary function)
- : Particular solution
Method of Undetermined Coefficients
Guess the form of based on the form of .
| Form of | Guessed form of |
|---|---|
| or | |
Note: If the guessed form of overlaps with a term in , multiply by .
Example:
Homogeneous solution:
Since the guessed form of overlaps with , modify:
After substitution: ,
This is resonance, where the amplitude increases proportionally with time.
Forced vibration response:
Steady-state particular solution:
Where frequency ratio and damping ratio .
The amplitude is maximum at (resonance condition).
Variation of Parameters
Used for general where the method of undetermined coefficients cannot be applied.
Given :
Wronskian:
This formula applies to any continuous function .
4. Systems of Differential Equations
4.1 Matrix Representation
A system of first-order ODEs:
Where and is an coefficient matrix.
4.2 Eigenvalue/Eigenvector Solution
Form of solution:
Substituting:
So is an eigenvalue of , and is the corresponding eigenvector.
Characteristic equation:
Example: Two connected tanks system
Characteristic equation:
Eigenvectors: ,
General solution:
4.3 Application to Circuit Network Analysis
Circuit with two loops (Kirchhoff's voltage law):
Where is the mutual inductance. This can be written in matrix form and solved using the eigenvalue method or Laplace transform.
5. Laplace Transform
5.1 Definition and Convergence
Definition:
is a complex variable. For convergence, (half-plane of convergence) must be satisfied.
Why use the Laplace transform?
- Differential operations are converted to algebraic operations
- Initial conditions are automatically incorporated
- Complex ODEs can be solved as simple algebraic equations
- It forms the basis of the transfer function concept
5.2 Key Transform Pairs
| (unit step) | |
| (impulse) | |
| (delayed step) |
Derivation example:
Converges when .
5.3 Key Properties
Linearity:
Time shift (First shifting theorem):
Frequency shift (Second shifting theorem):
Differentiation transform (most important property):
Initial conditions are automatically included in the s-domain.
Integration transform:
Convolution theorem:
Where
This theorem mathematically proves that the output of a system is the convolution of the impulse response and the input signal.
Final value theorem:
Allows determination of the steady-state value without solving in the t-domain.
Initial value theorem:
5.4 Inverse Laplace Transform
Partial Fraction Decomposition:
For , factor the denominator and decompose into a sum of table transform pairs.
Case 1: Distinct real poles
Case 2: Repeated poles ( is an -fold root)
Case 3: Complex conjugate poles
Heaviside Expansion Theorem:
When the denominator is a product of distinct linear factors:
5.5 Solving ODEs with the Laplace Transform
Example: RLC Series Circuit Transient Response
Initial conditions: , (no charge on capacitor)
Solution:
Applying the Laplace transform to both sides:
Defining , , (underdamped case):
Inverse Laplace transform (from table: ):
This is the impulse response of the RLC circuit, which is also its Green's function.
6. Numerical ODE Solutions with Python
6.1 Using scipy.integrate.solve_ivp
import numpy as np
from scipy.integrate import solve_ivp
import matplotlib.pyplot as plt
# RLC circuit simulation (2nd order ODE -> system of 1st order ODEs)
# L * q'' + R * q' + q/C = Vs (step input)
# State variables: y[0] = q (charge), y[1] = i = dq/dt (current)
def rlc_circuit(t, y, R, L, C, Vs):
q, dq_dt = y
# q'' = (Vs - R*i - q/C) / L
d2q_dt2 = (Vs - R * dq_dt - q / C) / L
return [dq_dt, d2q_dt2]
# Circuit parameters
R = 100 # Resistance (Ohm)
L = 0.1 # Inductance (H)
C = 1e-6 # Capacitance (F)
Vs = 10.0 # Supply voltage (V)
# Calculate resonant frequency and damping ratio
omega_0 = 1.0 / np.sqrt(L * C)
alpha = R / (2 * L)
zeta = alpha / omega_0
print(f"Resonant frequency: {omega_0/(2*np.pi):.1f} Hz")
print(f"Damping ratio zeta: {zeta:.3f}")
if zeta > 1:
print("-> Overdamped")
elif zeta == 1:
print("-> Critically damped")
else:
print("-> Underdamped")
# Numerical solution
y0 = [0.0, 0.0] # Initial conditions: q(0) = 0, i(0) = 0
t_span = (0, 0.01)
t_eval = np.linspace(0, 0.01, 2000)
sol = solve_ivp(
rlc_circuit, t_span, y0,
t_eval=t_eval,
args=(R, L, C, Vs),
method='RK45',
rtol=1e-8,
atol=1e-10
)
# Voltage calculation: v_C = q/C
v_C = sol.y[0] / C
i = sol.y[1]
# Visualization
fig, axes = plt.subplots(2, 1, figsize=(10, 8))
axes[0].plot(sol.t * 1e3, v_C, 'b-', linewidth=2, label='Capacitor voltage')
axes[0].axhline(y=Vs, color='r', linestyle='--', label=f'Steady state {Vs}V')
axes[0].set_xlabel('Time (ms)')
axes[0].set_ylabel('Voltage (V)')
axes[0].set_title('RLC Series Circuit - Step Response')
axes[0].legend()
axes[0].grid(True, alpha=0.3)
axes[1].plot(sol.t * 1e3, i * 1e3, 'g-', linewidth=2, label='Current')
axes[1].set_xlabel('Time (ms)')
axes[1].set_ylabel('Current (mA)')
axes[1].set_title('RLC Circuit Current')
axes[1].legend()
axes[1].grid(True, alpha=0.3)
plt.tight_layout()
plt.savefig('rlc_response.png', dpi=150)
plt.show()
6.2 Analytical Solutions with SymPy
import sympy as sp
# Symbol definitions
t, s = sp.symbols('t s')
R_sym, L_sym, C_sym = sp.symbols('R L C', positive=True)
Vs_sym = sp.Symbol('Vs')
# RC circuit analytical solution (solving ODE with sympy)
v = sp.Function('v')
tau = sp.Symbol('tau', positive=True)
# dv/dt = (Vs - v) / (R*C)
ode = sp.Eq(v(t).diff(t), (Vs_sym - v(t)) / (R_sym * C_sym))
# Initial condition v(0) = 0
solution = sp.dsolve(ode, v(t), ics={v(0): 0})
print("RC circuit solution:")
print(solution)
sp.pprint(solution)
# Laplace transform calculation
f = sp.exp(-t) * sp.sin(2*t)
F = sp.laplace_transform(f, t, s, noconds=True)
print(f"\nL{{e^(-t) sin(2t)}} = {F}")
# Inverse Laplace transform
F_inv = sp.inverse_laplace_transform(
1 / (s**2 + 2*s + 5), s, t
)
print(f"L^(-1){{1/(s^2+2s+5)}} = {F_inv}")
6.3 Comparing Different Integrators
import numpy as np
import matplotlib.pyplot as plt
# Euler method vs RK4 comparison
# Example: y' = -y, y(0) = 1, exact solution y = e^(-t)
def f(t, y):
return -y
def euler_method(f, t0, y0, h, n):
t = np.zeros(n+1)
y = np.zeros(n+1)
t[0], y[0] = t0, y0
for i in range(n):
y[i+1] = y[i] + h * f(t[i], y[i])
t[i+1] = t[i] + h
return t, y
def rk4_method(f, t0, y0, h, n):
t = np.zeros(n+1)
y = np.zeros(n+1)
t[0], y[0] = t0, y0
for i in range(n):
k1 = h * f(t[i], y[i])
k2 = h * f(t[i] + h/2, y[i] + k1/2)
k3 = h * f(t[i] + h/2, y[i] + k2/2)
k4 = h * f(t[i] + h, y[i] + k3)
y[i+1] = y[i] + (k1 + 2*k2 + 2*k3 + k4) / 6
t[i+1] = t[i] + h
return t, y
h = 0.5
n = 10
t0, y0 = 0.0, 1.0
t_euler, y_euler = euler_method(f, t0, y0, h, n)
t_rk4, y_rk4 = rk4_method(f, t0, y0, h, n)
t_exact = np.linspace(0, n*h, 200)
y_exact = np.exp(-t_exact)
plt.figure(figsize=(10, 5))
plt.plot(t_exact, y_exact, 'k-', linewidth=2, label='Exact solution')
plt.plot(t_euler, y_euler, 'r--o', label=f'Euler method (h={h})')
plt.plot(t_rk4, y_rk4, 'b--s', label=f'RK4 (h={h})')
plt.xlabel('t')
plt.ylabel("y(t)")
plt.title("Euler vs RK4 Comparison: y' = -y")
plt.legend()
plt.grid(True, alpha=0.3)
plt.tight_layout()
plt.show()
# Error comparison
print(f"Euler method error at t=5: {abs(y_euler[-1] - np.exp(-5)):.6f}")
print(f"RK4 error at t=5: {abs(y_rk4[-1] - np.exp(-5)):.6f}")
6.4 Automating Laplace Transforms with Python
import sympy as sp
s, t = sp.symbols('s t', real=True)
a, omega = sp.symbols('a omega', positive=True)
# Auto-generate Laplace transform table
functions = {
'1': sp.Integer(1),
't': t,
't^2': t**2,
't^n': t**3,
'e^(at)': sp.exp(a*t),
'sin(wt)': sp.sin(omega*t),
'cos(wt)': sp.cos(omega*t),
't*e^(at)': t * sp.exp(a*t),
'e^(at)*sin(wt)': sp.exp(a*t) * sp.sin(omega*t),
}
print("Laplace Transform Table:")
print("-" * 50)
for name, func in functions.items():
F = sp.laplace_transform(func, t, s, noconds=True)
print(f"L{{{name}}} = {sp.simplify(F)}")
7. Comprehensive Engineering Application Examples
7.1 Transient Analysis of RLC Circuit with Power Source
Problem: A series RLC circuit with , , is connected to a DC source at . Initial conditions are , .
Solving with the Laplace Transform:
Kirchhoff's voltage law:
Substituting and writing in terms of charge :
Laplace transform:
Substituting values: ,
Since , this is underdamped.
After partial fraction decomposition and inverse Laplace transform:
7.2 Resonance Analysis of Spring-Mass-Damper System
Problem: , , ,
Natural frequency:
Damping ratio: (underdamped)
Steady-state response amplitude:
At (resonance):
This is 2.5 times the static deflection without resonance. This is the danger of resonance.
Summary and Next Steps
Topics covered in this article:
- Differential equation basics: Classification, order, linearity, types of solutions
- First-order ODE methods: Separation of variables, integrating factor, exact ODE, Bernoulli equation
- Second-order linear ODE: Characteristic equation, three cases, complete RLC circuit analysis
- Non-homogeneous equations: Undetermined coefficients, variation of parameters, forced vibration
- Systems of ODEs: Matrix representation, eigenvalue/eigenvector solution
- Laplace transform: Definition, transform pairs, properties, inverse transform, ODE solving
- Python implementation: Numerical and symbolic solutions with scipy and sympy
The next article will cover Fourier series/transform and partial differential equations (PDEs) — the core mathematical tools for signal processing and electromagnetics.
References
- Kreyszig, E. "Advanced Engineering Mathematics", 10th Edition, Wiley
- Boyce, W. & DiPrima, R. "Elementary Differential Equations", 11th Edition, Wiley
- Simmons, G. "Differential Equations with Applications and Historical Notes", 3rd Edition
- SciPy ODE Solver Documentation
- SymPy Laplace Transform Documentation
Quiz
Q1. What is the integrating factor method used for, and what is the integrating factor for dy/dx + P(x)y = Q(x)?
Answer: The integrating factor method is used to solve first-order linear ODEs of the standard form dy/dx + P(x)y = Q(x). The integrating factor is mu(x) = exp(integral of P(x) dx).
Explanation: Multiplying both sides by mu(x) transforms the left side into the derivative of mu(x)*y, allowing direct integration. This is a systematic technique applicable to any first-order linear ODE.
Q2. In the RLC series circuit, what are the three damping cases and their conditions?
Answer: The three cases depend on the damping coefficient alpha = R/(2L) and resonant frequency omega_0 = 1/sqrt(LC):
- Overdamped: alpha greater than omega_0, i.e., R greater than 2*sqrt(L/C) — slow decay without oscillation
- Critically damped: alpha equals omega_0, i.e., R equals 2*sqrt(L/C) — fastest decay without oscillation
- Underdamped: alpha less than omega_0, i.e., R less than 2*sqrt(L/C) — oscillates and decays
Explanation: The characteristic equation r^2 + (R/L)r + 1/(LC) = 0 has roots r = -alpha plus/minus sqrt(alpha^2 - omega_0^2). The sign of the discriminant determines whether roots are real or complex.
Q3. What is the convolution theorem in the Laplace transform and why is it important?
Answer: The convolution theorem states that the Laplace transform of the convolution of two functions equals the product of their individual Laplace transforms: L{(f*g)(t)} = F(s)*G(s).
Explanation: This theorem is fundamental to engineering because it proves that the output of a linear time-invariant system equals the convolution of the input signal with the system's impulse response. In the s-domain, this becomes simple multiplication, making system analysis much easier.
Q4. What is resonance in a forced vibration system and what conditions cause it?
Answer: Resonance occurs when the frequency ratio r = omega/omega_n equals 1, meaning the driving frequency equals the natural frequency of the system. Under resonance conditions, the steady-state amplitude is X = (F_0/k) / (2*zeta), which can be many times larger than the static deflection.
Explanation: In the method of undetermined coefficients for y'' + 4y = 3*cos(2x), the forcing frequency matches the natural frequency, causing the particular solution to include a factor of x (secular growth). In real systems with damping, amplitude does not grow to infinity but reaches a finite maximum at resonance. Avoiding resonance is critical in structural and mechanical engineering.
Q5. How are eigenvalues and eigenvectors used to solve systems of first-order ODEs?
Answer: For a system dX/dt = AX, we assume solutions of the form X = vexp(lambdat). Substituting gives lambdav = Av, so lambda are eigenvalues and v are eigenvectors of matrix A. The general solution is a linear combination of all eigenvalue-eigenvector pairs: X = sum of Ck * vk * exp(lambda_k * t).
Explanation: Eigenvalues determine the stability and time constants of each mode. If all eigenvalues have negative real parts, the system is stable. The eigenvectors define the directions of each natural mode of the system.