As I suppose, you want to compute the sum of all generated values.
The first, "classic" and not very efficient method is to
create a list, append each generaed element to this list
and then compute the sum of this list:
f = np.arange(1,2)
tbl = []
for i in f:
for m in np.arange(1,6):
x = ((4.6)*(m*2)*(5)**2)*(i)/62
print(f'{i}, {m}: {x:.4f}')
tbl.append(x)
print(sum(tbl))
The result is:
1, 1: 3.7097
1, 2: 7.4194
1, 3: 11.1290
1, 4: 14.8387
1, 5: 18.5484
55.64516129032258
But a more efficient and numpythonic option is to use np.fromfunction
method to generate the whole Numpy array in one go and then compute its
sum:
arr = np.fromfunction(lambda i, m: 4.6 * m * 2 * 5 ** 2 * i / 62, (2, 6))
print(arr)
print(arr.sum())
Note that I removed unncessary parentheses from your code.
Your function can actually be yet more simplified to:
lambda i, m: i * m * 9.2 * 5 ** 2 / 62
This time the result is:
[[ 0. 0. 0. 0. 0. 0. ]
[ 0. 3.70967742 7.41935484 11.12903226 14.83870968 18.5483871 ]]
55.64516129032258
Edit
From one of other answers I see that you may be interested in a
sequence of cumulative sums of your values.
After you generate arr, you can generate such a sequence with:
np.cumsum(arr[1:,1:])
even for more than one rows (values of i). Test it e.g. for shape
of (3, 6)
.