## Transcribed Text

(a) Write Matlab/Mathematica routines implementing the basic step (x, y) → (x+h, ynext)
in the case of Euler's method and Taylor's method of order p = 2, entering the function
f of the differential equation y
0 = f(x, y) as an input function.
(b) Consider the initial value problem
y
0 = Ay, 0 ≤ x ≤ 1, y(0) = 1,
where
A =
1
2
λ2 + λ3 λ3 − λ1 λ2 − λ1
λ3 − λ2 λ1 + λ3 λ1 − λ2
λ2 − λ3 λ1 − λ3 λ1 + λ2
, 1
T = [111]
Integrate the initial value problem with constant step length h = 1/N by (i) Euler's
method (p = 1) and (ii) Taylor's method (p = 2) using the programs written in (a). Use
N = 5, 10, 40, 80 and xn = .2 : .2 : 1, and suggested λ-values are:
(i) λ1 = −1, λ2 = 0, λ3 = 1;
(ii) λ1 = 0, λ2 = −1, λ3 = −10;
(iii) λ1 = 0, λ2 = −1, λ3 = −40;
(iv) λ1 = 0, λ2 = −1, λ3 = −160;
(c) The exact solution is
y(x) =
−e
λ1x + e
λ2x + e
λ3x
e
λ1x − e
λ2x + e
λ3x
e
λ1x + e
λ2x − e
λ3x
Define the global error en = un − y(xn) based on (b). Print ||en||∞.

This material may consist of step-by-step explanations on how to solve a problem or examples of proper writing, including the use of citations, references, bibliographies, and formatting. This material is made available for the sole purpose of studying and learning - misuse is strictly forbidden.

function y_next=Taylorstep(x,y,h,f,f_x,f_y)

% y_next=Taylorstep(x,y,h,f,f_x,f_y)

% implements second order Taylor series method for ODE

% INPUTS:

% x -- x - scalar variable

% y -- y - vector variable (a column)

% h -- stepsize

% f -- f(x,y) -- differential equation

% f_x -- partial with respect to x of f

% f_y -- derivative of f with respect to y

% OUTPUT:

% y_next -- updated value of y

y_prime=f(x,y);

y_next=y+h*y_prime+(h^2/2)*(f_x(x,y)+f_y(x,y)*y_prime);

return...