Home Online Manual
Top
Back: ncrepAdd
Forward: ncrepMultiply
FastBack:
FastForward:
Up: ncrat_lib
Top: Singular Manual
Contents: Table of Contents
Index: Index
About: About this document

7.10.6.17 ncrepSubstract

Procedure from library ncrat.lib (see ncrat_lib).

Usage:
ncrep s = ncrepSubstract(q, r);
q, r both of type ncrep

Return:
representation s of h = f - g
if q, r are representations of f, g

Note:
operator '-' for ncrep is overloaded
with this procedure, hence
ncrep s = q - r;
yields the same result as
ncrep s = ncrepSubstract(q, r);

Example:
 
LIB "ncrat.lib";
ncInit(list("x", "y", "z"));
ncrat f = ncratFromString("x");
ncrat g = ncratFromString("y");
ncrep q = ncrepGet(f);
ncrep r = ncrepGet(g);
ncrep s1, s2;
s1 = ncrepSubstract(q, r);
print(s1);
==> lvec=
==> 0,1,0,1
==> 
==> mat=
==> x, -1,0, 0,
==> -1,0, 0, 0,
==> 0, 0, -y,1,
==> 0, 0, 1, 0 
==> 
==> rvec=
==> 0,
==> 1,
==> 0,
==> 1 
s2 = q - r;
print(s2);
==> lvec=
==> 0,1,0,1
==> 
==> mat=
==> x, -1,0, 0,
==> -1,0, 0, 0,
==> 0, 0, -y,1,
==> 0, 0, 1, 0 
==> 
==> rvec=
==> 0,
==> 1,
==> 0,
==> 1