- #1
Dunhausen
- 30
- 0
I want to make a matrix of values as so:
F(0,0) . . . F(1,n)
.
.
.
F(n,1) . . . F(n,n)
I could of course do it like this
But I am curious if there is a more elegant way to build an array with the rule Element i,j = F(i,j) ?
When working with 1-d arrays, I am accustomed to their savvy nature eliminating all need for 'for loops' in my code.
F(0,0) . . . F(1,n)
.
.
.
F(n,1) . . . F(n,n)
I could of course do it like this
Code:
list=[]
for i in range(0,n):
for j in range(0,n):
list.append(F(i,j))
a=array(list)
a.reshape(n,n)
But I am curious if there is a more elegant way to build an array with the rule Element i,j = F(i,j) ?
When working with 1-d arrays, I am accustomed to their savvy nature eliminating all need for 'for loops' in my code.
Last edited: