% function to compute derivative
% and algebraic relationships
% for isothermal batch reactor
% DAE format
function out = batchDAE(t,y,k,Ca0,Cb0)
Ca = y(1); Cb = y(2) ; Cc = y(3) ;
out(1) = - k * Ca * Cb;
out(2) = Cb - (Cb0 - (Ca0-Ca));
out(3) = Cc - (Ca0-Ca);
out = out';
