File: SoftwareM2engine.tst.m2

package info (click to toggle)
macaulay2 1.24.11%2Bds-5
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 171,648 kB
  • sloc: cpp: 107,850; ansic: 16,307; javascript: 4,188; makefile: 3,947; lisp: 682; yacc: 604; sh: 476; xml: 177; perl: 114; lex: 65; python: 33
file content (59 lines) | stat: -rw-r--r-- 2,104 bytes parent folder | download | duplicates (3)
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
debug needsPackage "NumericalAlgebraicGeometry"
needs "NumericalAlgebraicGeometry/benchmarks.m2"
NAGtrace 1

I = linearExample()
assert areEqual(solveSystem(I_*)/coordinates, {{2,1}})

for predictor in {RungeKutta4,Tangent,Euler} do (
     (S,T,solsS) = smallExample();
     M = track(S,T,solsS, gamma=>0.6+0.8*ii, Software=>M2engine, Predictor=>predictor);
     SM = sortSolutions M;
     assert areEqual(SM/coordinates, {{-1, 0}, {0, -1}, {0, 1}, {1, 0}} );
     )
(S,T,solsS) = smallInfinityExample()
M = track(S,T,solsS, gamma=>0.6+0.8*ii, Software=>M2engine);
assert all({0,2}, i->status M#i != Regular) 
assert all({1,3}, i->status M#i == Regular) 

assert((M#3).cache.LastT>0.99999 and (M#3).cache.NumberOfSteps < 20)

T = cyclic(5,CC) 
M = solveSystem(T_*, 
    --CorrectorTolerance=>1e-6, tStepMin=>1e-7, tStep=>1e-2, 
    Software=>M2engine, PostProcess=>false);
S = apply(M,status);
assert(#select(S, s->s==Regular) == 70
    and #select(S, s->s==IncreasePrecision) + #select(S, s->s==Infinity) + #select(S, s->s==MinStepFailure) == 50 )

-- projective tracking (including Certified)
for predictor in {RungeKutta4,Tangent,Certified} do (
     (S,T,solsS) = smallExample();
     M = track(S,T,solsS, gamma=>0.6+0.8*ii, Software=>M2engine, Predictor=>predictor, Projectivize=>true, Normalize=>true);
     SM = sortSolutions M;
     assert areEqual( SM/coordinates, {{ -1, 0}, {0, -1}, {0, 1}, {1, 0}}, Tolerance=>0.03);
     )		    
for predictor in {RungeKutta4,Tangent,Certified} do (
     T = (fekete4())_*;	    
     (S,solsS) := totalDegreeStartSystem T;
     sols = {{-.707107-1.22474*ii,1_CC}, {1.41421_CC,1_CC}, {-.707107+1.22474*ii,1_CC}, {0_CC,1_CC}};
     for a to 10 do (
	  g = exp((0.1+a)*ii);
     	  s1' = track(S,T,solsS,gamma=>g,Predictor=>predictor);
	  s1 = sortSolutions( s1' / (p->toAffineChart(1,coordinates p)|{1_CC}), Tolerance=>1e-4);
     	  s2 = sortSolutions sols;
	  assert areEqual(s1,s2,Tolerance=>1e-4)
     	  )
     )		    

-- a non-square system
CC[x,y]
solveSystem{x^2,y^2,x+y}
QQ[x,y]
solveSystem{x^2,y^2,x+y}
end

restart
load "SoftwareM2engine.tst.m2"