Ask Your Question

Revision history [back]

Another option:

sage: V = QQ^10
sage: d = 0
sage: while dim(V) > 0:
....:     for x in V:   # iterate through all elements of V
....:         if x:     # until you find a nonzero element
....:             break
....:     d += 1
....:     V = V / V.span([x])
....: 
sage: d
3

Another option:

sage: V = QQ^10
sage: d = 0
sage: while dim(V) > 0:
....:     for x in V:   # iterate through all elements of V
....:         if x:     # until you find a nonzero element
....:             break
....:     d += 1
....:     V = V / V.span([x])
....: 
sage: d
3
10