| version 1.6, 2000/12/29 07:19:39 |
version 1.8, 2001/01/05 11:14:25 |
|
|
| /* $OpenXM: OpenXM/src/k097/help.k,v 1.5 2000/12/28 00:08:13 takayama Exp $ */ |
/* $OpenXM: OpenXM/src/k097/help.k,v 1.7 2001/01/04 12:29:31 takayama Exp $ */ |
| if (K00_verbose) |
if (K00_verbose) |
| Println("help.k (help.ccc). 8/6, 1996 --- 8/7, 1996. 3/6, 1997 --- 12/21, 1997."); |
Println("help.k: 8/6, 1996 --- 8/7, 1996. 3/6, 1997 --- 12/21, 1997."); |
| |
|
| def help(x) { |
def help(x) { |
| if (Length(Arglist) < 1) { |
if (Length(Arglist) < 1) { |
| Line 168 HelpAdd(["Poly", |
|
| Line 168 HelpAdd(["Poly", |
|
| "Poly(name) returns the polynomial name in the current ring |
"Poly(name) returns the polynomial name in the current ring |
| (string name)."]); |
(string name)."]); |
| HelpAdd(["PolyR", |
HelpAdd(["PolyR", |
| "PolyR(name,r) returns the polynomial name in the ring r |
["PolyR(name,r) returns the polynomial name in the ring r |
| (string name, ring r). |
(string name, ring r).", |
| Ex. r = RingD(\"x,y\"); y = PolyR(\"y\",r); "]); |
"Ex. r = RingD(\"x,y\"); y = PolyR(\"y\",r); "]]); |
| HelpAdd(["RingD", |
HelpAdd(["RingD", |
| ["RingD(names) defines a new ring (string names).", |
["RingD(names) defines a new ring (string names).", |
| "RingD(names,weight_vector) defines a new ring with the weight vector", |
"RingD(names,weight_vector) defines a new ring with the weight vector", |
| Line 185 ascii code is ascii_code (integer ascii_code)."]); |
|
| Line 185 ascii code is ascii_code (integer ascii_code)."]); |
|
| HelpAdd(["ToString","ToString(obj) transforms the <<obj>> to a string."]); |
HelpAdd(["ToString","ToString(obj) transforms the <<obj>> to a string."]); |
| HelpAdd(["Numerator","Numerator(f) returns the numerator of <<f>> (rational f)."]); |
HelpAdd(["Numerator","Numerator(f) returns the numerator of <<f>> (rational f)."]); |
| HelpAdd(["Denominator","Denominator(f) returns the denominator of <<f>> (rational f)."]); |
HelpAdd(["Denominator","Denominator(f) returns the denominator of <<f>> (rational f)."]); |
| HelpAdd(["Replace","Replace(f,rule) (polynomial f, array rule). |
HelpAdd(["Replace", |
| Ex. Replace( (x+y)^3, [[x,Poly(\"1\")]])"]); |
["Replace(f,rule) (polynomial f, array rule). ", |
| |
"Ex. Replace( (x+y)^3, [[x,Poly(\"1\")]])"]]); |
| HelpAdd(["SetRingVariables", |
HelpAdd(["SetRingVariables", |
| "SetRingVariables() |
"SetRingVariables() |
| Set the generators of the current ring as global variables. |
Set the generators of the current ring as global variables. |
| Line 195 HelpAdd(["Append","Append([f1,...,fn],g) returns the l |
|
| Line 196 HelpAdd(["Append","Append([f1,...,fn],g) returns the l |
|
| HelpAdd(["Join", |
HelpAdd(["Join", |
| "Join([f1,...,fn],[g1,...,gm]) returns the list |
"Join([f1,...,fn],[g1,...,gm]) returns the list |
| [f1,...,fn,g1,...,gm]"]); |
[f1,...,fn,g1,...,gm]"]); |
| HelpAdd(["Indexed", |
|
| "Indexed(name,i) returns the string name[i] |
|
| (string name, integer i)"]); |
|
| |
|
| HelpAdd(["-ReservedName1", |
HelpAdd(["!ReservedNames", |
| ["The names k00*, K00*, sm1* , arg1,arg2,arg3,arg4,....," , |
["The names k00*, K00*, sm1* , arg1,arg2,arg3,arg4,....," , |
| "Helplist, Arglist, FunctionValue,", |
"Helplist, Arglist, FunctionValue,", |
| "@@@*, db.*, k.*, tmp002*, tmp00* are used for system functions."]]); |
"@@@*, db.*, k.*, tmp002*, tmp00* are used for system functions."]]); |
| Line 222 HelpAdd(["Init_w", |
|
| Line 220 HelpAdd(["Init_w", |
|
| "to the variables <<vars>> (array of polynomials).", |
"to the variables <<vars>> (array of polynomials).", |
| "Example: Init_w(x^2+y^2+x,[x,y],[1,1]):"]]); |
"Example: Init_w(x^2+y^2+x,[x,y],[1,1]):"]]); |
| |
|
| HelpAdd(["RingDonIndexedVariables", |
|
| ["RingDonIndexedVariables(name,n) defines and returns the ring of", |
|
| "homogenized differential operators", |
|
| "Q<h, name[0], ..., name[n-1], Dname[0], ..., Dname[n-1]>", |
|
| "where <<name>> is a string and <<n>> is an integer.", |
|
| "Note that this function defines global variables", |
|
| "h, name[0], ..., name[n-1], Dname[0], ..., Dname[n-1].", |
|
| "Example: RingDonIndexedVariables(\"x\",3).", |
|
| "RingDonIndexedVariables(name,n,w) defines and returns the ring of", |
|
| "homogenized differential operators with the ordering defined by ", |
|
| "the weight vector <<w>> (array)", |
|
| "Example: RingDonIndexedVariables(\"x\",3,[[\"x[0]\",1,\"x[2]\",3]])."]]); |
|
| |
|
| HelpAdd(["Groebner", |
HelpAdd(["Groebner", |
| ["Groebner(input) returns Groebner basis of the left module (or ideal)", |
["Groebner(input) returns Groebner basis of the left module (or ideal)", |
| Line 485 HelpAdd(["ReducedBase", |
|
| Line 471 HelpAdd(["ReducedBase", |
|
| ["ReducedBase[base] prunes redundant elements in the Grobner basis <<base>> (array)." |
["ReducedBase[base] prunes redundant elements in the Grobner basis <<base>> (array)." |
| ]]); |
]]); |
| |
|
| def IndexedVariables(name,size) { |
|
| local result,i,result2; |
|
| result = [ ]; |
|
| for (i=0; i<size-1; i++) { |
|
| result = Append(result,Indexed(name,i)); |
|
| result = Append(result,","); |
|
| } |
|
| if (size-1 >= 0) { |
|
| result = Append(result,Indexed(name,size-1)); |
|
| } |
|
| result2 = Join(["{"],result); |
|
| result2 = Join(result2,["}"]); |
|
| return(AddString(result2)); |
|
| } |
|
| HelpAdd(["IndexedVariables", |
|
| ["IndexedVariables(name,size) returns the string ", |
|
| " {name[0],name[1],...,name[size-1]} which can be used as inputs to ", |
|
| " the function RingD (string name, integer size).", |
|
| " cf. RingDonIndexedVariables.", |
|
| " Ex. R = RingD(IndexedVariables(\"a\",3)); ", |
|
| " h = Poly(\"h\");", |
|
| " a = NewArray(3);", |
|
| " for (i=0; i<3; i++) {a[i] = Poly(Indexed(\"a\",i));} ;"]]); |
|
| |
|
| |
|
| def RingDonIndexedVariables(vList, size, weightMatrix,pp) { |
|
| local myring,tmp,k00_i,argsize,vListD; |
|
| /* You cannot use these local varialbes as a name of global ring |
|
| variables. Change these names to names that start with k00_ */ |
|
| argsize = Length(Arglist); |
|
| if (argsize == 1) { |
|
| Println("Error (IndexedRingD): "); |
|
| return(null); |
|
| } |
|
| if (argsize == 2) { |
|
| vListD = AddString(["D",vList]); |
|
| myring = RingD(IndexedVariables(vList,size)); |
|
| tmp = NewArray(size); |
|
| for (k00_i=0; k00_i<size; k00_i++) {tmp[k00_i]=Poly(Indexed(vList,k00_i));} |
|
| sm1(vList, " (literal) dc ", tmp, " def "); |
|
| tmp = NewArray(size); |
|
| for (k00_i=0; k00_i<size; k00_i++) {tmp[k00_i]=Poly(Indexed(vListD,k00_i));} |
|
| sm1(vListD, " (literal) dc ", tmp, " def "); |
|
| if (SetRingVariables_Verbose) { |
|
| Print("Set the global variables "); |
|
| sm1("[(parse) ",vList," ] extension pop print "); |
|
| sm1("[(parse) ",vListD," ] extension pop print "); Ln(); |
|
| }else { |
|
| sm1("[(parse) ",vList," ] extension pop "); |
|
| sm1("[(parse) ",vListD," ] extension pop "); |
|
| } |
|
| return( myring ); |
|
| } |
|
| if (argsize == 3 || argsize == 4) { |
|
| if (argsize == 3) { pp = 0; } |
|
| vListD = AddString(["D",vList]); |
|
| myring = RingD(IndexedVariables(vList,size),weightMatrix,pp); |
|
| SetRingVariables(); |
|
| tmp = NewArray(size); |
|
| for (k00_i=0;k00_i<size; k00_i++) {tmp[k00_i]=Poly(Indexed(vList,k00_i));} |
|
| sm1(vList, " (literal) dc ", tmp, " def "); |
|
| tmp = NewArray(size); |
|
| for (k00_i=0;k00_i<size; k00_i++) {tmp[k00_i]=Poly(Indexed(vListD,k00_i));} |
|
| sm1(vListD, " (literal) dc ", tmp, " def "); |
|
| if (SetRingVariables_Verbose) { |
|
| Print("Set the global variables "); |
|
| sm1("[(parse) ",vList," ] extension pop print "); |
|
| sm1("[(parse) ",vListD," ] extension pop print "); Ln(); |
|
| } else { |
|
| sm1("[(parse) ",vList," ] extension pop "); |
|
| sm1("[(parse) ",vListD," ] extension pop "); |
|
| } |
|
| return( myring ); |
|
| } |
|
| return(-1); |
|
| } |
|
| |
|
| def Ringp(f) { |
def Ringp(f) { |
| sm1(f, " (ring) dc /FunctionValue set "); |
sm1(f, " (ring) dc /FunctionValue set "); |
| } |
} |
| Line 653 def ToDouble(f) { |
|
| Line 563 def ToDouble(f) { |
|
| } |
} |
| |
|
| |
|
| def RingPonIndexedVariables(vList, size, weightMatrix) { |
|
| local myring,tmp,k00_i,argsize,vListD; |
|
| /* You cannot use these local varialbes as a name of global ring |
|
| variables. Change these names to names that start with k00_ */ |
|
| argsize = Length(Arglist); |
|
| if (argsize == 1) { |
|
| Println("Error (RingPonIndexedVariables): "); |
|
| return(null); |
|
| } |
|
| if (argsize == 2) { |
|
| myring = RingPoly(IndexedVariables(vList,size)); |
|
| SetRingVariables(); |
|
| tmp = NewArray(size); |
|
| for (k00_i=0; k00_i<size; k00_i++) {tmp[k00_i]=Poly(Indexed(vList,k00_i));} |
|
| sm1(vList, " (literal) dc ", tmp, " def "); |
|
| if (SetRingVariables_Verbose) { |
|
| Print("Set the global variables "); |
|
| sm1("[(parse) ",vList," ] extension pop print "); Ln(); |
|
| }else { |
|
| sm1("[(parse) ",vList," ] extension pop "); |
|
| } |
|
| return( myring ); |
|
| } |
|
| if (argsize == 3) { |
|
| myring = RingPoly(IndexedVariables(vList,size),weightMatrix); |
|
| SetRingVariables(); |
|
| tmp = NewArray(size); |
|
| for (k00_i=0;k00_i<size; k00_i++) {tmp[k00_i]=Poly(Indexed(vList,k00_i));} |
|
| sm1(vList, " (literal) dc ", tmp, " def "); |
|
| if (SetRingVariables_Verbose) { |
|
| Print("Set the global variables "); |
|
| sm1("[(parse) ",vList," ] extension pop print "); Ln(); |
|
| } else { |
|
| sm1("[(parse) ",vList," ] extension pop "); |
|
| } |
|
| return( myring ); |
|
| } |
|
| return(-1); |
|
| } |
|
| |
|
| HelpAdd(["RingPonIndexedVariables", |
|
| ["RingPonIndexedVariables(name,n) defines and returns the ring of", |
|
| "polynomials", |
|
| "Q<h, name[0], ..., name[n-1] >", |
|
| "where <<name>> is a string and <<n>> is an integer.", |
|
| "Note that this function defines global variables", |
|
| "h, name[0], ..., name[n-1].", |
|
| "Example: RingPonIndexedVariables(\"x\",3).", |
|
| "RingPonIndexedVariables(name,n,w) defines and returns the ring of", |
|
| "polynomials with the ordering defined by ", |
|
| "the weight vector <<w>> (array)", |
|
| "Example: RingPonIndexedVariables(\"x\",3,[[\"x[0]\",1,\"x[2]\",3]])."]]); |
|
| |
|
| |
|
| def Mod(f,n) { |
def Mod(f,n) { |
| if (IsPolynomial(f)) { |
if (IsPolynomial(f)) { |
| sm1("[(mod) ",f,n,"] gbext /FunctionValue set "); |
sm1("[(mod) ",f,n,"] gbext /FunctionValue set "); |
| Line 742 HelpAdd(["IsConstant", |
|
| Line 599 HelpAdd(["IsConstant", |
|
| Println("Default ring is Z[x,h]."); x = Poly("x"); h = Poly("h"); |
Println("Default ring is Z[x,h]."); x = Poly("x"); h = Poly("h"); |
| |
|
| def Substitute(f,xx,g) { |
def Substitute(f,xx,g) { |
| local tmp, coeff0,ex,i,n,newex; |
local tmp, coeff0,ex,i,n,newex,ans; |
| if (IsInteger(f)) return(f); |
if (IsInteger(f)) return(f); |
| |
if (IsArray(f)) { |
| |
n = Length(f); |
| |
ans = NewVector(n); |
| |
for (i=0; i<n; i++) { |
| |
ans[i] = Substitute(f[i],xx,g); |
| |
} |
| |
return(ans); |
| |
} |
| if (! IsPolynomial(f)) { |
if (! IsPolynomial(f)) { |
| k00_error("Substitute","The first argument must be polynomial."); |
k00_error("Substitute","The first argument must be polynomial."); |
| } |
} |