(* The following steps randomly generate and print two 5-dimensional vectors, a[[1]]=a1 and a[[2]]=a2, each with non-negative, non-increasing components that sum to unity. *)
zip5={0,0,0,0,0};  a={zip5,zip5};
For[i=1, i≤2,i++,L=RandomInteger[{1,5}];rand=RandomReal[{0,1},L];For[j=1,j≤L,j++,  a[[i,j]]=rand[[j]]]];
For[i=1, i≤2,i++,a[[i]]=a[[i]]/Sum[a[[i,j]],{j,1,5}]];
For[i=1,i≤2,i++,a[[i]]=Sort[a[[i]],Greater]];  Print["a1=",a[[1]]];Print["a2=",a[[2]]];

(* The following steps calculate and print the infimum of a1 and a2.  *)

sum1=a[[1,1]]; sum2=a[[2,1]];suminf=0;
inf=zip5;For[ j=1,j≤5,j++,inf[[j]]=Min[sum1,sum2]-suminf;
If[j<5,sum1=sum1+a[[1,j+1]];sum2=sum2+a[[2,j+1]]; suminf=suminf+inf[[j]],tmp=0;]]; Print["infimum(a1,a2)=",inf];

(* The following steps calculate and print the supremum of a1 and a2.  *)

sum1=a[[1,1]]; sum2=a[[2,1]];sumsup=0;
sup=zip5;For[ j=1,j≤5,j++,sup[[j]]=Max[sum1,sum2]-sumsup;
If[j<5,sum1=sum1+a[[1,j+1]];sum2=sum2+a[[2,j+1]];sumsup=sumsup+sup[[j]],tmp=0]]; 

While[(sup-Sort[sup,Greater]).(sup-Sort[sup,Greater]) ≥ 10^(-20),
For[m=1,m≤4,m++,If[sup[[m]]<sup[[m+1]],sup[[m]]=.5*(sup[[m]]+sup[[m+1]]);sup[[m+1]]=sup[[m]],tmp=0]]];Print["supremum(a1,a2)=",sup];