1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306
|
-- NumSchCalcTEST.m2
restart
loadPackage ("NumericalSchubertCalculus", FileName=>currentFileDirectory|"/../NumericalSchubertCalculus.m2")
setRandomSeed 2
-- this should return local coords w.r.t. Id and op.Id
-- June4,2014: right now, it returns M*s where
-- M is the moving flag and s is a solution
-- to L1 vs L2 wrt Id and opId respectivamente
solveInternalProblem((2,4),{2,1},{1},{})
solveInternalProblem((3,6),{2,1},{3,2,1},{})
solveInternalProblem((3,6),{3,2,1},{2,1},{})
-- this should return {}
solveInternalProblem((2,4),{1,1},{2},{})
solveInternalProblem((3,6),{2,1,1},{3,1},{})
solveInternalProblem((3,6),{3,2,1},{1,1},{})
-- this should call resolveNode
---------------------------------
restart
loadPackage ("NumericalSchubertCalculus", FileName=>currentFileDirectory|"/../NumericalSchubertCalculus.m2")
setRandomSeed 2
n=4
--n = 6
M = MovingFlag'at'Root n
Minv = solve(M, id_(FFF^n))
T1 = id_(FFF^n)+random(FFF^n,FFF^n,UpperTriangular=>true)
S1 = solve(T1, id_(FFF^n))
Idop = rsort id_(FFF^n)
F1 = S1*Idop
--F1 = S1*sub(M,FFF)
S = solveInternalProblem((2,4),{1,1},{1,0},{({1,0},F1, T1)})
s = first S
checkIncidenceSolution(s, {({1,1},M), ({1,0},rsort(id_(FFF^n))), ({1,0},F1)})
-- --- TEST June 15 ------------
n=6
M = MovingFlag'at'Root n
Minv = solve(M, id_(FFF^n))
T1 = id_(FFF^n)+random(FFF^n,FFF^n,UpperTriangular=>true)
S1 = solve(T1, id_(FFF^n))
Idop = rsort id_(FFF^n)
F1 = S1*Idop
--F1 = S1*sub(M,FFF)
S = solveInternalProblem((3,6),{3,2,1},{1,1},{({1,0},F1, T1)})
s = first S
s
checkIncidenceSolution(s, {({3,2,1},M), ({1,1},rsort(id_(FFF^n))), ({1,0},F1)})
checkIncidenceSolution(s,{({2,1},rsort(id_(FFF^n)))})
checkIncidenceSolution(s,{({3,2,1},M), ({2,0},rsort(id_(FFF^n)))})
S = solveInternalProblem((3,6),{2,1},{2,1},{({2,1},F1, T1)})
s = first S
s
-------- end of TEST june 15 ------------------
T2 = id_(FFF^n)+random(FFF^n,FFF^n,UpperTriangular=>true)
S2 = solve(T2, id_(FFF^n))
--F2 = S1*sub(M,FFF)
F12 = S2*Minv*F1
s2 = clean_0.0001 (S2*Minv*s)
F2 = S2*Minv*Idop
S2 = solveInternalProblem((2,4),{1,0},{1,0},{({1,0},F2, T2), ({1,0},F12,T1)})
s2 = first S2
checkIncidenceSolution(s, {({1,1},M), ({1,0},id_(FFF^n)), ({1,0},F1)})
checkIncidenceSolution(s2, {({1,1},id_(FFF^n)), ({1,0},S2*Minv), ({1,0},F12)})
checkIncidenceSolution(s2, {({1,1},id_(FFF^n)), ({1,0},S2*Minv), ({1,0},F12)})
--------
T1 = id_(FFF^n)+random(FFF^n,FFF^n,UpperTriangular=>true)
S1 = solve(T1, id_(FFF^n))
T2 = id_(FFF^n)+random(FFF^n,FFF^n,UpperTriangular=>true)
S2 = solve(T2, id_(FFF^n))
F2 = S1*Minv
F1 = S2*Minv*S1*Idop
--F12 =S2*Minv*F1
S = solveInternalProblem((2,4), {1,0}, {1,0}, {({1,0}, F2, T2),({1,0},F1,T1)})
--solveInternalProblem((2,4),{1,0},{1,0},{})
s = M*first S
checkIncidenceSolution(s,{({1,1},M),({1},id_(FFF^n)),({1},F1)})
------------------------
setRandomSeed 2
n=4
T1 = id_(FFF^n)+random(FFF^n,FFF^n,UpperTriangular=>true)
S1 = solve(T1, id_(FFF^n))
F1 = S1*sub(M,FFF)
T2 = id_(FFF^n)+random(FFF^n,FFF^n,UpperTriangular=>true)
S2 = solve(T2, id_(FFF^n))
F2 = S1*S2*sub(M,FFF)
S = solveInternalProblem((2,4),{1,0},{1,0},{({1,0},F1, T1), ({1,0},F2,T2)})
s = first S
checkIncidenceSolution(s,{({1},M),({1},id_(FFF^n)),({1},F1), ({1},F2)})
-- this one should break as the flags are not in general position
-- so it shouldn't have equations
solveInternalProblem((2,4),{1,1},{1},{({1},id_(FFF^4), id_(FFF^4))})
solveInternalProblem((3,6),{2,1},{3,1},{})
(k,n)=(3,6);
-- OK
l1 = {2,1,0}
l2 = {3,2,1}
checkOrthogonal=l1+reverse l2
(l1+reverse l2)/(i->n-k-i)
l1 = {2,1,0}
l2 = {3,1,0}
checkOrthogonal=l1+reverse l2
(l1+reverse l2)/(i->n-k-i)
-- not OK
l1 = {2,1,0}
l2 = {3,3,0}
checkOrthogonal=l1+reverse l2
(l1+reverse l2)/(i->n-k-i)
l1 = {2,1,1}
l2 = {3,1,0}
checkOrthogonal=l1+reverse l2
(l1+reverse l2)/(i->n-k-i)
-------------------------------------------
SchPblm = {({2},random(FFF^6,FFF^6)),
({2},random(FFF^6,FFF^6)),
({2},random(FFF^6,FFF^6)),
({2,1},random(FFF^6,FFF^6))};
t1 = cpuTime();
S1=solveSchubertProblem(SchPblm,3,6);
t2 = cpuTime();
SchPblm =reverse SchPblm;
t3 = cpuTime();
S2=solveSchubertProblem(SchPblm,3,6);
t4 = cpuTime();
<<"time it consumed first run: "<< t2-t1<<endl;
<<"time it consumed second run: "<< t4-t3<<endl;
<< "Solutions 1"<<endl<< S1<<endl;
<< "Solutions 2"<<endl<<S2<<endl;
S1reduced = apply(S1, s->(
k:=numColumns(s);
b:= id_(CC^k);
T:= solve(submatrix(s,0..k-1,0..k-1),b);
clean(0.001,s*T)
));
S1reduced
S2reduced = apply(S2, s->(
k:=numColumns(s);
b:= id_(CC^k);
T:= solve(submatrix(s,0..k-1,0..k-1),b);
clean(0.001,s*T)
));
S2reduced
-- Problem of 4 osculating lines (real solutions)
Pblm = {({1},id_(FFF^4)),
({1},rsort id_(FFF^4)),
({1},transpose matrix {{1,1,1,1},{0,1,2,3},{0,0,2,6},{0,0,0,1}}),
({1},transpose matrix {{1,2,4,8}, {0,1,4,12}, {0,0,1,6}, {0,0,0,1}})}
solveSchubertProblem(Pblm, 2,4)
-- 1^10 = 42 in G(2,7)
setRandomSeed 2
Pblm = {({1}, random(FFF^7,FFF^7)),
({1}, random(FFF^7,FFF^7)),
({1}, random(FFF^7,FFF^7)),
({1}, random(FFF^7,FFF^7)),
({1}, random(FFF^7,FFF^7)),
({1}, random(FFF^7,FFF^7)),
({1}, random(FFF^7,FFF^7)),
({1}, random(FFF^7,FFF^7)),
({1}, random(FFF^7,FFF^7)),
({1}, random(FFF^7,FFF^7))
};
-- increase the recursion level:
recursionLimit = 1000;
solveSchubertProblem(Pblm, 2,7)
-- 1^8 = 14 in G(2,6)
setRandomSeed 2
Pblm = {({1}, random(FFF^6,FFF^6)),
({1}, random(FFF^6,FFF^6)),
({1}, random(FFF^6,FFF^6)),
({1}, random(FFF^6,FFF^6)),
({1}, random(FFF^6,FFF^6)),
({1}, random(FFF^6,FFF^6)),
({1}, random(FFF^6,FFF^6)),
({1}, random(FFF^6,FFF^6))
};
solveSchubertProblem(Pblm, 2,6)
-- 1^6 = 5 in G(2,5)
setRandomSeed 2
Pblm = {({1}, random(FFF^5,FFF^5)),
({1}, random(FFF^5,FFF^5)),
({1}, random(FFF^5,FFF^5)),
({1}, random(FFF^5,FFF^5)),
({1}, random(FFF^5,FFF^5)),
({1}, random(FFF^5,FFF^5))
};
solveSchubertProblem(Pblm, 2,5)
-- Problem of 4 osculating lines (real solutions)
Pblm = {({1},id_(FFF^4)),
({1},rsort id_(FFF^4)),
({1},transpose matrix {{1,1,1,1},{0,1,2,3},{0,0,2,6},{0,0,0,1}}),
({1},transpose matrix {{1,2,4,8}, {0,1,4,12}, {0,0,1,6}, {0,0,0,1}})}
solveSchubertProblem(Pblm, 2,4)
-- we need to make a column reduction
-- to see if these solutions are real
S = oo;
Sreduced = apply(S, s->(
M1:= matrix{
{s_(0,0)^(-1), -s_(0,1)*s_(0,0)^-1},
{0, 1}};
s1 := clean_0.001 s*M1;
M2 := matrix{
{1,0},
{-s1_(3,0)*s1_(3,1)^-1 ,s1_(3,1)^-1 }
};
s2 := clean(0.001, s1*M2);
s2
));
Sreduced
setRandomSeed 2
SchPblm = {({1},id_(FFF^4)),
({1},random(FFF^4,FFF^4)),
({1},random(FFF^4,FFF^4)),
({1},random(FFF^4,FFF^4))};
S=solveSchubertProblem(SchPblm,2,4);
S
setRandomSeed 2
SchPblm = {({2,1},random(FFF^6,FFF^6)),
({2,1},random(FFF^6,FFF^6)),
({2,1},random(FFF^6,FFF^6))};
S=solveSchubertProblem(SchPblm,3,6);
S
setRandomSeed 2
Pblm={({1},random(FFF^6,FFF^6)),
({2}, random(FFF^6,FFF^6)),
({2,1},random(FFF^6,FFF^6)),
({2,1},random(FFF^6,FFF^6))};
S = solveSchubertProblem(Pblm,3,6);
S
setRandomSeed 2
Pblm={({1},random(FFF^6,FFF^6)),
({2},random(FFF^6,FFF^6)),
({2,1},random(FFF^6,FFF^6)),
({2,1},random(FFF^6,FFF^6))};
S = solveSchubertProblem(Pblm,3,6);
--- Fails here
restart
loadPackage ("NumericalSchubertCalculus", FileName=>currentFileDirectory|"/../NumericalSchubertCalculus.m2")
setRandomSeed 2
Pblm={({1},random(FFF^6,FFF^6)),
({1}, random(FFF^6,FFF^6)),
({1},random(FFF^6,FFF^6)),
({2,1},random(FFF^6,FFF^6)),
({2,1},random(FFF^6,FFF^6))};
S = solveSchubertProblem(Pblm,3,6);
quit
----------------------
|