function y_out = odes_5(x, y_in)
% This function produces the respective values of the following first-order
% system that was originally a second-order system.
% y(1) = x'' = u' =
% x+2*dy/dt-(1-mu)*x+mu/[(x+mu)^2+y^2]^3/2-mu*(x-1+mu)/[(x-1+mu)^2+y^2]^3/2
% y(2) = y'' = v' =
% y+2*dx/dt-(1-mu)*y+mu/[(x+mu)^2+y^2]^3/2-mu*y/[(x-1+mu)^2+y^2]^3/2
% y(3) = x' = u
% y(4) = y' = v
% IV_vec is a vector of values that correstpond to c'',s'',c',s',c,s. 
mu = 0.012277471;
dxdt = y_in(1); dydt = y_in(2);
x = y_in(3); y = y_in(4);
denom_factor1 = ((x+mu)^2+y^2)^(3/2);
denom_factor2 = ((x-1+mu)^2+y^2)^(3/2);

y_out(1) = x+2*dydt-(1-mu)*(x+mu)/denom_factor1 - mu*(x-1+mu)/denom_factor2;
y_out(2) = y-2*dxdt-(1-mu)*y/denom_factor1 - mu*y/denom_factor2; 
y_out(3) = dxdt;
y_out(4) = dydt;
y_out = y_out';