(*  This program is for use with "Correlative Capacity of Composite Quantum States" by M. H. Partovi  *)
ClearAll[pa,pb];tiny=10^(-14);
h[x_]:=-x*Log[x+tiny];H2[x_]:=h[x]+h[1-x];H3[x_,y_]:=h[x]+h[y]+h[1-x-y];
CCLA[x_,y_]:=H2[x]+H2[y]-H3[Min[x,y],Max[Abs[x-y],1-Max[x,y]]];CSEP[x_,y_]:=H2[x]+H2[y]-H2[Min[x,y]];CENT[x_,y_]:=H2[x]+H2[y]-H2[1-Abs[x-y]];
(*  The following 4 lines calculate the maximum correlations for a given pair of qubits with spectra ((p^(a )),1-(p^(a ))) and ((p^(b )),1-(p^(b ))) for the three cases.   The following numerical assignments for (p^(a )) and (p^(b ))can be changed.  *)
pa=.55; pb=.75;
Print["Max Classical Correlations=",CCLA[pa,pb],"   Max Separable Correlations=",CSEP[pa,pb],"   Max Entangled Correlations=",CENT[pa,pb]]
Print[" "];Print[" "];

(*  The following lines provide an animation of maximum correlations for a given pair of qubits with spectra ((p^(a )),1-(p^(a ))) and ((p^(b )),1-(p^(b ))) for the three cases versus (p^b), as (p^(a ))is varied dynamically. *)

ilast=25;
For[i=0,i≤ilast,i++,pa=.5+.5*(i/ilast);
PCLA=Plot[CCLA[pa,y],{y,.5,1},PlotRange->{0,1.4},Frame->True,ImageSize->245,PlotStyle->{Blue,Dashing[{.0075,.011}],Thickness[0.006]},  FrameLabel->{"(p^(b ))","Max Cor Inf"},LabelStyle->{Black,FontSize->11,FontFamily->"Times"} ];
PSEP=Plot[CSEP[pa,y],{y,.5,1},PlotRange->{0,1.4},Frame->True,ImageSize->245,PlotStyle->{Green, Dashing[{0.025,.011}],Thickness[0.006]},  FrameLabel->{"(p^(b ))","Max Cor Inf"},LabelStyle->{Black,FontSize->11,FontFamily->"Times"} ];
PENT=Plot[CENT[pa,y],{y,.5,1},PlotRange->{0,1.4},Frame->True,ImageSize->245,PlotStyle->{Red,Thickness[0.006]},  FrameLabel->{"(p^(b ))","Max Cor Inf"},LabelStyle->{Black,FontSize->11,FontFamily->"Times"} ];
plot[pa]=Show[PCLA,PSEP,PENT]]
Manipulate[plot[pa]  , {pa,0.5,1.0,0.02}, FrameLabel->"classically correlated (short dash, blue), separable (long dash, green), and entangled (solid, red) states", LabelStyle->Directive[Black,Medium,FontFamily->"Times"]]