# Revision history [back]

### Sorted list of symbolic eigenvalues (and corresponding eigenvectors)

Is there a way to obtain a sorted list of eigenvalues when they are computed symbolically (in SR). Particularly knowing that in specific points, they can switch order.

So far, what I have is (assuming $R^3$):

def sorted_eval(m, x, y, z, order=0): _ev = m.eigenvalues() _ev = numpy.array(ev.subs(x=x, y=y, z=z)) _ev.sort() return _ev[order]

But then if I want to perform a contour plot: x, y, z = var('x y z') p = vector(x,y,z) f= p * p h = f.hessian() contour(lambda x, y: sorted_eval(h, x, y, 0, 0), (x, -1.5, 1.5), (y, -1.5, 1.5))

It takes a long time Thanks D

 2 No.2 Revision kcrisman 11847 ●36 ●117 ●236

### Sorted list of symbolic eigenvalues (and corresponding eigenvectors)

Is there a way to obtain a sorted list of eigenvalues when they are computed symbolically (in SR). Particularly knowing that in specific points, they can switch order.

So far, what I have is (assuming $R^3$):

def sorted_eval(m, x, y, z, order=0):
_ev = m.eigenvalues()
_ev = numpy.array(ev.subs(x=x, y=y, z=z))
_ev.sort()
return _ev[order]_ev[order]


But then if I want to perform a contour plot: plot:

x, y, z = var('x y z')
p = vector(x,y,z)
f= p * p
h = f.hessian()
contour(lambda x, y: sorted_eval(h, x, y, 0, 0), (x, -1.5, 1.5), (y, -1.5, 1.5))1.5))


It takes a long time Thanks D

 3 No.3 Revision kcrisman 11847 ●36 ●117 ●236

### Sorted list of symbolic eigenvalues (and corresponding eigenvectors)

Is there a way to obtain a sorted list of eigenvalues when they are computed symbolically (in SR). Particularly knowing that in specific points, they can switch order.

So far, what I have is (assuming $R^3$):

def sorted_eval(m, x, y, z, order=0):
_ev = m.eigenvalues()
_ev = numpy.array(ev.subs(x=x, y=y, z=z))
_ev.sort()
return _ev[order]


But then if I want to perform a contour plot:

x, y, z = var('x y z')
p = vector(x,y,z)
f= vector([x,y,z])
f = p * p
h = f.hessian()
contour(lambda x, y: sorted_eval(h, x, y, 0, 0), (x, -1.5, 1.5), (y, -1.5, 1.5))


It takes a long time Thanks D

 4 retagged FrédéricC 2296 ●3 ●27 ●46

### Sorted list of symbolic eigenvalues (and corresponding eigenvectors)

Is there a way to obtain a sorted list of eigenvalues when they are computed symbolically (in SR). Particularly knowing that in specific points, they can switch order.

So far, what I have is (assuming $R^3$):

def sorted_eval(m, x, y, z, order=0):
_ev = m.eigenvalues()
_ev = numpy.array(ev.subs(x=x, y=y, z=z))
_ev.sort()
return _ev[order]


But then if I want to perform a contour plot:

x, y, z = var('x y z')
p = vector([x,y,z])
f = p * p
h = f.hessian()
contour(lambda x, y: sorted_eval(h, x, y, 0, 0), (x, -1.5, 1.5), (y, -1.5, 1.5))


It takes a long time Thanks D