-
Consider an initial value problem y′(t)=f(t,y(t)) with y(t0)=y0
-
The Taylor series expansion of the solution y(t) around t0 is given by:
y(t)=y(t0)+y′(t0)(t−t0)+2!y′′(t0)(t−t0)2+3!y′′′(t0)(t−t0)3+⋯
-
The derivatives of y(t) can be expressed in terms of f(t,y(t)) using the chain rule:
y′(t)=f(t,y(t))
y′′(t)=∂t∂f+∂y∂ff(t,y(t))
y′′′(t)=∂t2∂2f+2∂t∂y∂2ff(t,y(t))+∂y2∂2f(f(t,y(t)))2+∂y∂f(∂t∂f+∂y∂ff(t,y(t)))
-
The n-th order Taylor method approximates the solution by truncating the Taylor series at the n-th term:
y(t0+h)≈y(t0)+hf(t0,y(t0))+2!h2y′′(t0)+⋯+n!hny(n)(t0)
-
The local truncation error is of order O(hn+1), while the global error is of order O(hn)
-
The coefficients of the Taylor series can be computed efficiently using automatic differentiation or symbolic computation
-
Consider the initial value problem y′(t)=t2+y2 with y(0)=1. Implement a 4th-order Taylor method to approximate the solution at t=0.5 with a step size of h=0.1. Compare the result with the exact solution y(t)=tan(t3/3+π/4).
Solution:
- The derivatives of f(t,y)=t2+y2 are:
ft(t,y)=2t, fy(t,y)=2y, ftt(t,y)=2, fty(t,y)=0, fyy(t,y)=2
- The 4th-order Taylor method yields:
y(0.1)≈1.1034, y(0.2)≈1.2140, y(0.3)≈1.3323, y(0.4)≈1.4589, y(0.5)≈1.5944
- The exact solution at t=0.5 is y(0.5)=1.6003, so the absolute error is 0.0059
-
Solve the Van der Pol oscillator equation y′′(t)=μ(1−y2)y′(t)−y(t) with μ=1 and initial conditions y(0)=2, y′(0)=0 using a 6th-order Taylor method. Compute the solution for t∈[0,10] with a step size of h=0.1 and plot the result.
Solution:
- Rewrite the second-order ODE as a system of two first-order ODEs:
y1′(t)=y2(t), y2′(t)=μ(1−y12)y2(t)−y1(t)
- Implement the 6th-order Taylor method for the system and compute the solution
- The plot shows the characteristic limit cycle behavior of the Van der Pol oscillator, with the solution converging to a stable periodic orbit
-
Implement an adaptive step size control scheme for a 5th-order Taylor method and apply it to the Lorenz system:
x′(t)=σ(y−x), y′(t)=x(ρ−z)−y, z′(t)=xy−βz
with parameters σ=10, ρ=28, β=8/3 and initial conditions x(0)=1, y(0)=1, z(0)=1. Compute the solution for t∈[0,50] and plot the result in 3D.
Solution:
- Implement the 5th-order Taylor method for the Lorenz system
- Estimate the local truncation error using the difference between the 4th-order and 5th-order approximations
- Adjust the step size based on the error estimate to maintain a desired tolerance (e.g., 10−6)
- Compute the solution using the adaptive step size control and plot the result in 3D
- The plot shows the chaotic behavior of the Lorenz system, with the solution forming a strange attractor in the phase space