2
$\begingroup$

I have two alternative forms of a simple table, both of which have problems:

table1 = 
  TableForm[
    Table[
      {CenterDot @@ Apply[Superscript, FactorInteger[x], {1}], MoebiusMu[x]}, 
      {x, 0, 10}], 
      TableHeadings -> 
        {{"x=0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10"}, 
         {"prime factors", "μ[x]"}}]

and

table2 = 
  TableForm[
    Table[
      {Apply[Superscript, FactorInteger[x], {1}], MoebiusMu[x]}, 
      {x, 0, 10}], 
      TableHeadings -> 
        {{"x=0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10"}, 
         {"prime factors", "μ[x]"}}]

table1 fails to format the superscript properly - it writes CenterDot[...] (where ... represents a properly formatted Superscript).

table2 puts the Superscript prime factors on top of each other rather than in-line, and removes the lines that delimit the TableHeadings.

I want items in the first column to look something like $a^b.c^d$ and I also want the table to have lines delimiting the headings.

How do I achieve this?

$\endgroup$
1
$\begingroup$
table2 = TableForm[Table[{Row[Apply[Superscript, FactorInteger[x], {1}], "·"], MoebiusMu[x]},
   {x, 0, 10}], 
  TableHeadings -> {{"x=0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10"}, 
    {"prime factors", "μ[x]"}}]

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.