Difference between revisions of "ApCoCoA-1:NC.Add"

From ApCoCoAWiki
(New page: <command> <title>Gbmr.MRAdd</title> <short_description> Addition of two polynomials over a monoid ring. </short_description> <syntax> Gbmr.MRAdd(X:STRING, Ordering:STRING, R:LIST, F1:LIST,...)
 
Line 1: Line 1:
 
<command>
 
<command>
<title>Gbmr.MRAdd</title>
+
<title>NC.Add</title>
 
<short_description>
 
<short_description>
Addition of two polynomials over a monoid ring.
+
Addition of two polynomials over a free associative K-algebra.
 
</short_description>
 
</short_description>
 
<syntax>
 
<syntax>
Gbmr.MRAdd(X:STRING, Ordering:STRING, R:LIST, F1:LIST, F2:LIST):LIST
+
NC.Add(F1:LIST, F2:LIST):LIST
 
</syntax>
 
</syntax>
 
<description>
 
<description>
 
<em>Please note:</em> The function(s) explained on this page is/are using the <em>ApCoCoAServer</em>. You will have to start the ApCoCoAServer in order to use it/them.
 
<em>Please note:</em> The function(s) explained on this page is/are using the <em>ApCoCoAServer</em>. You will have to start the ApCoCoAServer in order to use it/them.
 
<itemize>
 
<itemize>
<item>@param <em>X:</em> an finite set of letters. It is of STRING type. Notice that every letter in <tt>X</tt> MUST appear only once.The order of letters in <tt>X</tt> is very important, since it induces a term ordering.</item>
+
<item>Before calling the function, please set ring environment coefficient field (<tt>K</tt>), alphabet (<tt>X</tt>) and ordering through the functions NC.SetFp(P) (or NC.UnsetFp()), NC.SetX(X) and NC.SetOrdering(Ordering) respectively. Default coefficient field is Q. Default ordering is length-lexicographic ordering (<quotes>LLEX</quotes>). For more information, please check the relevant functions.</item>
<item>@param <em>Ordering:</em> a term ordering induced by the order of letters in <tt>X</tt>. It is represented as a STRING, which is a shortened-form of a name of corresponding term ordering. Notice that <quotes>LLEX</quotes> (length-lexicographic ordering) and <quotes>ELIM</quotes> (elimination ordering) are the only orderings supported currently.</item>
+
<item>@param <em>F1</em> left operand of addition operator. It is a polynomial in <tt>K&lt;X&gt;</tt>. Each polynomial is represented as a LIST of LISTs, which are pairs of form <tt>[c, w]</tt> where <tt>c</tt> is in <tt>K</tt> and <tt>w</tt> is a word in <tt>X*</tt>. For example, polynomial <tt>F:=xy-y+1</tt> is represented as <tt>F:=[[1,<quotes>xy</quotes>], [-1, <quotes>y</quotes>], [1,<quotes></quotes>]]</tt>. Zero polynomial is represented as an empty LIST <tt>[]</tt>.</item>
<item>@param <em>R:</em> a finite set of relations and it is of LIST type. Each element in <tt>R</tt> has form <tt>[w_{l}, w_{r}]</tt>, where w_{l} and w_{r} are terms in M. Each term is represented as a STRING. For example, xy^2x is represented as <quotes>xyyx</quotes>, identity element is represented as an empty STRING <quotes></quotes>, and relation (yx, xy) is represented as <tt>[<quotes>yx</quotes>, <quotes>xy</quotes>]</tt>.</item>
+
<item>@param <em>F2</em> right operand of addition operator. It is a polynomial in <tt>K&lt;X&gt;</tt>.</item>
<item>@param <em>F1, F2:</em> two polynomials, where are left and right operands of addition respectively. Each polynomial is represented as a LIST of LISTs, which are pairs of form <tt>[a_{i}, w_{i}]</tt>. For example, polynomial <tt>F:=xy-y+1</tt> is represented as <tt>F:=[[1,<quotes>xy</quotes>], [-1, <quotes>y</quotes>], [1,<quotes></quotes>]]</tt>. Zero polynomial is represented as an empty LIST <tt>[]</tt>.</item>
 
 
<item>@return: a LIST which represents a polynomial equal to <tt>F1+F2</tt>.</item>
 
<item>@return: a LIST which represents a polynomial equal to <tt>F1+F2</tt>.</item>
 
</itemize>
 
</itemize>
 
<example>
 
<example>
X := <quotes>abc</quotes>;
+
NC.SetX(<quotes>abc</quotes>);
Ordering := <quotes>LLEX</quotes>;
+
NC.SetOrdering(<quotes>ELIM</quotes>);
Relations := [[<quotes>aa</quotes>,<quotes></quotes>], [<quotes>bb</quotes>,<quotes></quotes>], [<quotes>ab</quotes>,<quotes>c</quotes>], [<quotes>ac</quotes>, <quotes>b</quotes>], [<quotes>cb</quotes>, <quotes>a</quotes>]]
+
F1 := [[1,<quotes>a</quotes>],[1,<quotes></quotes>]];
F1 := []; -- F1=0
+
F2 := [[1,<quotes>b</quotes>],[1,<quotes>ba</quotes>]];
F2 := []; -- F2=0
+
NC.Add(F1,F2);
Gbmr.MRAdd(X, Ordering, Relations, F1,F2);
+
[[1, <quotes>ba</quotes>], [1, <quotes>a</quotes>], [1, <quotes>b</quotes>], [1, <quotes></quotes>]]
ERROR: Undefined indeterminate e
 
CONTEXT: $cocoa5.PrintTime(1 * e - 05)
 
 
-------------------------------
 
-------------------------------
[ ]
+
</example>
-------------------------------
 
 
 
X := <quotes>abc</quotes>; 
 
Ordering := <quotes>LLEX</quotes>; 
 
Relations := [[<quotes>aa</quotes>,<quotes></quotes>], [<quotes>bb</quotes>,<quotes></quotes>], [<quotes>ab</quotes>,<quotes>c</quotes>], [<quotes>ac</quotes>, <quotes>b</quotes>], [<quotes>cb</quotes>, <quotes>a</quotes>]]; 
 
F1 := []; -- F1=0 
 
F2 := [[1,<quotes>b</quotes>],[1,<quotes>ba</quotes>]]; -- F2=b+ba
 
Gbmr.MRAdd(X, Ordering, Relations, F1,F2);
 
ERROR: Undefined indeterminate e
 
CONTEXT: $cocoa5.PrintTime(33 / 10 * e - 05)
 
-------------------------------
 
[[1, <quotes>ba</quotes>], [1, <quotes>b</quotes>]]
 
-------------------------------
 
 
 
X := <quotes>abc</quotes>; 
 
Ordering := <quotes>LLEX</quotes>; 
 
Relations := [[<quotes>aa</quotes>,<quotes></quotes>], [<quotes>bb</quotes>,<quotes></quotes>], [<quotes>ab</quotes>,<quotes>c</quotes>], [<quotes>ac</quotes>, <quotes>b</quotes>], [<quotes>cb</quotes>, <quotes>a</quotes>]]; 
 
F1 := [[1,<quotes>a</quotes>],[1,<quotes></quotes>]]; -- F1=a+1 
 
F2 := [[1,<quotes>b</quotes>],[1,<quotes>ac</quotes>]]; -- F2=b+ac=2b
 
Gbmr.MRAdd(X, Ordering, Relations, F1,F2);
 
ERROR: Undefined indeterminate e
 
CONTEXT: $cocoa5.PrintTime(24 / 10 * e - 05)
 
-------------------------------
 
[[1, <quotes>a</quotes>], [2, <quotes>b</quotes>], [1, <quotes></quotes>]]
 
-------------------------------</example>
 
 
</description>
 
</description>
 
<seealso>
 
<seealso>

Revision as of 08:37, 14 July 2010

NC.Add

Addition of two polynomials over a free associative K-algebra.

Syntax

NC.Add(F1:LIST, F2:LIST):LIST

Description

Please note: The function(s) explained on this page is/are using the ApCoCoAServer. You will have to start the ApCoCoAServer in order to use it/them.

  • Before calling the function, please set ring environment coefficient field (K), alphabet (X) and ordering through the functions NC.SetFp(P) (or NC.UnsetFp()), NC.SetX(X) and NC.SetOrdering(Ordering) respectively. Default coefficient field is Q. Default ordering is length-lexicographic ordering ("LLEX"). For more information, please check the relevant functions.

  • @param F1 left operand of addition operator. It is a polynomial in K<X>. Each polynomial is represented as a LIST of LISTs, which are pairs of form [c, w] where c is in K and w is a word in X*. For example, polynomial F:=xy-y+1 is represented as F:=[[1,"xy"], [-1, "y"], [1,""]]. Zero polynomial is represented as an empty LIST [].

  • @param F2 right operand of addition operator. It is a polynomial in K<X>.

  • @return: a LIST which represents a polynomial equal to F1+F2.

Example

NC.SetX(<quotes>abc</quotes>); 				
NC.SetOrdering(<quotes>ELIM</quotes>); 				
F1 := [[1,<quotes>a</quotes>],[1,<quotes></quotes>]]; 				
F2 := [[1,<quotes>b</quotes>],[1,<quotes>ba</quotes>]];	
NC.Add(F1,F2);
[[1, <quotes>ba</quotes>], [1, <quotes>a</quotes>], [1, <quotes>b</quotes>], [1, <quotes></quotes>]]
-------------------------------

See also

Gbmr.MRSubtract

Gbmr.MRMultiply

Gbmr.MRBP

Gbmr.MRIntersection

Gbmr.MRKernelOfHomomorphism

Gbmr.MRMinimalPolynomials

Introduction to CoCoAServer