Group Abstract Group Abstract

Message Boards Message Boards

0
|
7.6K Views
|
2 Replies
|
2 Total Likes
View groups...
Share
Share this post:

Create 3D array from a 2D matrix?

Posted 8 years ago
POSTED BY: mohamed alzenad
2 Replies

d2 = {{3, 2}, {4, 1}, {5, 6}}

a = {18, 32, 50}

d3 = Table[{d2[[n, 1]], a[[n]], d2[[n, 2]]}, {n, 1, 3}]

This will yield

3 18 2

4 32 1

5 50 6

POSTED BY: Gustavo Gordillo
In[1]:= d = {{3, 2}, {4, 1}, {5, 6}};

In[2]:= d /. {a_, b_} -> {a, 2*a^2, b}

Out[2]= {{3, 18, 2}, {4, 32, 1}, {5, 50, 6}}
POSTED BY: Frank Kampas
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard