1
$\begingroup$

Bug introduced in 12.3.1 or earlier and persisting through 13.2.0 or later.


Consider this line of code and its result:

TableForm[{{a, b}, {c, d}}, TableHeadings -> {None, {1, 2}}] 

table-form of a list

As you see, when I assign the output of TableForm to a variable, it is saved as a List. But when I restart the kernel by executing Quit and run the second line, it returns:

{None,OutputFormsDump`HeadedColumns}[{{1,2},{a,b},{c,d}}] 

So it seems that you have to execute a TableForm command somewhere in your code before assigning a list in table-from! Currently, I use a rather ugly hack like this:

table-form fix

which checks the Depth of a simple table before executing the assignment. If tables are not interpreted as list, then it prints a temporary TableForm and after that, all table inputs will behave as lists.

Why does this happen? Is this a feature or a ?

$\endgroup$
5
  • $\begingroup$ t = {{a, b}, {c, d}} and x = TableForm[t, TableHeadings -> {None, {1, 2}}] . The *Form functions are for display only and their outputs cannot be used in subsequent computation. For computation, evaluate and use t. $\endgroup$ Commented Nov 17, 2021 at 15:34
  • $\begingroup$ I already said what has "worked" for me @Bill. The question is something else. $\endgroup$ Commented Nov 17, 2021 at 15:41
  • 1
    $\begingroup$ @Syed - TableForm is for display and interpretation. Evaluate TableForm[{{a, b}, {c, d}}] in a notebook and it displays nicely, then in a new cell evauate InputForm[%] and you see the TableForm is interpreted as the underlying matrix. $\endgroup$ Commented Nov 17, 2021 at 15:58
  • $\begingroup$ This certainly seems like a bug to me $\endgroup$ Commented Nov 17, 2021 at 15:58
  • $\begingroup$ @JasonB. Thanks for the correction. I assumed (incorrectly) that it worked like MatrixForm. $\endgroup$ Commented Nov 17, 2021 at 16:01

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.