l=Import["/Users/troyday/Desktop/Transfer/AntigenicCut.txt","Table"]

ll=SortBy[l,First]

aa=Transpose[Append[Table[Transpose[ll][[k]],{k,2,6}],Transpose[ll][[1]]]]

data=Transpose[aa]

Example 8.1.3

data2=Drop[data,-1]

Manipulate[ListPlot[{Table[{data2[[i,k]],data2[[j,k]]},{k,1,3}],Table[{data2[[i,k]],data2[[j,k]]},{k,4,6}],Table[{data2[[i,k]],data2[[j,k]]},{k,7,8}],Table[{data2[[i,k]],data2[[j,k]]},{k,9,11}],Table[{data2[[i,k]],data2[[j,k]]},{k,12,15}],Table[{data2[[i,k]],data2[[j,k]]},{k,16,18}],Table[{data2[[i,k]],data2[[j,k]]},{k,19,23}],Table[{data2[[i,k]],data2[[j,k]]},{k,24,28}],Table[{data2[[i,k]],data2[[j,k]]},{k,29,35}]},PlotStyle->{Yellow,Blue,Red,Black,Brown,Green,Purple,Orange,Gray},PlotRange->{{0,1500},{0,1500}}],{i,{1,2,3,4,5}},{j,{1,2,3,4,5}}]

Manipulate[data2={{354,640,1163,320,554,1280,320,1109,165,905,905,80,80,80,453,52,80,160,16,20,40,40,60,10,40,40,40,80,10,10,10,10,10,10,20},{501,320,1163,640,453,640,320,640,392,905,905,640,640,1280,905,640,1280,640,291,320,320,320,392,320,160,320,320,320,120,120,160,160,160,320,210},{109,80,291,120,113,80,80,100,57,139,160,640,640,1280,226,1280,1280,1280,905,2560,640,2560,2560,1280,1280,640,1280,1280,320,640,160,320,640,320,320},{30,40,73,80,42,40,24,57,575,98,98,320,320,640,226,291,320,640,80,320,640,160,320,160,160,2560,160,2560,80,160,40,80,80,160,80},{63,40,89,160,46,57,46,46,35,89,87,226,226,160,184,135,101,226,320,80,80,160,254,160,160,40,80,40,80,160,905,905,1280,1016,905}};ListPointPlot3D[{Table[{data2[[i,k]],data2[[j,k]],data2[[l,k]]},{k,1,3}],Table[{data2[[i,k]],data2[[j,k]],data2[[l,k]]},{k,4,6}],Table[{data2[[i,k]],data2[[j,k]],data2[[l,k]]},{k,7,8}],Table[{data2[[i,k]],data2[[j,k]],data2[[l,k]]},{k,9,11}],Table[{data2[[i,k]],data2[[j,k]],data2[[l,k]]},{k,12,15}],Table[{data2[[i,k]],data2[[j,k]],data2[[l,k]]},{k,16,18}],Table[{data2[[i,k]],data2[[j,k]],data2[[l,k]]},{k,19,23}],Table[{data2[[i,k]],data2[[j,k]],data2[[l,k]]},{k,24,28}],Table[{data2[[i,k]],data2[[j,k]],data2[[l,k]]},{k,29,35}]},PlotStyle->{{Yellow,PointSize[.02]},{Blue,PointSize[.02]},{Red,PointSize[.02]},{Black,PointSize[.02]},{Brown,PointSize[.02]},{Green,PointSize[.02]},{Purple,PointSize[.02]},{Orange,PointSize[.02]},{Gray,PointSize[.02]}},PlotStyle->PointSize[.02],PlotRange->{{0,1500},{0,1500},{0,1500}},PlotLegends->{"1968","1969","1970","1971","1972","1973","1974","1975","1976"},AxesLabel->{"x axis","y axis","z axis"}],{{i,2,"Antiserum on x axis"},{1,2,3,4,5}},{{j,1,"Antiserum on y axis"},{1,2,3,4,5}},{{l,5,"Antiserum on z axis"},{1,2,3,4,5}}]

data1=Table[Log[2,((Max[data[[k]]])/(data[[k]]))],{k,1,5}]//N

