I have a 25x25 grid of a function T[x] expressed in terms of variables x and R. The output is a grid of 0s and 1s:

  Prepend, {Prepend[
    FullSimplify[Table[T[x], {x, 25}, {R, 25}]], {"R=1", "R=2", "R=3",
      "R=4", "R=5", "R=6", "R=7", "R=8", "R=9", "R=10", "R=11", 
     "R=12", "R=13", "R=14", "R=15", "R=16", "R=17", "R=18", "R=19", 
     "R=20", "R=21", "R=22", "R=23", "R=24", "R=25"}], {"", "x=1", 
    "x=2", "x=3", "x=4", "x=5", "x=6", "x=7", "x=8", "x=9", "x=10", 
    "x=11", "x=12", "x=13", "x=14", "x=15", "x=16", "x=17", "x=18", 
    "x=19", "x=20", "x=21", "x=22", "x=23", "x=24", "x=25"}}], 
 Frame -> All]

I want all instances of T[x]=1 to appear in bold, and I want a thicker line beneath the column headers and to the right of the row headers.

I can't find anything that works on this site or in the Mathematica documentation. And as a noob to Mathematica, I'd appreciate some help.

  • $\begingroup$ You can use Table[T[x], {x, 25}, {R, 25}] /. 1 -> Style[1, Bold] to make the ones bold. Moreover, look up the FrameStyle option of Grid (see the documentation of Grid, section "Options", subsection FrameStyle). $\endgroup$ Commented Apr 28, 2018 at 9:47
  • 1
    $\begingroup$ Will look into FrameStyle. I'd tried Style[1, Bold], but hadn't spotted the space after /. Working now. $\endgroup$ Commented Apr 28, 2018 at 9:56

1 Answer 1

T[x_, r_] := Mod[x + r, 5]; 
data = MapThread[Prepend, {Prepend[FullSimplify[Table[T[x, R], {x, 25}, {R, 25}]], 
 {"R=1", "R=2", "R=3", "R=4", "R=5", "R=6", "R=7", "R=8", "R=9", "R=10", "R=11",
       "R=12", "R=13", "R=14", "R=15", "R=16", "R=17", "R=18", "R=19",
       "R=20", "R=21", "R=22", "R=23", "R=24", "R=25"}],
 {"", "x=1", "x=2", "x=3", "x=4", "x=5", "x=6", "x=7", "x=8", "x=9", "x=10", 
     "x=11", "x=12", "x=13", "x=14", "x=15", "x=16", "x=17", "x=18", 
     "x=19", "x=20", "x=21", "x=22", "x=23", "x=24", "x=25"}}];

Grid[data /.  1 -> Style[1, Red, Bold], 
 Dividers -> {{2 -> {Thick, Red}}, {2 -> {Thick, Blue}}}]

enter image description here

See: Documentation >> Dividers


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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