 function FF = FFunc1(theta,P);
 
 % Derivative of function 1
 
 FF=derppval(P,theta)*sin(theta)+ppval(P,theta)*cos(theta);
 if theta < 0
    FF=-2*theta+pi;
 elseif theta > pi
    FF=-2*theta+pi;
 end;