Manipulate[data1={{1.8543225448043648`,1.`,0.13829271341414398`,2.`,1.208185928838174`,0.`,2.`,0.20688444472565237`,2.955605880641546`,0.5001541129167946`,0.5001541129167946`,4.`,4.`,4.`,1.4985608548411273`,4.62148837674627`,4.`,3.`,6.321928094887362`,6.`,5.`,5.`,4.415037499278843`,7.`,5.`,5.`,5.`,4.`,7.`,7.`,7.`,7.`,7.`,7.`,6.`},{1.353261301692154`,2.`,0.13829271341414398`,1.`,1.4985608548411273`,1.`,2.`,1.`,1.7072182507721543`,0.5001541129167946`,0.5001541129167946`,1.`,1.`,0.`,0.5001541129167946`,1.`,0.`,1.`,2.1370527519790787`,2.`,2.`,2.`,1.7072182507721543`,2.`,3.`,2.`,2.`,2.`,3.415037499278844`,3.415037499278844`,3.`,3.`,3.`,2.`,2.6076825772212398`},{4.553743770110436`,5.`,3.1370527519790787`,4.415037499278843`,4.501749132472174`,5.`,5.`,4.678071905112637`,5.4890380807226204`,4.202987022163855`,4.`,2.`,2.`,1.`,3.501749132472175`,1.`,1.`,1.`,1.5001541129167946`,0.`,2.`,0.`,0.`,1.`,1.`,2.`,1.`,1.`,3.`,2.`,4.`,3.`,2.`,3.`,3.`},{6.415037499278843`,6.`,5.132103536007345`,5.`,5.929610672108603`,6.`,6.7369655941662066`,5.4890380807226204`,2.1545099490556248`,4.707218250772154`,4.707218250772154`,3.`,3.`,2.`,3.501749132472175`,3.1370527519790787`,3.`,2.`,5.`,3.`,2.`,4.`,3.`,4.`,4.`,0.`,4.`,0.`,5.`,4.`,6.`,5.`,5.`,4.`,5.`},{4.344648171387446`,5.`,3.8461946639209645`,3.`,4.79836613883035`,4.4890380807226204`,4.79836613883035`,4.79836613883035`,5.192645077942396`,3.8461946639209645`,3.878984599038634`,2.501749132472175`,2.501749132472175`,3.`,2.798366138830349`,3.245112497836531`,3.663716612135568`,2.501749132472175`,2.`,4.`,4.`,3.`,2.3332434081151963`,3.`,3.`,5.`,4.`,5.`,4.`,3.`,0.5001541129167946`,0.5001541129167946`,0.`,0.3332434081151965`,0.5001541129167946`}};ListPointPlot3D[{Table[{data1[[i,k]],data1[[j,k]],data1[[l,k]]},{k,1,3}],Table[{data1[[i,k]],data1[[j,k]],data1[[l,k]]},{k,4,6}],Table[{data1[[i,k]],data1[[j,k]],data1[[l,k]]},{k,7,8}],Table[{data1[[i,k]],data1[[j,k]],data1[[l,k]]},{k,9,11}],Table[{data1[[i,k]],data1[[j,k]],data1[[l,k]]},{k,12,15}],Table[{data1[[i,k]],data1[[j,k]],data1[[l,k]]},{k,16,18}],Table[{data1[[i,k]],data1[[j,k]],data1[[l,k]]},{k,19,23}],Table[{data1[[i,k]],data1[[j,k]],data1[[l,k]]},{k,24,28}],Table[{data1[[i,k]],data1[[j,k]],data1[[l,k]]},{k,29,35}]},PlotStyle->{{Yellow,PointSize[.02]},{Blue,PointSize[.02]},{Red,PointSize[.02]},{Black,PointSize[.02]},{Brown,PointSize[.02]},{Green,PointSize[.02]},{Purple,PointSize[.02]},{Orange,PointSize[.02]},{Gray,PointSize[.02]}},PlotStyle->PointSize[.02],PlotRange->{{0,7},{0,7},{0,7}},PlotLegends->{"1968","1969","1970","1971","1972","1973","1974","1975","1976"},AxesLabel->{"x axis","y axis","z axis"}],{{i,2,"Antiserum on x axis"},{1,2,3,4,5}},{{j,1,"Antiserum on y axis"},{1,2,3,4,5}},{{l,5,"Antiserum on z axis"},{1,2,3,4,5}}]

data1=Table[Log[2,((Max[data[[k]]])/(data[[k]]))],{k,1,5}]

MatrixForm[data2]
MatrixForm[data1]

fitdata=Transpose[data1]

FIGURE

Solve[1.85==Sqrt[(((-2.714498518443727`-a))^2)+(((2.9996347219645134-b))^2)],a]

{{a->4.2582467119291536`*^-24 (-6.374685879141917`*^23-1.` (Sqrt[-3.0747319530100352`*^47+3.30854258002989`*^47 b-5.514909125106852`*^46 (b^2)]))},{a->4.2582467119291536`*^-24 (-6.374685879141917`*^23+(Sqrt[-3.0747319530100352`*^47+3.30854258002989`*^47 b-5.514909125106852`*^46 (b^2)]))}}/.b->2.5

{{a->-1.` (Sqrt[3.4225` -1.` (b^2)])},{a->(Sqrt[3.4225` -1.` (b^2)])}}/.b->1

Graphics[{Dashed,Circle[{-2.714498518443727,2.9996347219645134},1.85]}]
ListPlot[{{-0.9332447059264193`,2.5}},PlotStyle->{Yellow},PlotRange->{{-7,7},{-7,7}},Axes->False,AspectRatio->1]
ListPlot[{{-2.714498518443727,2.9996347219645134}},PlotMarkers->{"1","2","3","4","5"},PlotStyle->{{Black,20},{Black,Larger},{Black,Larger},{Black,Larger},{Black,Larger}},PlotRange->{{-7,7},{-7,7}},Axes->False,AspectRatio->1]
Show[%,%%,%%%]

Export["1.eps",%350,"EPS"]

FIGURE

Solve[1.35==Sqrt[(((-0.9332447059264193`-a))^2)+(((2.5-b))^2)],a]

