Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Matrix Problem
#2
I am not sure what do you exactly want and what is shape of q_tri. If its just array with (1, 5) shape, then perhaps adding sum into your for loop will do it.
Output:
In [2]: q_tri = np.arange(5).reshape(1,-1) In [3]: q_tri Out[3]: array([[0, 1, 2, 3, 4]]) In [4]: Xn = [] ...: L = 3 ...: for a in range(5): ...: Xn.append(L * np.sum(np.sin(q_tri[:,1:a+1]), axis=1)) ...: In [5]: Xn Out[5]: [array([ 0.]), array([ 2.52441295]), array([ 5.25230523]), array([ 5.67566526]), array([ 3.40525777])]
Reply


Messages In This Thread
Matrix Problem - by Salito - Apr-05-2017, 11:28 AM
RE: Matrix Problem - by zivoni - Apr-05-2017, 02:02 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  define a diagonal matrix from a matrix amalalaoui 1 2,347 May-15-2019, 01:12 PM
Last Post: ichabod801

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020