function[xc,n]=P1Bisect(x1,x2,y2,L1,L2,L3,gamma,p1,p2,p3,Guess1,Guess2,tol)
a=Guess1;
b=Guess2;
f=@(x) Project1FInputs(x1,x2,y2,L1,L2,L3,gamma,p1,p2,p3,x);
if sign(f(a))*sign(f(b)) >= 0
  error('f(a)f(b)<0 not satisfied!') %ceases execution
end
fa=f(a);
fb=f(b);
k = 0;
while (b-a)/2>tol
  c=(a+b)/2;
  fc=f(c);
  if fc == 0              %c is a solution, done
    break
  end
  if sign(fc)*sign(fa)<0  %a and c make the new interval
    b=c;fb=fc;
  else                    %c and b make the new interval
    a=c;fa=fc;
  end
  k = k + 1;			  %k keeps track of the iterations
end
xc=(a+b)/2;               %new midpoint is best estimate
n = k;					  %final iteration count