Dear all;

Thanks ifor looking and help me in my work. Your remarks are welcome.Description:

This routine uses the midpoint method to approximate the solution of

the differential equation $y'=f(x,y)$ with the initial condition $y = y[0]$

at $x = a$ and recursion starting value $y = y[1]$ at $x = a+h$. The values

are returned in $y[n]$, the value of $y$ evaluated at $x = a + nh$.

Arguments:

\begin{itemize}

\item $f$ the integrand, a function of a two variables

\item $y[]$ On input $y[0]$ is the initial value of $y$ at $x = a$, and $y[1]$

is the value of $y$ at $x = a + h$,

\item on output for $i \geqslant 2$

$$ y[i] = y[i-2] + 2h f(x[i],y[i]); \quad \quad x[i] = a + i h.$$

\end{itemize}

CODE USING MAPLE

Midpoint-Method=proc(f,a,b, N)

h:=(b-a)/N;

x[0]:=a;

y[0]:=1:

for n from 2 to N do

x[n] := a+n*h;

y[n+1] = y[n-1] + 2h f( x[n], y[n] );

od:

// Generate the sequence of approximations for the Improved Euler method

data_midpoint := [seq([x[n],y[n]],n=0..N)]:

//write the function;

F:=(t,y)-> value of function ;

//Generate plot which is not displayed but instead stored under the name out_fig for example

out_fig := plot(data_midpoint,style=point,color=blue)

Your remarks.

Thanks