{{a->1.1824973840134482`*^-16 (-7.892150279089377`*^15-1.` (Sqrt[-3.166344704206031`*^32+3.5757704169463945`*^32 b-7.151540833892789`*^31 (b^2)]))},{a->1.1824973840134482`*^-16 (-7.892150279089377`*^15+(Sqrt[-3.166344704206031`*^32+3.5757704169463945`*^32 b-7.151540833892789`*^31 (b^2)]))}}/.b->2

EuclideanDistance[{-0.9332447059264193`,2.5},{2.1872383263248656`,2}]

ListPlot[{{-0.9332447059264193`,2.5}},PlotStyle->{Yellow},PlotRange->{{-7,7},{-7,7}},Axes->False,AspectRatio->1]
ListPlot[{{{-2.714498518443727,2.9996347219645134}},{{0.32074891447202686`,2}}},PlotMarkers->{"1","2","3","4","5"},PlotStyle->{{Black,20},{Black,Larger},{Black,Larger},{Black,Larger},{Black,Larger}},PlotRange->{{-4,4},{-4,4}},Axes->False,AspectRatio->1]
Show[%,%%]

Export["2.eps",%375,"EPS"]

FIGURE

Solve[4.34==Sqrt[(((-0.9332447059264193-α))^2)+(((2.5-b))^2)],α]

{{α->1.2239818971491803`*^-16 (-7.624661019089193`*^15-1.` (Sqrt[8.400863642230204`*^32+3.3374903231590885`*^32 b-6.674980646318177`*^31 (b^2)]))},{α->1.2239818971491803`*^-16 (-7.624661019089193`*^15+(Sqrt[8.400863642230204`*^32+3.3374903231590885`*^32 b-6.674980646318177`*^31 (b^2)]))}}/.b->2

ListPlot[{{-0.9332447059264193`,2.5}},PlotStyle->{Yellow},PlotRange->{{-7,7},{-7,7}},Axes->False,AspectRatio->1]
ListPlot[{{{-2.714498518443727,2.9996347219645134}},{{0.32074891447202686`,2}},{{1.9740736460949067`,-1}},{{-4.960203856451789`,-2.5}},{{3.3778572413719736`,2}}},PlotMarkers->{"1","2","3","4","5"},PlotStyle->{{Black,20},{Black,Larger},{Black,Larger},{Black,Larger},{Black,Larger}},PlotRange->{{-7,7},{-7,7}},Axes->False,AspectRatio->1]
Show[%,%%]

Export["3.eps",%443,"EPS"]

EuclideanDistance[{0.1845771057520357`,-0.9041737586472306`},{1.4302634322825833`,0.46942652621054026}]

w[1]->-2.714498518443727`,z[1]->2.9996347219645134`,w[2]->-0.7347578591147831`,z[2]->0.834086752198103`,w[3]->0.040180486527589265`,z[3]->-1.5551021583836087`,w[4]->-2.4157803111545535`,z[4]->-2.4796897735666854`,w[5]->2.382742886629809`,z[5]->0.8027345603377469`

i=strain
j=antiserum

STRAIN=35;
ANTISERA=5;
opt=NMinimize[Sum[(((Sqrt[(((x[i]-w[j]))^2)+(((y[i]-z[j]))^2)]-fitdata[[i,j]]))^2),{i,1,STRAIN},{j,1,ANTISERA}],Flatten[{Table[{x[i],y[i]},{i,1,STRAIN}],Table[{w[j],z[j]},{j,1,ANTISERA}]}],Method->"DifferentialEvolution"]

a=Table[{{w[j],z[j]}},{j,1,5}]/.opt[[2]]
list68=Table[{x[i],y[i]},{i,1,3}]/.opt[[2]]
list69=Table[{x[i],y[i]},{i,4,6}]/.opt[[2]]
list70=Table[{x[i],y[i]},{i,7,8}]/.opt[[2]]
list71=Table[{x[i],y[i]},{i,9,11}]/.opt[[2]]
list72=Table[{x[i],y[i]},{i,12,15}]/.opt[[2]]
list73=Table[{x[i],y[i]},{i,16,18}]/.opt[[2]]
list74=Table[{x[i],y[i]},{i,19,23}]/.opt[[2]]
list75=Table[{x[i],y[i]},{i,24,28}]/.opt[[2]]
list76=Table[{x[i],y[i]},{i,29,35}]/.opt[[2]]

ListPlot[{list68,list69,list70,list71,list72,list73,list74,list75,list76},PlotStyle->{Yellow,Blue,Red,Black,Brown,Green,Purple,Orange,Gray},PlotRange->{{-4,4},{-4,4}},Axes->False,PlotLegends->{"1968","1969","1970","1971","1972","1973","1974","1975","1976"}]
ListPlot[a,PlotMarkers->{"1","2","3","4","5"},PlotStyle->{{Black,20},{Black,Larger},{Black,Larger},{Black,Larger},{Black,Larger}},PlotRange->{{-4,4},{-4,4}},Axes->False]
Show[%,%%]

Export["4.eps",%453,"EPS"]