This is testing Algorithm Writing For this assessment we will be combining while and if control structures together. (A):Write a pseudocode (pen and paper) algorithm that solves the ODE y\'= f(t, y) using Euler’s method. (B):Convert this algorithm into MATLAB syntax, as the function euler method . B1:Your inputs should be the start time t0, the end time tend, the function f, an initial condition y0 and an initial step size h. B2:If h × f(t, y) at any point exceeds 1, your function should halve the step size h. B3:Equally, if h × f(t, y) at any point drops below 0.01, your function should double the step size h. B4:You should also make sure that the final solution step doesn’t ‘overshoot’ tend. (i.e. change h during the final step to exactly reach tend). B5:Your MATLAB code should use the function header below, and be wellcommented with a sensible layout. (C)Include your pseudocode algorithm, as well as the MATLAB code in your Portfolio submission. Also include a discussion of when the code could break, or give incorrect outputs (you DO NOT need to design your code to avoid these). Solution Answer:) A) The derivative term in the first order ivp: y\' = f(t, y), y(t0) = y0 is approtimated by making use of Taylor series approtimation of the dependent variable y(t) at the point ti+1. That is y(ti+1) = y(ti+ Dt) = y(ti) + Dty\'(ti) + (Dt2 / 2)y\'\'(ti) + . . . = y(ti) + Dtf(ti, yi) + (Dt2 / 2)y\'\'(ti) + . . . (... y\'(ti) = f(ti, yi)) if the infinite series is truncated from the term Dt2 onwards, then y(ti+1) = y(ti) + Dt y\'(ti) (or) yi+1 = yi + Dt fi for all i That is, for i = 0, y1 = y0 + Dt f0 i = 1, y2 = y1 + Dt f1 ! i = n-1, yn = yn-1 + Dt fn-1 Since y0 and hence f0 are known (from initial condition) in the equation corresponding to i = 0, all the terms on the r.h.s are known. So y1 that is, y at t1 is calculated easily from this equation. Similarly once y1 is known, r.h.s of the equation corresponding to i = 1 is also known so y2 can be computed. As we proceed in the same way until i = n-1, yn can be obtained. This is an etplicit method because in any equation there is only one unknown which can be separated to the left side of the equation. Local truncation error : The error in the approtimation, that is the difference between the exact solution at ti+1 and the numerical solution yi+1 is called the local truncation error (assumed that yi+1 is calculated with exact arithmetic with out any round off error). Ti+1 = y(ti+1) - yi+1 = y(ti+1) - yi - Dtfi = h2/2 y\'(t) (by Taylor series & remainder theorem) where ti < t < ti+1. Hence the order of the local truncation error for Euler scheme is O(Dt2) as Dt -> 0.