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 - The Fusion of Science and Community**

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?

Loading...

Similar Threads - Scipy numpy array | Date |
---|---|

Importing a matrix into Numpy | Oct 3, 2017 |

Spatial Filtering 2d numpy array with a 3x3 mask | Aug 30, 2016 |

Wrong width when fitting a gaussian with SciPy | Nov 24, 2015 |

[Python] Importing csv files and creating numpy arrays | Apr 1, 2015 |

Python SciPy opinions? | Aug 9, 2009 |

**Physics Forums - The Fusion of Science and Community**