Study guide
6.2 Interpolation, Numerical Integration & Numerical Solution of ODEs
PRC Registered Electrical Engineer REE
Track your progress as you read
Finished sections get a check mark.
1 Chapter 1: Overview, RA 7920 & Electrical Engineering Ethics
1.1 PRC Board of Electrical Engineering & REE Examination Overview 1.2 Republic Act No. 7920 (New Electrical Engineering Law) & License Classes 1.3 Code of Ethics & Professional Practice for Electrical Engineers
2 Chapter 2: Math — Algebra, Trig & Geometry
2.1 Algebraic Equations, Polynomials & Complex Numbers 2.2 Trigonometry — Identities, Triangles & Spherical Trig 2.3 Analytic & Solid Geometry
3 Chapter 3: Engineering Mathematics — Calculus & Differential Equations
3.1 Differential Calculus, Limits, Derivatives & Applications 3.2 Integral Calculus, Integration Techniques & Area/Volume Applications 3.3 Ordinary Differential Equations & Initial-Value Problems
4 Chapter 4: Engineering Mathematics — Advanced Math & Transform Methods
4.1 Laplace Transforms, Inverse Transforms & Circuit Applications 4.2 Fourier Series, Fourier Transforms & Frequency-Domain Analysis 4.3 Vector Analysis, Linear Algebra, Matrices & Complex Analysis
5 Chapter 5: Engineering Mathematics — Probability, Statistics & Engineering Data Analysis
5.1 Probability Theory, Counting Techniques & Bayes' Theorem 5.2 Engineering Data Analysis I — Descriptive Statistics & Probability Distributions 5.3 Engineering Data Analysis II — Confidence Intervals, Hypothesis Testing & Regression
6 Chapter 6: Engineering Mathematics — Numerical Methods & Analysis
6.1 Numerical Root-Finding & Solution of Linear Systems 6.2 Interpolation, Numerical Integration & Numerical Solution of ODEs
7 Chapter 7: ESAS — Physics, Chemistry & Computer Fundamentals
7.1 Physics for Engineers 7.2 General Chemistry & Materials Science 7.3 Computer Fundamentals, Programming & Data Logic 7.4 Logic Circuits, Switching Theory & Microprocessor Systems
8 Chapter 8: ESAS — Mechanics & Thermal-Fluid Engineering
8.1 Engineering Mechanics — Statics & Dynamics 8.2 Strength of Materials & Mechanics of Deformable Bodies 8.3 Thermal-Fluid Engineering — Thermodynamics & Fluid Mechanics
9 Chapter 9: ESAS — Engineering Economics, Management & Contracts
9.1 Engineering Economics & Depreciation 9.2 Engineering Management & Ethics 9.3 Philippine Electrical Engineering Law, Code & Contracts 9.4 Technopreneurship 101 & Management of Engineering Projects
10 Chapter 10: PEC 1 — Safety, Sizing & Protection
10.1 PEC Fundamentals, Safety Standards & Grounding/Bonding 10.2 Conductor Sizing, Ampacity Adjustment & Voltage Drop 10.3 Overcurrent Protection, Branch Circuit & Feeder Sizing 10.4 Basic Occupational Safety & Health (BOSH) and Electrical Safety Standards
11 Chapter 11: PEC 1 & 2 — Equipment & Utility Systems
11.1 PEC Equipment Installation & Wiring Methods 11.2 Utility Systems, Transformers & Switchgear 11.3 Special Occupancies & Hazardous Locations
12 Chapter 12: Electrical Professional — DC & AC Circuit Fundamentals
12.1 DC Circuit Analysis & Network Theorems 12.2 Single-Phase AC Circuits & Phasor Analysis 12.3 Balanced & Unbalanced Three-Phase AC Circuits
13 Chapter 13: Electrical Professional — EM Fields & Transients
13.1 Electrostatics, Magnetostatics & Maxwell's Equations 13.2 Electromagnetic Waves & Transmission Line Fields 13.3 First-Order & Second-Order Circuit Transients
14 Chapter 14: Electrical Professional — Electronics, Industrial Electronics & Communications
14.1 Electronics 1 & 2 — Semiconductor Devices & Analog Circuits 14.2 Electrical Apparatus & Devices — Industrial Electronics & Power Converters 14.3 Fundamentals of Electronic Communications
15 Chapter 15: Electrical Professional — Transformers & DC Machines
15.1 Single-Phase & Three-Phase Transformers 15.2 Transformer Connections & Special Transformers 15.3 DC Generators & DC Motors
16 Chapter 16: Electrical Professional — AC Synchronous & Induction Machinery
16.1 Synchronous Generators (Alternators) 16.2 Synchronous Motors & Special AC Machines 16.3 Three-Phase & Single-Phase Induction Motors
17 Chapter 17: Electrical Professional — Power Plants & Energy Conversion
17.1 Hydroelectric, Thermal & Combined Cycle Power Plants 17.2 Renewable Energy Systems & Geothermal Power Plants 17.3 Power Plant Economics, Load Curves & Energy Conversion
18 Chapter 18: Electrical Professional — Transmission & Distribution
18.1 Transmission Line Parameters & Performance Models 18.2 Mechanical Overhead Line Design, Underground Cables & Insulators 18.3 Distribution Systems, Substation Layouts & Power Flow Control
19 Chapter 19: Electrical Professional — Power System Analysis
19.1 The Per-Unit System, Base Conversion & Impedance Diagrams 19.2 Symmetrical Components & Unbalanced Fault Analysis 19.3 Load Flow, Economic Dispatch & Power System Stability
20 Chapter 20: Electrical Professional — Protection, Control, Instrumentation & Illumination
20.1 Power System Protection & Protective Relaying 20.2 Industrial Motor Control, Logic Circuits & PLC Automation 20.3 Electrical Instrumentation, Transducers & Measurement Systems 20.4 Illumination Engineering, Lighting Design & Photometrics 20.5 Feedback Control Systems & Research Methods
6.2 Interpolation, Numerical Integration & Numerical Solution of ODEs
Key Takeaways Explain This Topic AI
The trapezoidal rule integrates with error of order h², while Simpson's 1/3 rule reaches order h⁴ and integrates cubics exactly despite fitting parabolas.
Simpson's 1/3 rule requires an even number of intervals; Simpson's 3/8 rule requires a multiple of three.
Lagrange and Newton divided-difference interpolation through the same n + 1 points produce the identical unique polynomial of degree ≤ n, only in different algebraic form.
Euler's method has global error of order h and is only conditionally stable; fourth-order Runge-Kutta reaches global error of order h⁴ using four slope evaluations per step.
Numerical differentiation amplifies noise: the central difference [f(x+h) − f(x−h)]/2h is second-order accurate and preferred over one-sided differences.
Last updated: August 2026
6.2 Interpolation, Numerical Integration & Numerical Solution of ODEs
The second half of the PRC Enhanced TOS topic Numerical Methods & Analysis deals with data that arrives as a table rather than a formula, and with differential equations that have no closed-form solution. Electrical engineers meet both daily: conductor ampacity tables that need interpolation, measured load curves that need integration into energy, and transient-stability swing equations that need step-by-step solution.
- 1. Interpolation
- Linear Interpolation
The workhorse for reading between two rows of a PEC or manufacturer's table: y = y 0 + ( x − x 0 ) ( y 1 − y 0 ) x 1 − x 0 y = y_0 + \frac{(x - x_0)(y_1 - y_0)}{x_1 - x_0} y = y 0 + x 1 − x 0 ( x − x 0 ) ( y 1 − y 0 )
Lagrange Interpolating Polynomial
For n + 1 n+1 n + 1 data points, the unique polynomial of degree ≤ n \le n ≤ n through them is P n ( x ) = ∑ i = 0 n y i L i ( x ) , L i ( x ) = ∏ j = 0 j ≠ i n x − x j x i − x j P_n(x) = \sum_{i=0}^{n} y_i L_i(x), \qquad L_i(x) = \prod_{\substack{j=0 \\ j \ne i}}^{n} \frac{x - x_j}{x_i - x_j} P n ( x ) = i = 0 ∑ n y i L i ( x ) , L i ( x ) = j = 0 j = i ∏ n x i − x j x − x j
Newton's Divided-Difference Form P n ( x ) = f [ x 0 ] + f [ x 0 , x 1 ] ( x − x 0 ) + f [ x 0 , x 1 , x 2 ] ( x − x 0 ) ( x − x 1 ) + ⋯ P_n(x) = f[x_0] + f[x_0,x_1](x-x_0) + f[x_0,x_1,x_2](x-x_0)(x-x_1) + \cdots P n ( x ) = f [ x 0 ] + f [ x 0 , x 1 ] ( x − x 0 ) + f [ x 0 , x 1 , x 2 ] ( x − x 0 ) ( x − x 1 ) + ⋯
with divided differences built recursively as f [ x i , x i + 1 ] = f ( x i + 1 ) − f ( x i ) x i + 1 − x i f[x_i, x_{i+1}] = \frac{f(x_{i+1}) - f(x_i)}{x_{i+1} - x_i} f [ x i , x i + 1 ] = x i + 1 − x i f ( x i + 1 ) − f ( x i )
Examinable fact: Lagrange and Newton forms give the same polynomial through the same points — the interpolating polynomial of degree ≤ n \le n ≤ n through n + 1 n+1 n + 1 distinct points is unique. Newton's form is preferred in practice because adding a new data point only appends one term instead of rebuilding everything.
Interpolation vs. extrapolation: estimating inside the data range is interpolation and is comparatively safe; going outside it is extrapolation, and high-degree polynomials diverge violently there (Runge's phenomenon). Spline interpolation, which fits low-degree polynomials piecewise with matched slopes and curvatures, avoids this oscillation.
2. Finite Differences & Numerical Differentiation
Scheme Formula Truncation error
Forward difference f ′ ( x ) ≈ f ( x + h ) − f ( x ) h f'(x) \approx \dfrac{f(x+h) - f(x)}{h} f ′ ( x ) ≈ h f ( x + h ) − f ( x ) O ( h ) O(h) O ( h )
Backward difference f ′ ( x ) ≈ f ( x ) − f ( x − h ) h f'(x) \approx \dfrac{f(x) - f(x-h)}{h} f ′ ( x ) ≈ h f ( x ) − f ( x − h ) O ( h ) O(h) O ( h )
Central difference f ′ ( x ) ≈ f ( x + h ) − f ( x − h ) 2 h f'(x) \approx \dfrac{f(x+h) - f(x-h)}{2h} f ′ ( x ) ≈ 2 h f ( x + h ) − f ( x − h ) O ( h 2 ) O(h^{2}) O ( h 2 )
Second derivative f ′ ′ ( x ) ≈ f ( x + h ) − 2 f ( x ) + f ( x − h ) h 2 f''(x) \approx \dfrac{f(x+h) - 2f(x) + f(x-h)}{h^{2}} f ′′ ( x ) ≈ h 2 f ( x + h ) − 2 f ( x ) + f ( x − h ) O ( h 2 ) O(h^{2}) O ( h 2 )
The central difference is second-order accurate at the same cost as the one-sided forms, so it is the default. Be aware that numerical differentiation amplifies measurement noise (the subtraction of nearly equal numbers is divided by a small h h h ), which is why differentiating a noisy current signal is far less reliable than integrating it.
3. Numerical Integration
With h = ( b − a ) / n h = (b-a)/n h = ( b − a ) / n :
Trapezoidal Rule ∫ a b f ( x ) d x ≈ h 2 [ f 0 + 2 ( f 1 + f 2 + ⋯ + f n − 1 ) + f n ] , E = O ( h 2 ) \int_a^b f(x)\,dx \approx \frac{h}{2}\left[f_0 + 2(f_1 + f_2 + \cdots + f_{n-1}) + f_n\right], \qquad E = O(h^{2}) ∫ a b f ( x ) d x ≈ 2 h [ f 0 + 2 ( f 1 + f 2 + ⋯ + f n − 1 ) + f n ] , E = O ( h 2 )
Simpson's 1/3 Rule — n n n must be even ∫ a b f ( x ) d x ≈ h 3 [ f 0 + 4 ( f 1 + f 3 + ⋯ ) + 2 ( f 2 + f 4 + ⋯ ) + f n ] , E = O ( h 4 ) \int_a^b f(x)\,dx \approx \frac{h}{3}\left[f_0 + 4(f_1 + f_3 + \cdots) + 2(f_2 + f_4 + \cdots) + f_n\right], \qquad E = O(h^{4}) ∫ a b f ( x ) d x ≈ 3 h [ f 0 + 4 ( f 1 + f 3 + ⋯ ) + 2 ( f 2 + f 4 + ⋯ ) + f n ] , E = O ( h 4 )
The coefficient pattern is 1 , 4 , 2 , 4 , 2 , … , 4 , 1 1, 4, 2, 4, 2, \dots, 4, 1 1 , 4 , 2 , 4 , 2 , … , 4 , 1 . Although it fits parabolas , Simpson's 1/3 rule integrates cubics exactly — a favourite examination fact.
Simpson's 3/8 Rule — n n n must be a multiple of three ∫ a b f ( x ) d x ≈ 3 h 8 [ f 0 + 3 f 1 + 3 f 2 + 2 f 3 + 3 f 4 + ⋯ + f n ] \int_a^b f(x)\,dx \approx \frac{3h}{8}\left[f_0 + 3f_1 + 3f_2 + 2f_3 + 3f_4 + \cdots + f_n\right] ∫ a b f ( x ) d x ≈ 8 3 h [ f 0 + 3 f 1 + 3 f 2 + 2 f 3 + 3 f 4 + ⋯ + f n ]
- Rule Fits Interval requirement Error order Exact for polynomials up to degree
- Trapezoidal Straight lines any n n n O ( h 2 ) O(h^{2}) O ( h 2 ) 1
- Simpson's 1/3 Parabolas n n n even O ( h 4 ) O(h^{4}) O ( h 4 ) 3
- Simpson's 3/8 Cubics n n n multiple of 3 O ( h 4 ) O(h^{4}) O ( h 4 ) 3
- 4. Numerical Solution of Ordinary Differential Equations
For d y d x = f ( x , y ) \dfrac{dy}{dx} = f(x,y) d x d y = f ( x , y ) with y ( x 0 ) = y 0 y(x_0) = y_0 y ( x 0 ) = y 0 :
Euler's Method y k + 1 = y k + h f ( x k , y k ) , global error O ( h ) y_{k+1} = y_k + h\,f(x_k, y_k), \qquad \text{global error } O(h) y k + 1 = y k + h f ( x k , y k ) , global error O ( h )
Simple, but only first-order accurate and conditionally stable — halving h h h only halves the error while doubling the work.
Heun's Method (Improved Euler, RK2) y k + 1 = y k + h 2 [ f ( x k , y k ) + f ( x k + 1 , y k + h f ( x k , y k ) ) ] , O ( h 2 ) y_{k+1} = y_k + \frac{h}{2}\left[f(x_k, y_k) + f(x_{k+1}, y_k + h f(x_k,y_k))\right], \qquad O(h^{2}) y k + 1 = y k + 2 h [ f ( x k , y k ) + f ( x k + 1 , y k + h f ( x k , y k )) ] , O ( h 2 )
Fourth-Order Runge-Kutta (RK4) k 1 = h f ( x k , y k ) , k 2 = h f ( x k + h 2 , y k + k 1 2 ) k_1 = h f(x_k, y_k), \quad k_2 = h f\!\left(x_k + \tfrac{h}{2}, y_k + \tfrac{k_1}{2}\right) k 1 = h f ( x k , y k ) , k 2 = h f ( x k + 2 h , y k + 2 k 1 ) k 3 = h f ( x k + h 2 , y k + k 2 2 ) , k 4 = h f ( x k + h , y k + k 3 ) k_3 = h f\!\left(x_k + \tfrac{h}{2}, y_k + \tfrac{k_2}{2}\right), \quad k_4 = h f(x_k + h, y_k + k_3) k 3 = h f ( x k + 2 h , y k + 2 k 2 ) , k 4 = h f ( x k + h , y k + k 3 ) y k + 1 = y k + 1 6 ( k 1 + 2 k 2 + 2 k 3 + k 4 ) , global error O ( h 4 ) y_{k+1} = y_k + \frac{1}{6}\left(k_1 + 2k_2 + 2k_3 + k_4\right), \qquad \text{global error } O(h^{4}) y k + 1 = y k + 6 1 ( k 1 + 2 k 2 + 2 k 3 + k 4 ) , global error O ( h 4 )
RK4 costs four function evaluations per step but delivers fourth-order accuracy, which is why it is the standard integrator for the transient-stability swing equation and for machine dynamic models.
- Solved Board Exam Examples
- Example 1: Simpson's 1/3 Rule on a Load Curve
A feeder demand is recorded every 2 hours over an 8-hour shift: 4.0, 5.2, 6.8, 6.0 and 4.4 MW. Estimate the energy delivered.
Solution. Here h = 2 h = 2 h = 2 h and n = 4 n = 4 n = 4 intervals — even, so Simpson's 1/3 rule applies: E ≈ 2 3 [ 4.0 + 4 ( 5.2 ) + 2 ( 6.8 ) + 4 ( 6.0 ) + 4.4 ] E \approx \frac{2}{3}\left[4.0 + 4(5.2) + 2(6.8) + 4(6.0) + 4.4\right] E ≈ 3 2 [ 4.0 + 4 ( 5.2 ) + 2 ( 6.8 ) + 4 ( 6.0 ) + 4.4 ] = 2 3 [ 4.0 + 20.8 + 13.6 + 24.0 + 4.4 ] = 2 3 ( 66.8 ) = 44.53 MWh = \frac{2}{3}\left[4.0 + 20.8 + 13.6 + 24.0 + 4.4\right] = \frac{2}{3}(66.8) = \boxed{44.53 \text{ MWh}} = 3 2 [ 4.0 + 20.8 + 13.6 + 24.0 + 4.4 ] = 3 2 ( 66.8 ) = 44.53 MWh
The trapezoidal rule on the same data gives 44.40 MWh — close here, but with error of order h 2 h^2 h 2 rather than h 4 h^4 h 4 .
Example 2: One RK4 Step on an RL Transient
For d i d t = 10 − 2 i \dfrac{di}{dt} = 10 - 2i d t d i = 10 − 2 i with i ( 0 ) = 0 i(0) = 0 i ( 0 ) = 0 , take one RK4 step of h = 0.1 h = 0.1 h = 0.1 s.
Solution. k 1 = 0.1 ( 10 − 0 ) = 1.0000 k_1 = 0.1(10 - 0) = 1.0000 k 1 = 0.1 ( 10 − 0 ) = 1.0000 k 2 = 0.1 [ 10 − 2 ( 0 + 0.5 ) ] = 0.1 ( 9.0 ) = 0.9000 k_2 = 0.1\left[10 - 2(0 + 0.5)\right] = 0.1(9.0) = 0.9000 k 2 = 0.1 [ 10 − 2 ( 0 + 0.5 ) ] = 0.1 ( 9.0 ) = 0.9000 k 3 = 0.1 [ 10 − 2 ( 0 + 0.45 ) ] = 0.1 ( 9.1 ) = 0.9100 k_3 = 0.1\left[10 - 2(0 + 0.45)\right] = 0.1(9.1) = 0.9100 k 3 = 0.1 [ 10 − 2 ( 0 + 0.45 ) ] = 0.1 ( 9.1 ) = 0.9100 k 4 = 0.1 [ 10 − 2 ( 0 + 0.91 ) ] = 0.1 ( 8.18 ) = 0.8180 k_4 = 0.1\left[10 - 2(0 + 0.91)\right] = 0.1(8.18) = 0.8180 k 4 = 0.1 [ 10 − 2 ( 0 + 0.91 ) ] = 0.1 ( 8.18 ) = 0.8180 ∋ ( 0.1 ) = 0 + 1 6 [ 1.0000 + 2 ( 0.9000 ) + 2 ( 0.9100 ) + 0.8180 ] = 5.4380 6 = 0.90633 A \ni(0.1) = 0 + \frac{1}{6}\left[1.0000 + 2(0.9000) + 2(0.9100) + 0.8180\right] = \frac{5.4380}{6} = \boxed{0.90633 \text{ A}} ∋ ( 0.1 ) = 0 + 6 1 [ 1.0000 + 2 ( 0.9000 ) + 2 ( 0.9100 ) + 0.8180 ] = 6 5.4380 = 0.90633 A
The exact solution is i ( t ) = 5 ( 1 − e − 2 t ) i(t) = 5(1 - e^{-2t}) i ( t ) = 5 ( 1 − e − 2 t ) , giving i ( 0.1 ) = 0.906346 i(0.1) = 0.906346 i ( 0.1 ) = 0.906346 A — RK4 is correct to five decimal places in a single step, while plain Euler would have returned 1.0000 A, an error of 10%.
Example 3: Lagrange Interpolation of Conductor Ampacity
Ampacity is tabulated as 115 A at 30 °C, 103 A at 40 °C and 89 A at 50 °C. Estimate the ampacity at 35 °C using a second-degree Lagrange polynomial.
Solution. With x 0 = 30 , x 1 = 40 , x 2 = 50 x_0 = 30, x_1 = 40, x_2 = 50 x 0 = 30 , x 1 = 40 , x 2 = 50 and x = 35 x = 35 x = 35 : L 0 = ( 35 − 40 ) ( 35 − 50 ) ( 30 − 40 ) ( 30 − 50 ) = 75 200 = 0.375 L_0 = \frac{(35-40)(35-50)}{(30-40)(30-50)} = \frac{75}{200} = 0.375 L 0 = ( 30 − 40 ) ( 30 − 50 ) ( 35 − 40 ) ( 35 − 50 ) = 200 75 = 0.375 L 1 = ( 35 − 30 ) ( 35 − 50 ) ( 40 − 30 ) ( 40 − 50 ) = − 75 − 100 = 0.750 L_1 = \frac{(35-30)(35-50)}{(40-30)(40-50)} = \frac{-75}{-100} = 0.750 L 1 = ( 40 − 30 ) ( 40 − 50 ) ( 35 − 30 ) ( 35 − 50 ) = − 100 − 75 = 0.750 L 2 = ( 35 − 30 ) ( 35 − 40 ) ( 50 − 30 ) ( 50 − 40 ) = − 25 200 = − 0.125 L_2 = \frac{(35-30)(35-40)}{(50-30)(50-40)} = \frac{-25}{200} = -0.125 L 2 = ( 50 − 30 ) ( 50 − 40 ) ( 35 − 30 ) ( 35 − 40 ) = 200 − 25 = − 0.125 P ( 35 ) = 0.375 ( 115 ) + 0.750 ( 103 ) − 0.125 ( 89 ) = 43.125 + 77.25 − 11.125 = 109.25 A P(35) = 0.375(115) + 0.750(103) - 0.125(89) = 43.125 + 77.25 - 11.125 = \boxed{109.25 \text{ A}} P ( 35 ) = 0.375 ( 115 ) + 0.750 ( 103 ) − 0.125 ( 89 ) = 43.125 + 77.25 − 11.125 = 109.25 A
Simple linear interpolation between the first two rows would give 109.0 A; the quadratic form captures the slight curvature of the derating curve. Note that the coefficients sum to exactly 1.000, a useful arithmetic check.