A = linspace(0,1,1000);
%ylim([-5,1.1])
tc = 2./((2-A).^2);
xlim([0 1])
hold on

for i = 1:length(A)
if A(i)<1-sqrt(2)/2
tf(i) = Inf;
else
tf(i) = (2*((A(i)-1)^2 + 2*(A(i)-1) + 2*(1-A(i))*sqrt(A(i)*(2-A(i)))))./(A(i)^2*(2-A(i))^2);  
end
end

tmax = min(tf,tc)

%plot(A,tc,'x','Color','r','MarkerSize',2);
%plot(A,tf,'x','Color','b','MarkerSize',2)
plot(A,tmax,'Color','g','Linewidth',2)

%xlim([1 3])

flux = 1 - A/2;
plot(A,flux,'LineWidth',2,'Color','c')
overall_throughput = flux.*tmax
plot(A,overall_throughput,'LineWidth',2,'Color','k')




