Let and use the method of successive approximations to approximate the solution of the initial value problem y'= t2 + y2, y(0) = 0.
(a) Calculate .
(b) Plot and observe whether the iterates seem to be converging.
Because MATLAB does not have symbolic integration capabilities, we can only obtain numerical solutions for . However, we can graph these and investigate the convergence of these solutions visually.
For the method of successive approximations, we start with and use the formula to construct a sequence of approximations to the solution of the initial value problem . If the method is successful, then this sequence of approximations will converge to the solution of the IVP.
Implementation of the method of successive approximations is relatively easy in MATLAB:
>> clear; % Clear all variables
>> figure; % Open new figure
>> hold on; % Keep figure open
>> h=0.01; % Set stepsize between t's
>> t=[0:h:10]; % Define an array of t-values from 0 to 10
>> diffeq=inline('t.*t+y.*y','t','y'); % Define y' function
>> phi1=cumtrapz(t,feval(diffeq,t,0)); % See note below
>> phi2=cumtrapz(t,feval(diffeq,t,phi1)); % See note
>> phi3=cumtrapz(t,feval(diffeq,t,phi2)); % See note
>> plot(t,phi1); % Plot the 1st curve blue
>> plot(t,phi2,'r'); % Plot the 2nd curve red
>> plot(t,phi3,'g'); % Plot the 3rd curve green
>> axis([0 10 0 100]); % Reset the window size
>> title('The First 3 Successive Approximations to y''=t^2+y^2');
MATLAB Note: The MATLAB command 'cumtrapz(t,y)' (loosely translated: 'cumulative trapezoid') gives a numerical area function using the trapezoid rule to approximate the integral. For a small stepsize ('h'), this gives a good approximation to the integral function
In the figure above, the blue curve is the graph of the first approximation, the red curve is the graph of the second approximation, and the green curve is the graph of the third approximation.
We graphed the first three successive approximations above. From the first three, we cannot determine whether or not these approximations converge. They were easy to compute, so let's compute a few more, graph them, and see if we get any more information.
It appears from the graph above that the solutions are blowing up near t = 2.