Adding coordinates to a matrix

In summary, the conversation discusses how to merge a matrix and a vector to create a new matrix with tuples of the form (scalar, element). The language used is Mathematica and various methods for creating arrays in Mathematica are provided.
  • #1
member 428835
Hi PF!

Given a matrix and vector $$
\begin{bmatrix}
a & b & c\\
d & e & f
\end{bmatrix},\\
\begin{bmatrix}
1\\
2
\end{bmatrix}
$$

how can I merge the two to have something like this

$$
\begin{bmatrix}
(1,a) & (1,b) & (1,c)\\
(2,d) & (2,e) & (2,f)
\end{bmatrix}
$$
 
Physics news on Phys.org
  • #2
Python has tulles and lists of lists that look like matrices. A tuple is basically an ordered collection of different items (123, 456, ‘name’).

What language are you thinking about?
 
  • #3
Something like

Table[{B[[k]], A[[k, l]]}, {k, 1, 2}, {l, 1, 3}]

where B and A are your matrices.
jedishrfu said:
What language are you thinking about?
The thread tag is "Mathematica".
 
  • Like
Likes member 428835 and jedishrfu
  • #4
Okay I didn’t notice that.

Here’s some Mathematica array creation methods.

https://reference.wolfram.com/language/ref/Array.html
The last one looks like it constructs something what the OP wants.

246823
 

Related to Adding coordinates to a matrix

1. Why do we need to add coordinates to a matrix?

Adding coordinates to a matrix allows us to identify and locate specific elements within the matrix. This is especially useful when dealing with large data sets or when performing mathematical operations on the matrix.

2. How do we add coordinates to a matrix?

To add coordinates to a matrix, we use the row-column notation, also known as the (x,y) notation. The first number represents the row number and the second number represents the column number. For example, in a 3x3 matrix, the element in the second row and third column would be denoted as (2,3).

3. Can we add coordinates to any type of matrix?

Yes, coordinates can be added to any type of matrix, including numeric, text, and logical matrices. However, it is most commonly used with numeric matrices for data analysis and mathematical operations.

4. What are the benefits of adding coordinates to a matrix?

Adding coordinates to a matrix allows us to easily locate and manipulate specific elements within the matrix. This can help with data analysis, visualization, and performing mathematical operations on the matrix.

5. Is there a specific format for adding coordinates to a matrix?

No, there is no specific format for adding coordinates to a matrix. As long as the notation is consistent and follows the row-column format, any type of notation can be used. However, it is recommended to use the (x,y) notation for consistency and clarity.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
Replies
24
Views
1K
  • Precalculus Mathematics Homework Help
Replies
9
Views
892
  • Linear and Abstract Algebra
Replies
10
Views
487
  • Differential Equations
Replies
2
Views
2K
  • Calculus and Beyond Homework Help
Replies
1
Views
282
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
2K
Replies
2
Views
544
Replies
12
Views
1K
  • Linear and Abstract Algebra
Replies
4
Views
2K
Back
Top