Ask Your Question

Revision history [back]

Here is a one line solution using Python list comprehension

matrix(3, [dVdC.lhs().coefficient(C) for dVdC in [dVdC4, dVdC5, dVdC6] for C in [C4,C5,C6]])

From which you obtain

[     2/15*N0*l^5 + 4*E*Iz*l^3      7/30*N0*l^6 + 8*E*Iz*l^4    13/42*N0*l^7 + 12*E*Iz*l^5]
[     7/30*N0*l^6 + 8*E*Iz*l^4 44/105*N0*l^7 + 84/5*E*Iz*l^5    17/30*N0*l^8 + 26*E*Iz*l^6]
[   13/42*N0*l^7 + 12*E*Iz*l^5    17/30*N0*l^8 + 26*E*Iz*l^6   7/9*N0*l^9 + 288/7*E*Iz*l^7]