Lab for Taylor's Method for solving O.D.E.'s
Taylor's Method of Order 4. To approximate the solution of the initial value problem with over by evaluating , , and and using the Taylor polynomial at each step.
Background. For an arbitrary f(t,y), what are the derivatives for k = 1, 2, 3, 4 ?
We use the following subroutine TaylorMeth to perform the computations. It starts with the initial point and generates the sequence of values , where dk is evaluated at .
Load in Mathematica's graphics package "Colors".
Report to be handed in.
Computer Exercises
Exercise 1. Use the Taylor method of order N = 4 to compute numerical solutions for the differential equation with initial condition over the interval .
Solution. First, enter the function y'[t] and create explicit formulas for D1, D2, D3, D4 for y', y'', y''', and y'''' respectively, which will involve t and y[t].
Second, replace y[t] with y and construct the implicit formulas d1[t,y], d2[t,y],d3[t,y],d4[t,y] for y', y'', y''', and y'''' respectively,which will involve t and y.
Second, use the subroutine to compute the set of points and store them in the variable taylorset.
Then plot this set of points using the built in Mathematica subroutine ListPlot.
Exercise 2. Use Mathematica's procedure DSolve to get an analytic solution for the differential equation with initial condition over the interval .
Solution. First, Remove any instance of y.
Second, Clear any instance of y. And use separate cells to do it !
Then solve the D. E. with given I. C.
The solution will involve the special function Erfi and some complex numbers which cancel out when a real number is input into f[t].
Compare the two graphs.
Exercise 3. Determine the error in the Taylor Series method, by comparing it with the analytic solution.
Solution. The Taylor Series Method computed a ListPlot. We must use this same type of data structure for f[t] in order to compare the two. The subroutine stored the abscissas in a list T.
Taking f[T] will produce a list of ordinates.
The error is just the difference.
Plotting the data points for the error is similar to plotting the data points for the Taylor Series method solution.
Exercise 4. Error analysis. The Taylor series method of order N = 4 allegedly has a Final Global Error (FGE) of order . Hence, the error at the right endpoint should appear to decrease by 1/16 when the number of sub-intervals is doubled. Use the D.E. in exercise 1 and investigate this behavior for m = 15, 30, 60, 120 and 240 sub-intervals of [0,3].
Notice. The subroutine TayorMeth stores the values in a list starting with subscript 1 and ending with subscript m+1.
We need only check this last point with the value obtained from the analytic solution.
Does the error decrease in the fashion ? i.e. Do the following ratios tend to 16 ?