version 1.1, 1999/10/08 02:12:15 |
version 1.7, 2001/01/04 12:29:31 |
|
|
|
/* $OpenXM: OpenXM/src/k097/help.k,v 1.6 2000/12/29 07:19:39 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 (help.ccc). 8/6, 1996 --- 8/7, 1996. 3/6, 1997 --- 12/21, 1997."); |
|
|
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 270 HelpAdd(["IsString", |
|
Line 271 HelpAdd(["IsString", |
|
["IsString(obj) returns true if << obj >> is a string (object obj).", |
["IsString(obj) returns true if << obj >> is a string (object obj).", |
"Example: if (IsString(\"abc\")) Println(\"Hello\"); ;"]]); |
"Example: if (IsString(\"abc\")) Println(\"Hello\"); ;"]]); |
|
|
|
HelpAdd(["IsRing", |
|
["IsRing(obj) returns true if << obj >> is a ring (object obj)." |
|
]]); |
|
|
|
|
HelpAdd(["IsSm1Integer", |
HelpAdd(["IsSm1Integer", |
["IsSm1Integer(obj) returns true if << obj >> is an integer of sm1(object obj)."]]); |
["IsSm1Integer(obj) returns true if << obj >> is an integer of sm1(object obj)."]]); |
|
|
Line 331 def RingPoly(vList,weightMatrix,pp) { |
|
Line 336 def RingPoly(vList,weightMatrix,pp) { |
|
sm1("[", vList, |
sm1("[", vList, |
"ring_of_polynomials ( ) elimination_order 0 ] define_ring |
"ring_of_polynomials ( ) elimination_order 0 ] define_ring |
/tmp set "); |
/tmp set "); |
|
SetRingVariables(); |
return(tmp); |
return(tmp); |
} else ; |
} else ; |
if (argsize == 2) { |
if (argsize == 2) { |
Line 351 def RingPoly(vList,weightMatrix,pp) { |
|
Line 357 def RingPoly(vList,weightMatrix,pp) { |
|
} |
} |
new0[i] = newtmp; |
new0[i] = newtmp; |
} |
} |
|
SetRingVariables(); |
ringpp = |
ringpp = |
sm1("[", vList, |
sm1("[", vList, |
"ring_of_polynomials ", new0, " weight_vector", pp, " ] define_ring"); |
"ring_of_polynomials ", new0, " weight_vector", pp, " ] define_ring"); |
Line 366 def IsSm1Integer(ob) { |
|
Line 373 def IsSm1Integer(ob) { |
|
sm1(ob , " isInteger /FunctionValue set "); |
sm1(ob , " isInteger /FunctionValue set "); |
} |
} |
|
|
|
def IsRing(ob) { |
|
sm1(ob , " isRing /FunctionValue set "); |
|
} |
|
|
|
|
def CancelNumber(rn) { |
def CancelNumber(rn) { |
local tmp; |
local tmp; |
sm1(" [(cancel) ",rn," ] mpzext /tmp set "); |
sm1(" [(cancel) ",rn," ] mpzext /tmp set "); |
Line 374 def CancelNumber(rn) { |
|
Line 385 def CancelNumber(rn) { |
|
sm1(" tmp (denominator) dc (1).. eq { /FunctionValue tmp (numerator) dc def} { /FunctionValue tmp def } ifelse "); |
sm1(" tmp (denominator) dc (1).. eq { /FunctionValue tmp (numerator) dc def} { /FunctionValue tmp def } ifelse "); |
} |
} |
|
|
|
def DC_polynomial(obj) { |
|
return(DC(obj,"polynomial")); |
|
} |
def DC(obj,key) { |
def DC(obj,key) { |
|
if (IsArray(obj) && key=="polynomial") { |
|
return(Map(obj,"DC_polynomial")); |
|
} |
if (key == "string") { return(ToString(obj)); } |
if (key == "string") { return(ToString(obj)); } |
else if (key == "integer") { key = "universalNumber"; } |
else if (key == "integer") { key = "universalNumber"; } |
else if (key == "sm1integer") { key = "integer"; } |
else if (key == "sm1integer") { key = "integer"; } |
Line 506 def RingDonIndexedVariables(vList, size, weightMatrix, |
|
Line 523 def RingDonIndexedVariables(vList, size, weightMatrix, |
|
if (argsize == 2) { |
if (argsize == 2) { |
vListD = AddString(["D",vList]); |
vListD = AddString(["D",vList]); |
myring = RingD(IndexedVariables(vList,size)); |
myring = RingD(IndexedVariables(vList,size)); |
SetRingVariables(); |
|
tmp = NewArray(size); |
tmp = NewArray(size); |
for (k00_i=0; k00_i<size; k00_i++) {tmp[k00_i]=Poly(Indexed(vList,k00_i));} |
for (k00_i=0; k00_i<size; k00_i++) {tmp[k00_i]=Poly(Indexed(vList,k00_i));} |
sm1(vList, " (literal) dc ", tmp, " def "); |
sm1(vList, " (literal) dc ", tmp, " def "); |
Line 727 HelpAdd(["IsConstant", |
|
Line 743 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."); |
} |
} |
|
|
if (IsArray(f)) { |
if (IsArray(f)) { |
return(Map(f,"Tag")); |
return(Map(f,"Tag")); |
}else { |
}else { |
ans = sm1(f," tag (universalNumber) dc "); |
ans = sm1(f," etag (universalNumber) dc "); |
return(ans); |
return(ans); |
} |
} |
} |
} |
HelpAdd(["Tag", |
HelpAdd(["Tag", |
["Tag(f) returns the datatype tags of f where", |
["Tag(f) returns the datatype tags of f where", |
"5: string, 9: polynomial, 15: integer(big-num), 16: rational, ", |
"5: string, 9: polynomial, 15: integer(big-num), 16: rational, ", |
"17: object, 18:double.", |
"18:double, 257: Error ", |
"Ex. Tag([Poly(\"0\"), 0]):" |
"Ex. Tag([Poly(\"0\"), 0]):" |
]]); |
]]); |
|
|
|
def Error(s) { |
|
sm1(" s error "); |
|
} |
|
HelpAdd(["Error", |
|
["Error(s) causes an error and outputs a message s."]]); |
|
|
OutputPrompt ; |
OutputPrompt ; |