> > J = Matrix(6,6,lambda i,j:0) # This is for the Jacobian
vars = [x11,x12,x13,x22,x23,x33] > I'm not totally clear what you're doing here > > In [38]: for i in [0,1,2]: > ....: for j in [0,1,2]: > ....: k = 3*i+j > ....: for l in [0,1,2,3,4,5]: > ....: J[k,l] = diff(Y[i,j], vars[l]) > ....: > --------------------------------------------------------------------------- > IndexError Traceback (most recent call last) > <ipython-input-38-46a5a73fca3d> in <module>() > 3 k = 3*i+j > 4 for l in [0,1,2,3,4,5]: > ----> 5 J[k,l] = diff(Y[i,j], vars[l]) > In this line Y is of shape 3, 3 but i goes from 0 to 5. So you're going outside the bounds of the Matrix. You're asking for the 3rd, 4th, and 5th, row of a 3x3 matrix. -- You received this message because you are subscribed to the Google Groups "sympy" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/sympy?hl=en.
