# euler.jl -- This is Euler's method f(t)=2*sin(t)*cos(t) N=20 T=2*pi h=T/N y0=0 y=y0 t0=0 ys=zeros(N) ts=zeros(N) for n=0:(N-1) global t,y,ts,ys t=t0+h*n y=y+h*f(t) ts[n+1]=t0+h*(n+1) ys[n+1]=y end yexact(t)=sin(t)^2 using Plots plot([0:0.01:T;],yexact.([0:0.01:T;])) display(plot!(ts,ys))