Commit ee88e50e authored by Hynek Baran's avatar Hynek Baran

Examples directory tracked

parent 04532e3f
This diff is collapsed.
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
smartprint := proc(p)
if length(p) > smartprintlength then
if type(p, `=`) then
print(lhs(p) = '`A large expression `'('size' = size(rhs(p)), 'length' = length(rhs(p))))
else print('`A large expression `'('size' = size(p), 'length' = length(p)))
fi
else print(p)
fi
end:
smartprintlength := 1000:
`run/put/print` := op(smartprint):
coordinates([x,y],[f], 5);
eq := f_xy*(f_4y - f_4x) + 3*(f_xyy*f_yyy - f_xxy*f_xxx)
+ 2*(f_yy*f_xyyy - f_xx*f_xxxy);
normal(transform(x = y, y = x, eq) + eq);
fyyyy := solve(eq, f_4y):
equation('f_4y' = fyyyy);
normal(eq);
dj2 := f,f_x,f_y,f_xx,f_xy,f_yy;
dj3 := dj2,f_xxx,f_xxy,f_xyy,f_yyy;
dependence(a11(dj3), a12(dj2), b11(dj3), b12(dj2), b21(dj2), r(f,f_x,f_y,f_xy));
A := matrix(2,2, [a11,a12,1,-a11]);
B := matrix(2,2, [b11,b12,b21,-b11]);
R := matrix(2,2, [r,0,0,-r]);
W := zcr(x = A, y = B, 1 = R):
unknowns(r,b21,a12,b12,a11,b11);
Varordering(degree,reverse,function);
nonzero(a12,b12,b21,r);
Qs := [f_xxx,f_xxy,f_xyy,f_yyy];
G := seq(seq(pd(a11, Q1*Q2), Q1 = Qs), Q2 = Qs),
seq(seq(pd(b11, Q1*Q2), Q1 = Qs), Q2 = Qs);
nonzero(b21*f_x*f_xy-f_xy*f_y);
S := (W,G);
`derive/depth` := 1 ;
putr := proc()
local aux;
aux := resolve(op(map(a -> lhs(a)-rhs(a),[args])));
printf("Resolved %a eqs and obtained %a eqs\n", nargs, nops([aux]));
printf("Original: %q\n", map(a->lhs(a)=[Vars(rhs(a))=length(rhs(a))],[args]));
printf("Resolved: %q\n", map(a->lhs(a)=[Vars(rhs(a))=length(rhs(a))],[aux]));
put(aux);
end:
PrintUserSuccessReport := proc()
JetsProfiler:-Print();
print("A"=map(normal@eval, evalm(A)));
print("B"=map(normal@eval, evalm(B)));
print("R"=map(normal@eval, evalm(R)));
print("---");
lprint("A"=map(normal@eval, evalm(A)));
lprint("B"=map(normal@eval, evalm(B)));
lprint("R"=map(normal@eval, evalm(R)));
end:
Char := char(x = A, y = B);
TestOfNonImportantness := proc()
description "Returns NULL if current state is important. Implicitly returns NULL everytime." ;
## by default, returns NULL every time (so everything is important)
#NULL
global Char;
if `TestOfNonImportantness/IsZeroMatrix`(Char) then
print("TestOfNonImportantness failed, characteristic element is zero", Char);
"characteristic element is zero."
else
print("TestOfNonImportantness ok, ", d);
NULL
fi
end proc:
GenerateNonZeroFile := proc (resolvedExpr, basefilename, StateFilesDir, RunMeFilesDir, stepnumber)
global ressize, putsize, maxsize;
local fileName ;
fileName := cat(RunMeFilesDir, basefilename, sprintf("%s", WrapNumber(stepnumber*2+1)), ".runme") ;
printf("Generating nonzero file %s: nonzero(E%a);\n", fileName, stepnumber) ;
writetofile (fileName,
sprintf("printf(""Here is file: %%s\\n"",%a);\n%A\n%A\n%A\nprintf(""Finished file: %%s\\n"",%a);\n# Done",
fileName,
###cat("read( """, StateFilesDir, basefilename, ".state"" ); "),
cat("read( """, "global/Done/", basefilename, ".runme"" ); "),
cat("nonzero( ", sprintf("%a", resolvedExpr), "); "),
sprintf("ressize := %a; putsize := %a; maxsize := %a;\n", ressize, putsize, maxsize),
fileName));
end:
GeneratePutZeroFile := proc (resolvedExpr, basefilename, StateFilesDir, RunMeFilesDir, stepnumber)
global ressize, putsize, maxsize, `JetMachine/opt/suppressPuts`;
local fileName ;
fileName := cat(RunMeFilesDir, basefilename, sprintf("%s", WrapNumber(stepnumber*2)), ".runme") ;
if not(assigned(`JetMachine/opt/suppressPuts`)) or `JetMachine/opt/suppressPuts`<> true then
printf("Generating putzero file %s: put(%a); \n", fileName, resolvedExpr) ;
writetofile (fileName,
sprintf("printf(""Here is file: %%s\\n"",%a);\n%A\n%A\n%A\nprintf(""Finished file: %%s\\n"",%a);\n# Done",
fileName,
cat("read( """, "global/Done/", basefilename, ".runme"" ); "),
###cat("read( """, StateFilesDir, basefilename, ".state"" ); "),
cat("put( ", sprintf("%a", resolvedExpr), "); "),
sprintf("ressize := %a; putsize := %a; maxsize := %a;\n", ressize, putsize, maxsize),
fileName));
else
printf("SUPPRESSED generating putzero file %s: put(%a); \n`JetMachine/opt/suppressPuts`=%a\n", fileName, resolvedExpr,`JetMachine/opt/suppressPuts`) ;
fi;
end:
reporting(run=2);
JetsProfiler(profile);
storing(cat("global/Logs.Detailed/",parBaseFileName,".state") );
\ No newline at end of file
smartprint := proc(p)
if length(p) > smartprintlength then
if type(p, `=`) then
print(lhs(p) = '`A large expression `'('size' = size(rhs(p)), 'length' = length(rhs(p))))
else print('`A large expression `'('size' = size(p), 'length' = length(p)))
fi
else print(p)
fi
end:
smartprintlength := 1000:
`run/put/print` := op(smartprint):
coordinates([x,y],[f], 5);
eq := f_xy*(f_4y - f_4x) + 3*(f_xyy*f_yyy - f_xxy*f_xxx)
+ 2*(f_yy*f_xyyy - f_xx*f_xxxy);
normal(transform(x = y, y = x, eq) + eq);
fyyyy := solve(eq, f_4y):
equation('f_4y' = fyyyy);
normal(eq);
dj2 := f,f_x,f_y,f_xx,f_xy,f_yy;
dj3 := dj2,f_xxx,f_xxy,f_xyy,f_yyy;
dependence(a11(dj3), a12(dj2), b11(dj3), b12(dj2), b21(dj2), r(f,f_x,f_y,f_xy));
A := matrix(2,2, [a11,a12,1,-a11]);
B := matrix(2,2, [b11,b12,b21,-b11]);
R := matrix(2,2, [r,0,0,-r]);
W := zcr(x = A, y = B, 1 = R):
unknowns(r,b21,a12,b12,a11,b11);
Varordering(degree,reverse,function);
nonzero(a12,b12,b21,r);
Qs := [f_xxx,f_xxy,f_xyy,f_yyy];
G := seq(seq(pd(a11, Q1*Q2), Q1 = Qs), Q2 = Qs),
seq(seq(pd(b11, Q1*Q2), Q1 = Qs), Q2 = Qs);
###nonzero(b21*f_x*f_xy-f_xy*f_y);
S := (W,G);
`derive/depth` := 1 ;
putr := proc()
local aux;
aux := resolve(op(map(a -> lhs(a)-rhs(a),[args])));
printf("Resolved %a eqs and obtained %a eqs\n", nargs, nops([aux]));
printf("Original: %q\n", map(a->lhs(a)=[Vars(rhs(a))=length(rhs(a))],[args]));
printf("Resolved: %q\n", map(a->lhs(a)=[Vars(rhs(a))=length(rhs(a))],[aux]));
put(aux);
end:
PrintUserSuccessReport := proc()
JetsProfiler:-Print();
print("A"=map(normal@eval, evalm(A)));
print("B"=map(normal@eval, evalm(B)));
print("R"=map(normal@eval, evalm(R)));
print("---");
lprint("A"=map(normal@eval, evalm(A)));
lprint("B"=map(normal@eval, evalm(B)));
lprint("R"=map(normal@eval, evalm(R)));
end:
Char := char(x = A, y = B);
TestOfNonImportantness := proc()
description "Returns NULL if current state is important. Implicitly returns NULL everytime." ;
## by default, returns NULL every time (so everything is important)
#NULL
global Char;
if `TestOfNonImportantness/IsZeroMatrix`(Char) then
print("TestOfNonImportantness failed, characteristic element is zero", Char);
"characteristic element is zero."
else
print("TestOfNonImportantness ok, ", d);
NULL
fi
end proc:
GenerateNonZeroFile := proc (resolvedExpr, basefilename, StateFilesDir, RunMeFilesDir, stepnumber)
global ressize, putsize, maxsize;
local fileName ;
fileName := cat(RunMeFilesDir, basefilename, sprintf("%s", WrapNumber(stepnumber*2+1)), ".runme") ;
printf("Generating nonzero file %s: nonzero(E%a);\n", fileName, stepnumber) ;
writetofile (fileName,
sprintf("printf(""Here is file: %%s\\n"",%a);\n%A\n%A\n%A\nprintf(""Finished file: %%s\\n"",%a);\n# Done",
fileName,
###cat("read( """, StateFilesDir, basefilename, ".state"" ); "),
cat("read( """, "global/Done/", basefilename, ".runme"" ); "),
cat("nonzero( ", sprintf("%a", resolvedExpr), "); "),
sprintf("ressize := %a; putsize := %a; maxsize := %a;\n", ressize, putsize, maxsize),
fileName));
end:
GeneratePutZeroFile := proc (resolvedExpr, basefilename, StateFilesDir, RunMeFilesDir, stepnumber)
global ressize, putsize, maxsize, `JetMachine/opt/suppressPuts`;
local fileName ;
fileName := cat(RunMeFilesDir, basefilename, sprintf("%s", WrapNumber(stepnumber*2)), ".runme") ;
if not(assigned(`JetMachine/opt/suppressPuts`)) or `JetMachine/opt/suppressPuts`<> true then
printf("Generating putzero file %s: put(%a); \n", fileName, resolvedExpr) ;
writetofile (fileName,
sprintf("printf(""Here is file: %%s\\n"",%a);\n%A\n%A\n%A\nprintf(""Finished file: %%s\\n"",%a);\n# Done",
fileName,
cat("read( """, "global/Done/", basefilename, ".runme"" ); "),
###cat("read( """, StateFilesDir, basefilename, ".state"" ); "),
cat("put( ", sprintf("%a", resolvedExpr), "); "),
sprintf("ressize := %a; putsize := %a; maxsize := %a;\n", ressize, putsize, maxsize),
fileName));
else
printf("SUPPRESSED generating putzero file %s: put(%a); \n`JetMachine/opt/suppressPuts`=%a\n", fileName, resolvedExpr,`JetMachine/opt/suppressPuts`) ;
fi;
end:
reporting(run=2);
JetsProfiler(profile);
storing(cat("global/Logs.Detailed/",parBaseFileName,".state") );
\ No newline at end of file
smartprint := proc(p)
if length(p) > smartprintlength then
if type(p, `=`) then
print(lhs(p) = '`A large expression `'('size' = size(rhs(p)), 'length' = length(rhs(p))))
else print('`A large expression `'('size' = size(p), 'length' = length(p)))
fi
else print(p)
fi
end:
smartprintlength := 1000:
`run/put/print` := op(smartprint):
coordinates([x,y],[f], 5);
eq := f_xy*(f_4y - f_4x) + 3*(f_xyy*f_yyy - f_xxy*f_xxx)
+ 2*(f_yy*f_xyyy - f_xx*f_xxxy);
normal(transform(x = y, y = x, eq) + eq);
fyyyy := solve(eq, f_4y):
equation('f_4y' = fyyyy);
normal(eq);
dj2 := f,f_x,f_y,f_xx,f_xy,f_yy;
dj3 := dj2,f_xxx,f_xxy,f_xyy,f_yyy;
dependence(a11(dj3), a12(dj2), b11(dj3), b12(dj2), b21(dj2), r(f,f_x,f_y,f_xy));
A := matrix(2,2, [a11,a12,1,-a11]);
B := matrix(2,2, [b11,b12,b21,-b11]);
R := matrix(2,2, [r,0,0,-r]);
W := zcr(x = A, y = B, 1 = R):
unknowns(r,a12,b12,a11,b11,b21);
Varordering(degree,reverse,function);
nonzero(a12,b12,b21,r);
Qs := [f_xxx,f_xxy,f_xyy,f_yyy];
G := seq(seq(pd(a11, Q1*Q2), Q1 = Qs), Q2 = Qs),
seq(seq(pd(b11, Q1*Q2), Q1 = Qs), Q2 = Qs);
nonzero(b21*f_x*f_xy-f_xy*f_y);
S := (W,G);
`derive/depth` := 1 ;
putr := proc()
local aux;
aux := resolve(op(map(a -> lhs(a)-rhs(a),[args])));
printf("Resolved %a eqs and obtained %a eqs\n", nargs, nops([aux]));
printf("Original: %q\n", map(a->lhs(a)=[Vars(rhs(a))=length(rhs(a))],[args]));
printf("Resolved: %q\n", map(a->lhs(a)=[Vars(rhs(a))=length(rhs(a))],[aux]));
put(aux);
end:
PrintUserSuccessReport := proc()
JetsProfiler:-Print();
print("A"=map(normal@eval, evalm(A)));
print("B"=map(normal@eval, evalm(B)));
print("R"=map(normal@eval, evalm(R)));
print("---");
lprint("A"=map(normal@eval, evalm(A)));
lprint("B"=map(normal@eval, evalm(B)));
lprint("R"=map(normal@eval, evalm(R)));
end:
Char := char(x = A, y = B);
TestOfNonImportantness := proc()
description "Returns NULL if current state is important. Implicitly returns NULL everytime." ;
## by default, returns NULL every time (so everything is important)
#NULL
global Char;
if `TestOfNonImportantness/IsZeroMatrix`(Char) then
print("TestOfNonImportantness failed, characteristic element is zero", Char);
"characteristic element is zero."
else
print("TestOfNonImportantness ok, ", d);
NULL
fi
end proc:
GenerateNonZeroFile := proc (resolvedExpr, basefilename, StateFilesDir, RunMeFilesDir, stepnumber)
global ressize, putsize, maxsize;
local fileName ;
fileName := cat(RunMeFilesDir, basefilename, sprintf("%s", WrapNumber(stepnumber*2+1)), ".runme") ;
printf("Generating nonzero file %s: nonzero(E%a);\n", fileName, stepnumber) ;
writetofile (fileName,
sprintf("printf(""Here is file: %%s\\n"",%a);\n%A\n%A\n%A\nprintf(""Finished file: %%s\\n"",%a);\n# Done",
fileName,
###cat("read( """, StateFilesDir, basefilename, ".state"" ); "),
cat("read( """, "global/Done/", basefilename, ".runme"" ); "),
cat("nonzero( ", sprintf("%a", resolvedExpr), "); "),
sprintf("ressize := %a; putsize := %a; maxsize := %a;\n", ressize, putsize, maxsize),
fileName));
end:
GeneratePutZeroFile := proc (resolvedExpr, basefilename, StateFilesDir, RunMeFilesDir, stepnumber)
global ressize, putsize, maxsize, `JetMachine/opt/suppressPuts`;
local fileName ;
fileName := cat(RunMeFilesDir, basefilename, sprintf("%s", WrapNumber(stepnumber*2)), ".runme") ;
if not(assigned(`JetMachine/opt/suppressPuts`)) or `JetMachine/opt/suppressPuts`<> true then
printf("Generating putzero file %s: put(%a); \n", fileName, resolvedExpr) ;
writetofile (fileName,
sprintf("printf(""Here is file: %%s\\n"",%a);\n%A\n%A\n%A\nprintf(""Finished file: %%s\\n"",%a);\n# Done",
fileName,
cat("read( """, "global/Done/", basefilename, ".runme"" ); "),
###cat("read( """, StateFilesDir, basefilename, ".state"" ); "),
cat("put( ", sprintf("%a", resolvedExpr), "); "),
sprintf("ressize := %a; putsize := %a; maxsize := %a;\n", ressize, putsize, maxsize),
fileName));
else
printf("SUPPRESSED generating putzero file %s: put(%a); \n`JetMachine/opt/suppressPuts`=%a\n", fileName, resolvedExpr,`JetMachine/opt/suppressPuts`) ;
fi;
end:
reporting(run=2);
JetsProfiler(profile);
storing(cat("global/Logs.Detailed/",parBaseFileName,".state") );
\ No newline at end of file
# A
N := 1;
coordinates([t,x], [u,v], N+3);
equation(
'u_t' = v*u_x + 1/(v - u),
'v_t' = u*v_x + 1/(u - v));
with(linalg):
A := matrix(3,3, [a11, a12, a13, a21, a22, a23, a31, a32, -a11-a22]);
B := matrix(3,3, [b11, b12, b13, b21, b22, b23, b31, b32, -b11-b22]);
R1 := matrix(3,3, [r1_1, 0, 0, 0, r1_2, 0, 0, 0, -r1_1-r1_2]);
R2 := matrix(3,3, [r2_11, r2_12, r2_13, r2_21, r2_22, r2_23, r2_31, r2_32, -r2_11-r2_22]);
S := zero_curvature(x = A, t = B, 1 = R1, 2 = R2);
dep := u, v, seq(jet(u,x^i),i=1..N), seq(jet(v,x^i),i=1..N);
dependence(
a11(dep), a12(dep), a13(dep), a21(dep), a22(dep), a23(dep), a31(dep), a32(dep),
b11(dep), b12(dep), b13(dep), b21(dep), b22(dep), b23(dep), b31(dep), b32(dep),
r1_1(dep), r1_2(dep),
r2_11(dep), r2_12(dep), r2_13(dep), r2_21(dep), r2_22(dep), r2_23(dep), r2_31(dep), r2_32(dep));
unknowns(
b11, b12, b13, b21, b22, b23, b31, b32,
r1_1, r1_2,
r2_11, r2_12, r2_13, r2_21, r2_22, r2_23, r2_31, r2_32,
a11, a13, a21, a22, a31, a32);
a12 := 1;
a23 := 1;
interface(labelling=false);
Varordering(degree,reverse,function):
`derive/depth` := 1 ;
sizefactor := 80;
ressize := 1000; putsize = 400; maxsize = 200;
`resolve/lin/price` := proc(s, LC, LV, r) option inline; size(s) end:
reporting(run=4, resolve=2, derive=1,cc=1);
TestOfNonImportantness := proc()
description "Returns NULL if current state is important." ;
global A, R1, R2;
local allvars, itemsOfAwithoutZero ;
try
A := map(simpl@evalTD, A);
allvars := `union`(op(map((vars@eval), convert(A,set) union convert(B,set))));
itemsOfAwithoutZero := map(eval, convert(A,set)) minus {0};
if allvars subset {x,t} then
print("TestOfNonImportantness failed, not enough variables: ", d);
"TestOfNonImportantness failed: Not enough variables."
elif map(a -> vars( (simpl@normal@eval)(a/op(1, itemsOfAwithoutZero))), itemsOfAwithoutZero) = {{}} then
print("TestOfNonImportantness failed, A is a multiple of constant matrix.", op(A));
"TestOfNonImportantness failed: A is a multiple of constant matrix."
# elif evalb(convert(map(eval@Diff,op(A),s),set) = {0}) then
# print("TestOfNonImportantness failed, none or trivial parameter.");
# "TestOfNonImportantness failed: None or trivial parameter."
elif evalb(convert(map(normal@eval@evalTD,op(R1)),set)={0}) then
print("R1=0");
"TestOfNonImportantness failed: R1 is 0."
elif evalb(convert(map(normal@eval@evalTD,op(R2)),set)={0}) then
print("R2=0");
"TestOfNonImportantness failed: R is 0."
elif ((A[1,2]=0 and A[1,3]=0) or (A[2,1]=0 and A[2,3]=0) or (A[3,1]=0 and A[3,2]=0)
or (A[2,1]=0 and A[3,1]=0) or (A[1,2]=0 and A[3,2]=0) or (A[1,3]=0 and A[2,3]=0)) then
print("TestOfNonImportantness failed, A fall into the subalgebra: ", op(A));
"TestOfNonImportantness failed: A fall into the subalgebra."
elif ormap(has, map(Simpl, `nonzero/s`), 0) then
print("TestOfNonImportantness failed, declared nonzero became zero: ", `nonzero/s`);
"TestOfNonImportantness failed: declared nonzero became zero."
# elif evalb(simpl(eval(variation(F,u)))=0) then
# print("TestOfNonImportantness failed, variation(F,u) is zero: ", 'F'=factor(F));
# "TestOfNonImportantness failed, variation(F,u) is zero."
else
# print("TestOfNonImportantness ok, ", d);
NULL
fi
catch:
print("Error in TestOfNonImportantness:");
print(StringTools[FormatMessage](lastexception[2..-1]));
end try
end proc;
# B
N := 1;
coordinates([t,x], [u,v], N+3);
equation(
'u_t' = v*u_x + 1/(v - u),
'v_t' = u*v_x + 1/(u - v));
with(linalg):
A := matrix(3,3, [a11, a12, a13, a21, a22, a23, a31, a32, -a11-a22]);
B := matrix(3,3, [b11, b12, b13, b21, b22, b23, b31, b32, -b11-b22]);
R1 := matrix(3,3, [r1, 0, 0, 0, r1, 0, 0, 0, -2*r1]);
R2 := matrix(3,3, [r2_11, r2_12, r2_13, r2_21, r2_22, r2_23, r2_31, r2_32, -r2_11-r2_22]);
S := zero_curvature(x = A, t = B, 1 = R1, 2 = R2);
dep := u, v, seq(jet(u,x^i),i=1..N), seq(jet(v,x^i),i=1..N);
dependence(
a11(dep), a12(dep), a13(dep), a21(dep), a22(dep), a23(dep), a31(dep), a32(dep),
b11(dep), b12(dep), b13(dep), b21(dep), b22(dep), b23(dep), b31(dep), b32(dep),
r1(dep),
r2_11(dep), r2_12(dep), r2_13(dep), r2_21(dep), r2_22(dep), r2_23(dep), r2_31(dep), r2_32(dep));
unknowns(
b11, b12, b13, b21, b22, b23, b31, b32,
r1,
r2_11, r2_12, r2_13, r2_21, r2_22, r2_23, r2_31, r2_32,
a21, a22, a31, a32);
a11 := 0;
a12 := 1;
a13 := 0;
a23 := 1;
interface(labelling=false);
Varordering(degree,reverse,function):
`derive/depth` := 1 ;
sizefactor := 80;
ressize := 1000; putsize = 400; maxsize = 200;
`resolve/lin/price` := proc(s, LC, LV, r) option inline; size(s) end:
reporting(run=4, resolve=2, derive=1,cc=1);
TestOfNonImportantness := proc()
description "Returns NULL if current state is important." ;
global A, R1, R2;
local allvars, itemsOfAwithoutZero ;
try
A := map(simpl@evalTD, A);
allvars := `union`(op(map((vars@eval), convert(A,set) union convert(B,set))));
itemsOfAwithoutZero := map(eval, convert(A,set)) minus {0};
if allvars subset {x,t} then
print("TestOfNonImportantness failed, not enough variables: ", d);
"TestOfNonImportantness failed: Not enough variables."
elif map(a -> vars( (simpl@normal@eval)(a/op(1, itemsOfAwithoutZero))), itemsOfAwithoutZero) = {{}} then
print("TestOfNonImportantness failed, A is a multiple of constant matrix.", op(A));
"TestOfNonImportantness failed: A is a multiple of constant matrix."
# elif evalb(convert(map(eval@Diff,op(A),s),set) = {0}) then
# print("TestOfNonImportantness failed, none or trivial parameter.");
# "TestOfNonImportantness failed: None or trivial parameter."
elif evalb(convert(map(normal@eval@evalTD,op(R1)),set)={0}) then
print("R1=0");
"TestOfNonImportantness failed: R1 is 0."
elif evalb(convert(map(normal@eval@evalTD,op(R2)),set)={0}) then
print("R2=0");
"TestOfNonImportantness failed: R is 0."
elif ((A[1,2]=0 and A[1,3]=0) or (A[2,1]=0 and A[2,3]=0) or (A[3,1]=0 and A[3,2]=0)
or (A[2,1]=0 and A[3,1]=0) or (A[1,2]=0 and A[3,2]=0) or (A[1,3]=0 and A[2,3]=0)) then
print("TestOfNonImportantness failed, A fall into the subalgebra: ", op(A));
"TestOfNonImportantness failed: A fall into the subalgebra."
elif ormap(has, map(Simpl, `nonzero/s`), 0) then
print("TestOfNonImportantness failed, declared nonzero became zero: ", `nonzero/s`);
"TestOfNonImportantness failed: declared nonzero became zero."
# elif evalb(simpl(eval(variation(F,u)))=0) then
# print("TestOfNonImportantness failed, variation(F,u) is zero: ", 'F'=factor(F));
# "TestOfNonImportantness failed, variation(F,u) is zero."
else
# print("TestOfNonImportantness ok, ", d);
NULL
fi
catch:
print("Error in TestOfNonImportantness:");
print(StringTools[FormatMessage](lastexception[2..-1]));
end try
end proc;
# C
N := 1;
coordinates([t,x], [u,v], N+3);
equation(
'u_t' = v*u_x + 1/(v - u),
'v_t' = u*v_x + 1/(u - v));
with(linalg):
A := matrix(3,3, [a11, a12, a13, a21, a22, a23, a31, a32, -a11-a22]);
B := matrix(3,3, [b11, b12, b13, b21, b22, b23, b31, b32, -b11-b22]);
R1 := matrix(3,3, [r1, 0, 0, 0, r1, 0, 0, 0, -2*r1]);
R2 := matrix(3,3, [r2_11, r2_12, r2_13, r2_21, r2_22, r2_23, r2_31, r2_32, -r2_11-r2_22]);
S := zero_curvature(x = A, t = B, 1 = R1, 2 = R2);
dep := u, v, seq(jet(u,x^i),i=1..N), seq(jet(v,x^i),i=1..N);
dependence(
a11(dep), a12(dep), a13(dep), a21(dep), a22(dep), a23(dep), a31(dep), a32(dep),
b11(dep), b12(dep), b13(dep), b21(dep), b22(dep), b23(dep), b31(dep), b32(dep),
r1(dep),
r2_11(dep), r2_12(dep), r2_13(dep), r2_21(dep), r2_22(dep), r2_23(dep), r2_31(dep), r2_32(dep));
unknowns(
b11, b12, b13, b21, b22, b23, b31, b32,
r1,
r2_11, r2_12, r2_13, r2_21, r2_22, r2_23, r2_31, r2_32,
a11, a12, a21, a22, a31, a32);
a13 := 1;
a23 := 0;
interface(labelling=false);
Varordering(degree,reverse,function):
`derive/depth` := 1 ;
sizefactor := 80;
ressize := 1000; putsize = 400; maxsize = 200;
`resolve/lin/price` := proc(s, LC, LV, r) option inline; size(s) end:
reporting(run=4, resolve=2, derive=1,cc=1);
TestOfNonImportantness := proc()
description "Returns NULL if current state is important." ;
global A, R1, R2;
local allvars, itemsOfAwithoutZero ;
try
A := map(simpl@evalTD, A);
allvars := `union`(op(map((vars@eval), convert(A,set) union convert(B,set))));
itemsOfAwithoutZero := map(eval, convert(A,set)) minus {0};
if allvars subset {x,t} then
print("TestOfNonImportantness failed, not enough variables: ", d);
"TestOfNonImportantness failed: Not enough variables."
elif map(a -> vars( (simpl@normal@eval)(a/op(1, itemsOfAwithoutZero))), itemsOfAwithoutZero) = {{}} then
print("TestOfNonImportantness failed, A is a multiple of constant matrix.", op(A));
"TestOfNonImportantness failed: A is a multiple of constant matrix."
# elif evalb(convert(map(eval@Diff,op(A),s),set) = {0}) then
# print("TestOfNonImportantness failed, none or trivial parameter.");
# "TestOfNonImportantness failed: None or trivial parameter."
elif evalb(convert(map(normal@eval@evalTD,op(R1)),set)={0}) then
print("R1=0");
"TestOfNonImportantness failed: R1 is 0."
elif evalb(convert(map(normal@eval@evalTD,op(R2)),set)={0}) then
print("R2=0");
"TestOfNonImportantness failed: R is 0."
elif ((A[1,2]=0 and A[1,3]=0) or (A[2,1]=0 and A[2,3]=0) or (A[3,1]=0 and A[3,2]=0)
or (A[2,1]=0 and A[3,1]=0) or (A[1,2]=0 and A[3,2]=0) or (A[1,3]=0 and A[2,3]=0)) then
print("TestOfNonImportantness failed, A fall into the subalgebra: ", op(A));
"TestOfNonImportantness failed: A fall into the subalgebra."
elif ormap(has, map(Simpl, `nonzero/s`), 0) then
print("TestOfNonImportantness failed, declared nonzero became zero: ", `nonzero/s`);
"TestOfNonImportantness failed: declared nonzero became zero."
# elif evalb(simpl(eval(variation(F,u)))=0) then
# print("TestOfNonImportantness failed, variation(F,u) is zero: ", 'F'=factor(F));
# "TestOfNonImportantness failed, variation(F,u) is zero."
else
# print("TestOfNonImportantness ok, ", d);
NULL
fi
catch:
print("Error in TestOfNonImportantness:");
print(StringTools[FormatMessage](lastexception[2..-1]));
end try
end proc;
# D
N := 1;
coordinates([t,x], [u,v], N+3);
equation(
'u_t' = v*u_x + 1/(v - u),
'v_t' = u*v_x + 1/(u - v));
with(linalg):
A := matrix(3,3, [a11, a12, a13, a21, a22, a23, a31, a32, -a11-a22]);
B := matrix(3,3, [b11, b12, b13, b21, b22, b23, b31, b32, -b11-b22]);
R1 := matrix(3,3, [r1, 0, 0, 0, r1, 0, 0, 0, -2*r1]);
R2 := matrix(3,3, [r2_11, r2_12, r2_13, r2_21, r2_22, r2_23, r2_31, r2_32, -r2_11-r2_22]);
S := zero_curvature(x = A, t = B, 1 = R1, 2 = R2);
dep := u, v, seq(jet(u,x^i),i=1..N), seq(jet(v,x^i),i=1..N);
dependence(
a11(dep), a12(dep), a13(dep), a21(dep), a22(dep), a23(dep), a31(dep), a32(dep),
b11(dep), b12(dep), b13(dep), b21(dep), b22(dep), b23(dep), b31(dep), b32(dep),
r1(dep),
r2_11(dep), r2_12(dep), r2_13(dep), r2_21(dep), r2_22(dep), r2_23(dep), r2_31(dep), r2_32(dep));
unknowns(
b11, b12, b13, b21, b22, b23, b31, b32,
r1,