# Extremal Rays of a Cone

Can I use Sage to compute the subspace of a vector space that lies in non-negative real Euclidean space?

For example,

If I compute the nullspace of the matrix,
A =
[ [ 1 0 0 -1 0]
[-1 1 0 0 1]
[ 0 -1 1 0 0]
[ 0 0 -1 1 -1] ]

I get,
[1,1,1,1,0],[0,−1,−1,0,1]
as basis. Now I would like to restrict the solution space to only vectors with non-negative entries. I believe the two basis vectors I am looking for are,
[1,1,1,1,0],[1,0,0,1,1].

My program is written in Python, but I am not sure there is anything written for this sort of problem. Using the simplex method of linear programming (objective function set to zero) only spits out a single solution vector which seems to be the sum of the two I want. I ask here because I see some classes for cones and methods that gives the extremal rays, but it seems I already have to know the extremal rays to use that class.

edit retag close merge delete

Sort by » oldest newest most voted Something like that

sage: P = Polyhedron(rays=[(1,0),(0,1)])
sage: P.intersection(Polyhedron(eqns=[[0,1,-1]]))
A 1-dimensional polyhedron in QQ^2 defined as the convex hull of 1 vertex and 1 ray

more