1
$\begingroup$

I am exploring colossally abundant numbers; in particular the set of specific 'critical epsilon values'. I table the function DivisorSigma[1, n]/n^(1 + \[Epsilon]) against n and the first few critical values of \[Epsilon] thus:

colossalTable1 = TableForm[
  Table[N[DivisorSigma[1, n]/n^(1 + \[Epsilon])], 
   {n, 1, 60}, {\[Epsilon], {Log[3/2]/Log[2], 
    Log[4/3]/Log[3], Log[7/6]/Log[2], 
    Log[6/5]/Log[5], Log[15/14]/Log[2], 
    Log[13/12]/Log[3], Log[31/30]/Log[2]}}]]
    //TableForm

What I would like is for the maximum value(s) in each column to be automatically styled Bold. (It needs to be an automatic process, because I may choose to expand the extent of the rows and columns.)

Suggestions?

$\endgroup$
1
$\begingroup$

I would define the table without TableForm like so.

colossalTable1 = Table[N[DivisorSigma[1, n]/n^(1 + \[Epsilon])], {n, 1, 10},
{\[Epsilon],{Log[3/2]/Log[2], Log[4/3]/Log[3],Log[7/6]/Log[2],Log[6/5]/Log[5],
 Log[15/14]/Log[2],Log[13/12]/Log[3], Log[31/30]/Log[2]}
}];

Then find the column maximums and show them.

bold = If[MemberQ[Max /@ Transpose[colossalTable1], #1],Text[Style[#1, Bold]], #1] &;
TableForm[Map[bold, colossalTable1, {2}]]

enter image description here

If you don't want to repeat previous column maximums use this.

max = Max /@ Transpose[colossalTable1];
maxpos = Flatten[Table[Append[#, i] & /@ 
Position[colossalTable1[[All, i]], max[[i]]], {i, 1, Length@max}],1];
TableForm[MapAt[Text[Style[#, Bold]] &, colossalTable1, maxpos]]

enter image description here

$\endgroup$
1
$\begingroup$

Using color to make the highlighting more obvious:

Clear["Global`*"]

highlight[m_?MatrixQ] := Module[
  {tr = Transpose@m, max, htr},
  htr = (max = Max@#;
      ReplacePart[#,
       Thread[
        Position[#, max] :>
         Style[max, Red, Bold]]]) & /@ tr;
  Transpose@htr]

(colossalTable1 = Table[
    N[DivisorSigma[1, n]/n^(1 + ϵ)],
    {n, 1, 60},
    {ϵ, {Log[3/2]/Log[2], Log[4/3]/Log[3],
      Log[7/6]/Log[2], Log[6/5]/Log[5],
      Log[15/14]/Log[2], Log[13/12]/Log[3],
      Log[31/30]/Log[2]}}]);

colossalTable1 // highlight // MatrixForm

enter image description here

$\endgroup$
0
$\begingroup$

I interpreted the spec a little differently than @PlatoManiac

colossalTable1 = Table[N[DivisorSigma[1, n]/n^(1 + \[Epsilon])],
    {n, 1, 60},
    {\[Epsilon], {Log[3/2]/Log[2], Log[4/3]/Log[3],
      Log[7/6]/Log[2], Log[6/5]/Log[5],
      Log[15/14]/Log[2], Log[13/12]/Log[3],
      Log[31/30]/Log[2]}}
    ];"";
boldMax[l0_] := Block[
  {m},
  m = Max[l0];
  (Text /@ l0) /. {Text[m] -> Text[Style[m, Bold]]}
  ]
Transpose[boldMax /@ Transpose[colossalTable1]] // TableForm

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.