Wednesday 15 July 2015

matrix - Sigma Notation in Python -


I am trying to create a sigma yoga in Python.

I have 100 to 100 matrix (made with Numpy) and I have a list of 100 values. My matrix is ​​variable A, and my list has a variable network.

This amount should look like

  hi = sigma ((a [i] [j]) * network [j])   

In the matrix, I and J special value, and refers to the value in the network list in Jammu.

So, if I want h67, then the sum will be:

  (A [67] [67] * network [67]) + (A [67] 66] * network [66]) + (A [67] [65 * network [65]) + ... (A [67] [0] * network [0]).   

My code is as follows, but I do not think this is correct.

  def new_sum (i, j): hi = 0 hi + salt (i [i] [j] * network [j]) Hi   

What should I do?

Did you try to do something instead of using the Numpy.sum () function?

  def new_sum (i, j): hi = 0 in category N (J + 1): hi + = a [i] [n] * network [n] return hi   

The numerical yoga () function is just a case of the parameter you are giving to all the elements in a array, back in an array and there is no array to sum it. So you are returning the sum of an element: this element

No comments:

Post a Comment