function pprime = ex2_pt(p, x, u, t)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Creators Kittiphan Techakittiroj
%% Created 27 April 1996 (at ESCI, Case Western Reserve University)
%% Modified 27 April 1996 (at ESCI, Case Western Reserve University)
%% MATLAB version 4.0
%%
%% Function for example 1, Co-state Equation
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
pprime = zeros(size(p));
pprime(1) = -2*x(1) + 2*p(1) ...
-p(1)*(x(2)+0.5)*(50/(x(1)+2)^2)*exp(25*x(1)/(x(1)+2)) ...
+p(1)*u + p(2)*(x(2)+0.5)*(50/(x(1)+2)^2)*exp(25*x(1)/(x(1)+2));
pprime(2) = -2*x(2) - p(1)*exp(25*x(1)/(x(1)+2)) ...
+p(2)*(1+exp(25*x(1)/(x(1)+2)));