previous  next
FirstNonZero, FirstNonZeroPos
Syntax
FirstNonZero(V:VECTOR):POLY
FirstNonZeroPos(V:VECTOR):POLY
Summary
the first non-zero entry in a vector
Description
The first function returns the first non-zero entry of V.  The second
function returns the index of the first non-zero entry of V.  If either
function is handed a zero vector then an error is signalled.

Example

Use R ::= Q[x,y,z];
V := Vector(0,0,x^2+yz,0,z^2);
FirstNonZero(V);
x^2 + yz
-------------------------------
FirstNonZeroPos(V);
3
-------------------------------
V[FirstNonZeroPos(V)];
x^2 + yz
-------------------------------
See also: