Ask Your Question

Revision history [back]

Printing (large) symbolic matrices

I am interested in calculating analytical Hessian for multivariable functions (up to several hundred variables). My end game is solving this analytical Hessian against numerical ones.

I have successfully set up toy models for functions with a few variables like so:

k = var('k')
l = var('l')
h(x1, y1, z1, x2, y2, z2, x3, y3) = k * (sqrt((x2 - x1)^2 + (y2 - y1)^2 + (z2 - z2)^2) - l)^2
H=f.diff(2)
print H(x1=0., y1=0., z1=0., x2=1., y2=1., z2=1.0)

However, trying it on a more complex function yields the following output when printing the symbolic matrix (I could include the function definition, but it is rather long ...):

27 x 27 dense matrix over Symbolic Ring

Are there intrinsic limitations to displaying such matrices, or am I just not calling the appropriate function for outputting it ?