function [T,Y]= euler1(f,t,y)
% EULER1 First-order Euler solver
% Input values are column vector of times t 
%                  and column vector initial conditions y(6)= (x,y,z,vx,vy,vz)
% Output values are column vectors time T
% and Y(size(t,1),6)=(dx/dt,dy/dt,dz/dt,dvx/dt,dvy/dt,dvz/dt)

nn=size(t,1);
%Set initial conditions
T(1)=t(1);
Y(:,1)=y;

for i= 2:nn
  T(i)=t(i);
  dt=T(i)-T(i-1);
  dydt=lorentz(T(i),Y(:,i-1));
  Y(:,i)=Y(:,i-1) + dt*dydt(:);
end

%Transpose matrices for output
Y=Y';
T=T';
