# Creating a Simple Table in Mathematica: Connecting Two Lists

• Shukie
In summary, the conversation discusses how to create a table using two lists, {a, b, c} and {1, 2, 3}, where the elements in the first list correspond to the elements in the second list. The solution suggested is to use the function TableForm with the lists placed inside curly brackets. The conversation also mentions the difference between a matrix and a vector in Mathematica and how to use the Join and Transpose functions to create the desired table.

## Homework Statement

I have two lists, say {a, b, c} and {1, 2, 3}. I want to place them in a table such as this

a 1
b 2
c 3

So a will correspond to 1, b to 2, etc.

## The Attempt at a Solution

I know that TableForm[{{a, 1}, {b, 2}, {c, 3}}] would give the result I need. So I need to find a way to 'connect' the elements my two lists somewhow, if that makes sense. How do I go about this?

Last edited:
Try this out:

Join[Transpose[{{a, b, c}}], Transpose[{{x, y, z}}], 2]

you need to write your list as {{a,b,c}} instead of {a,b,c}. the first one is a matrix and the second one is a vector; in mathematica they are not just the same; and you can't apply Transpose[] to a mathematica's vector (you can by writing Transpose[{a,b,c},{1}], but that does not give the desired result). You needed to find a way to 'join' the two

Last edited:

## What is a simple table in Mathematica?

A simple table in Mathematica is an organized collection of data displayed in a tabular format. It consists of rows and columns, with each row representing a set of related data and each column representing a specific variable or dimension.

## How do I create a simple table in Mathematica?

To create a simple table in Mathematica, you can use the Table function. For example, to create a table with three rows and four columns, you can use the command Table[expr, {i,3}, {j,4}], where expr is the expression you want to insert in the table.

## Can I add or remove rows and columns in a simple table in Mathematica?

Yes, you can add or remove rows and columns in a simple table in Mathematica using the Append and Delete functions. For example, to add a new row to a table, you can use the command Append[table, {new data}], where table is the name of your table and new data is the data you want to add. Similarly, to delete a row or column, you can use the Delete function and specify the row or column you want to remove.

## Can I customize the appearance of a simple table in Mathematica?

Yes, you can customize the appearance of a simple table in Mathematica using various formatting options. For example, you can change the font size and style, add borders, and color code specific cells. You can also use the Grid function to create a more visually appealing table with headers and different cell styles.

## How can I export a simple table in Mathematica to another format?

You can export a simple table in Mathematica to various formats, such as CSV, Excel, and PDF. To do so, you can use the Export function and specify the desired format in the command. For example, to export a table to CSV, you can use the command Export["table.csv", table], where table is the name of your table.

Replies
1
Views
85
Replies
1
Views
737
Replies
2
Views
900
Replies
3
Views
3K
Replies
1
Views
960
Replies
6
Views
997
Replies
3
Views
1K
Replies
1
Views
1K
Replies
5
Views
597
Replies
10
Views
1K