I want to make a matrix of values as so:(adsbygoogle = window.adsbygoogle || []).push({});

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) ?Code (Text):

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)

When working with 1-d arrays, I am accustomed to their savvy nature eliminating all need for 'for loops' in my code.

**Physics Forums | Science Articles, Homework Help, Discussion**

Dismiss Notice

Join Physics Forums Today!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# Scipy/numpy 2D array: how to define with a function?

**Physics Forums | Science Articles, Homework Help, Discussion**