File: Bertini.test.m2

package info (click to toggle)
macaulay2 1.21%2Bds-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 133,096 kB
  • sloc: cpp: 110,377; ansic: 16,306; javascript: 4,193; makefile: 3,821; sh: 3,580; lisp: 764; yacc: 590; xml: 177; python: 140; perl: 114; lex: 65; awk: 3
file content (63 lines) | stat: -rw-r--r-- 1,774 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
60
61
62
63
-- this file is created to test Bertini interface
setDefault (Software=>BERTINI) 

R = CC[x,y];
S = {x^2-1,y^2-1};
T = {x^2+y^2-1, x*y};
solsS = point\{{{1,-1}},{{1,1}},{{-1,1}},{{-1,-1}}};
solsT = point\{{{1,0}},{{0,1}},{{-1,0}},{{0,-1}}};

/// -- larger example (commented out)
loadPackage "NumericalAlgebraicGeometry"
load "../benchmarks.m2"
T = (katsuraBench 11)_*; -- #sols=1024, M2:4, H:7, B:15, P:37                                                 
(S,solsS) = totalDegreeStartSystem T; 
///

-- solveSystem
sols = solveSystem T
assert(areEqual(sortSolutions solsT, sortSolutions sols))

-- track
sols = track(S,T,solsS)
assert(areEqual(sortSolutions solsT, sortSolutions sols))

-- refine 
R = CC[x,y];
T = {x^2+y^2-1, x*y};
sols = { point{{1.00000001,0.00000001}}, point{{ -0.0000001,1.0000002}} };
rsols = refine(T, sols, Bits=>1000)
assert areEqual(sortSolutions rsols, point\{{{0,1}},{{1,0}}})

-- numericalVariety
V = numericalIrreducibleDecomposition ideal T
assert(dim V == 0 and degree V == 4)
V = numericalIrreducibleDecomposition ideal (x^6-y^2)
assert all(components V, W->W.cache.IsIrreducible===true)

-- parameterHomotopy
R=CC[u1,u2,u3,x,y]
f1=u1*(y-1)+u2*(y-2)+u3*(y-3)
f2=(x-11)*(x-12)*(x-13)
finalParameters0={1,0,0}
finalParameters1={0,1+2*ii,0}
sols = parameterHomotopy(
    {f1,f2},
    {u1,u2,u3},-- parameters
    {finalParameters0,finalParameters1}
    )
assert areEqual(sortSolutions first sols, sortSolutions\\point\{{{11, 1}}, {{12, 1}}, {{13, 1}}})

-- isOn
R = CC[x,y,z];
F = {(y^2+x^2+z^2-1)*x,(y^2+x^2+z^2-1)*y};
NV = numericalIrreducibleDecomposition ideal F
p = point{{0,0,0}} --z-axis
assert isOn(p, NV)

end

restart
needsPackage "NumericalAlgebraicGeometry"
errorDepth = 2
load "NumericalAlgebraicGeometry/Bertini/Bertini.test.m2"