cmath15.nb  Numerical Solutions    
From Euler's method to NDSolve

Clear["Global`*"]

Analytic solution

General solution

deq=x'[t]== x[t](1-x[t]);
sol=DSolve[{deq,x[0]==x0},x,t] ;
xa=x[t]/.sol[[1]]

A partial solution for  x0=0.1

xanalytic=xa /.{x0->0.1}
graph1=Plot[xanalytic,{t,0,10}]

Numerical Approximation

Euler's Method

(* Initialization *) 
Clear[t,x] 
f[t_,x_]=x(1-x); (* right part of ODE *)  
t0=0;  x0=0.1;    (* Initial Conditions *) 
tmax=10   (* integration interval [t0,t3] *) 
dt=0.5    (* integration step *) 
n=(tmax-t0)/dt   (* total number of steps *)  
datalist={{t0,x0}}     (* list for storing integration data (t_k,x_k), k=1,2,3... *)

(* Iterative procedure *)
For[i=1,i<=n,i++,                  
       t1=t0+dt;  (* next time moment *)
       x1=x0+dt*f[t0,x0];  (*Euler's formula*)
       AppendTo[datalist,{t1,x1}];  (* write data in the list *)
        t0=t1; x0=x1;   (* for the next iteration the new point becomes the starting point *)
]   
datalist

(* Plot of solution *)  
graph2=ListPlot[datalist,PlotStyle->PointSize[0.01]]

Interpolation

xEuler=Interpolation[datalist]    (* function of free variable (here is the time) *)

xEuler[1.7]

graph3=Plot[xEuler[t],{t,0,tmax},PlotStyle->Red]

Compare solutions by the plots

Show[{graph1,graph2,graph3}]

Numerical solution in Mathematica

Clear[x,t]

command NDSolve

deq=x'[t]== x[t](1-x[t]);
x0=0.1; tmin=0; tmax=10;
numsol=NDSolve[{deq,x[0]==x0},x,{t,tmin,tmax}]

Pass numerical solution in user's symbol and plot

xnumeric=x[t]/.numsol[[1]]
graph4=Plot[xnumeric,{t,tmin,tmax},PlotStyle->Black]

Compare solutions by plots

Show[{graph1,graph2,graph3,graph4}]

Numerical error

error=xnumeric-xanalytic
Plot[error,{t,0,10},PlotRange->All]