Hello, I want to represent Euler-Lagrange equations in a (sparse) matrix form, such that; Az=b. (in order to improve performance when solving). I know A should be diagonal block, very large, and sparse. my equations are: 1. -ψ'(Ix*Iz) + [itex]\gamma[/itex]ψ'(Ixx*Ixz + Ixz + Ixy*Iyy) - βη(ψ'(u-u1). 2. -ψ'(Iy*Iz) + [itex]\gamma[/itex]ψ'(Iyy*Iyz + Ixy*Ixz) - βη(ψ'(v-v1). η - means some kind of neighboring of u. I know it should looks something like: Az=b: where z = [u1 v1 u2 v2 ....un vn]τ (column vector). b = - [ψ'xz + βηU IxIz + βηV ... ] (Alternately) --> I'm not so sure here.. and A is very large, and saprse, of size 2*(n*n) - where n is the number of values I have. Are z and b correct ? How should A be constructed ? Thanks Matia