We have the method $$ y^{n+1}=y^n+h \cdot [\rho \cdot f(t^n,y^n)+(1-\rho) \cdot f(t^{n+1},y^{n+1})] ,\quad n=0,\ldots,N-1 \\ y^0=y_0 $$
I have to calculate the local truncation error for the method for rho=0.5 and rho=0 and to compare the "order" of the local error with the "order" of the total error.
To do that do we have to find the local truncation error for each $t_i$ ?
Also how can we find the "order" of the local error using Matlab? Or is it only possible to find it by hand?
For the purposes of order determination, it is more comfortable to use the autonomous formulation of ODE, $y'=f(y)$.
The method is $y_1=y_0+h·Φ(y_0,h)$ with $$ Φ(y_0,h)=ρ⋅f(y_0)+(1−ρ)⋅f(y_0+h·Φ(y_0,h)) $$ Using the Taylor expansion and inserting it into itself recursively, one obtains up to terms quadratic in $h$ \begin{align} Φ&=ρ⋅f_0+(1−ρ)⋅\Bigl(f_0+h·f'_0[Φ]+\frac{h^2}2f''_0[Φ,Φ]+O(h^3)\Bigr)\\ &=f_0+(1−ρ)⋅h·\Bigl(f'_0\bigl[\,f_0+(1−ρ)⋅h·f'_0[Φ]\,\bigr]+\frac{h}2f''_0[f_0,f_0]\Bigr)+O(h^3)\\\ &=f_0+(1−ρ)⋅h·f'_0[f_0]+(1−ρ)⋅h^2·\Bigl((1−ρ)·f'_0\bigl[\,f'_0[f_0]\,\bigr]+\frac12f''_0[f_0,f_0]\Bigr)+O(h^3) \end{align} On the other hand, for the IVP with $y'(0)=y_0$ one gets \begin{align} \frac{y(h)-y(0)}{h} &=y'(0)+\frac{h}2·y''(0)+\frac{h^2}{6}y'''(0)+O(h^3)\\ &=f_0+\frac{h}2·f'_0[f_0]+\frac{h^2}{6}·\Bigl(f'_0\bigl[\,f'_0[f_0]\,\bigr]+f_0''[f_0,f_0]\Bigr)+O(h^3) \end{align} The difference is dominated by $$ (\tfrac12-ρ)⋅h·f'_0[f_0] $$ for $\rho\ne \frac12$ and $$ \frac{h^2}{12}·\Bigl(f'_0\bigl[\,f'_0[f_0]\,\bigr]+f''_0[f_0,f_0]\Bigr) $$ for $\rho= \frac12$.