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

7.10.6.5 ncratAdd

Procedure from library ncrat.lib (see ncrat_lib).

Usage:
ncrat h = ncratAdd(f, g);
f, g both of type ncrat

Return:
h = f + g

Note:
operator '+' for ncrat is overloaded
with this procedure, hence
ncrat h = f + g;
yields the same result as
ncrat h = ncratAdd(f, g);

Example:
 
LIB "ncrat.lib";
ncInit(list("x", "y", "z"));
ncrat f = ncratFromString("2*x*y");
print(f);
==> 2*x*y
ncrat g = ncratFromString("z");
print(g);
==> z
ncrat h1, h2;
h1 = ncratAdd(f, g);
print(h1);
==> 2*x*y+z
h2 = f + g;
print(h2);
==> 2*x*y+z