File: experi.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 (36 lines) | stat: -rw-r--r-- 908 bytes parent folder | download | duplicates (4)
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
restart
debug needsPackage "NumericalAlgebraicGeometry"
load "quadratic_tp_experiment.m2"
needs "example_2d.m2"

R = CC[x]
f = (x-3) * (x-2) * x * (x+1)
g = (x-5) * (x-1) * (x+3) * (x+4)
S = CC[x,t]
h = matrix {{t*sub(g,S) + (1-t)*sub(f,S)}}
(t0, t1) = (0, 1)
sols = trackSegment(H, 0, 1, {point{{3}},point{{2}},point{{0}},point{{-1}}})

peek sols#2
x0 = ((1/2) * (matrix sols#2 + matrix sols#3))_(0,0)
t0 = sub((sols#2).LastT,CC)
lli = sub(.05,CC)

approxi ={{x0,t0}}



deflationMethod = (H, approx, ll) -> (
    ldimm := # gens R;
    R'' := CC[x,t,l_1..l_ldimm];
    H'' := sub(H,R'');
    l' := matrix{drop (gens R'',{0,1})};
    JJ := sub(submatrix'(jacobian H,{1},),R'');
    JJ' := JJ*l';
    vv := random(CC^1,CC^ldimm);
    vv' := vv*transpose l'+1;
    N' := polySystem{H'',JJ',vv'};
    pp := point{append(flatten approx, ll)};
    Approx :=  newton(N',pp)
    )
deflationMethod(h, approxi, lli)