bertiniteam / b2

Bertini 2.0: The redevelopment of Bertini in C++.
88 stars 34 forks source link

False success on pybertini #153

Closed jbcolli2 closed 6 years ago

jbcolli2 commented 6 years ago

When running the pybertini endgame tutorial, using a different system defined by (x+2)(y-3) (x^2-1)(y-5).

The result of the pybertini endgame tutorial is the three correct roots, but also a double root at x=-2, y=-2.5. These paths should have failed. Not sure if this is an issue with the core code or pybertini alone.

ofloveandhate commented 6 years ago

can you please post complete code to replicate the issue?

ofloveandhate commented 6 years ago

thanks for the good labeling you've been doing, too!

jbcolli2 commented 6 years ago

Here is the complete code. Should be just the endgame tutorial with a different system.

import pybertini
import copy

gw = pybertini.System()

x = pybertini.Variable("x")
y = pybertini.Variable("y")

vg = pybertini.VariableGroup()
vg.append(x)
vg.append(y)
gw.add_variable_group(vg)

gw.add_function((x+2)*(y-3))
gw.add_function((x**2 - 1)*(y-5))

t = pybertini.Variable('t')
td = pybertini.system.start_system.TotalDegree(gw)
gamma = pybertini.function_tree.symbol.Rational.rand()
hom = (1-t)*gw + t*gamma*td
hom.add_path_variable(t)

tr = pybertini.tracking.AMPTracker(hom)

start_time = pybertini.multiprec.Complex("1")
eg_boundary = pybertini.multiprec.Complex("0.1")

midpath_points = [None]*td.num_start_points()
for ii in range(td.num_start_points()):
        midpath_points[ii] = pybertini.multiprec.Vector()
        code = tr.track_path(result=midpath_points[ii], start_time=start_time, end_time=eg_boundary, start_point=td.start_point_mp(ii))
        if code != pybertini.tracking.SuccessCode.Success:
                print('uh oh, tracking a path before the endgame boundary failed, successcode ' + code)

eg = pybertini.endgame.AMPCauchyEG(tr)

# make an observer to be able to see what's going on inside
ob = pybertini.endgame.observers.amp_cauchy.GoryDetailLogger()

#eg.add_observer(ob)

assert(eg.cycle_number()==0)

final_points = []

target_time = pybertini.multiprec.Complex(0)
codes = []
for ii in range(td.num_start_points()):
        eg_boundary.precision( midpath_points[ii][0].precision())
        target_time.precision( midpath_points[ii][0].precision())
        print('before {} {} {}'.format(eg_boundary.precision(), target_time.precision(), midpath_points[ii][0].precision()))
        codes.append(eg.run(start_time=eg_boundary, target_time=target_time, start_point=midpath_points[ii]))
        print('path {} -- code {}'.format(ii,codes[-1]))
        print(eg.final_approximation())
        final_points.append(eg.final_approximation())
#        final_points.append(copy.deepcopy(eg.final_approximation()))
        print('after {} {} {}'.format(eg_boundary.precision(), target_time.precision(), midpath_points[ii][0].precision()))
ofloveandhate commented 6 years ago

this is due to not working projectively. homogenize() and auto_patch() the target system before doing the rest, and then dehomogenize_point(eg.final_approximation()) and you will get the correct behaviour.

ofloveandhate commented 6 years ago
import pybertini
import copy

gw = pybertini.System()

x = pybertini.Variable("x")
y = pybertini.Variable("y")

vg = pybertini.VariableGroup()
vg.append(x)
vg.append(y)
gw.add_variable_group(vg)

gw.add_function((x+2)*(y-3))
gw.add_function((x**2 - 1)*(y-5))

gw.homogenize()  #added
gw.auto_patch()  #added

t = pybertini.Variable('t')
td = pybertini.system.start_system.TotalDegree(gw)
gamma = pybertini.function_tree.symbol.Rational.rand()
hom = (1-t)*gw + t*gamma*td
hom.add_path_variable(t)

tr = pybertini.tracking.AMPTracker(hom)

start_time = pybertini.multiprec.Complex("1")
eg_boundary = pybertini.multiprec.Complex("0.1")

midpath_points = [None]*td.num_start_points()
for ii in range(td.num_start_points()):
        midpath_points[ii] = pybertini.multiprec.Vector()
        code = tr.track_path(result=midpath_points[ii], start_time=start_time, end_time=eg_boundary, start_point=td.start_point_mp(ii))
        if code != pybertini.tracking.SuccessCode.Success:
                print('uh oh, tracking a path before the endgame boundary failed, successcode ' + code)

eg = pybertini.endgame.AMPCauchyEG(tr)

target_time = pybertini.multiprec.Complex(0)

final_points = []
codes = []
for ii in range(td.num_start_points()):
        eg_boundary.precision( midpath_points[ii][0].precision())
        target_time.precision( midpath_points[ii][0].precision())
        codes.append(eg.run(start_time=eg_boundary, target_time=target_time, start_point=midpath_points[ii]))
        print('path {} -- code {}'.format(ii,codes[-1]))
        print(eg.final_approximation())
        print(gw.dehomogenize_point(eg.final_approximation()))
        final_points.append(eg.final_approximation())

# the next commented-out line is what *should* be used to store the points, 
# but currently (20180613) deep copy is now working because serialization is not enabled.

#        final_points.append(copy.deepcopy(eg.final_approximation()))

# broken code because of not deep copying:
for p in final_points:
        print(gw.dehomogenize_point(p))
ofloveandhate commented 6 years ago

ok, after replicating a homotopy with bertini1's userhomotopy:1 mode, i agree that there is an issue.

input

% to replicate a run from bertini2

CONFIG

userhomotopy: 1;

END;

INPUT

function f1,f2;

variable x,y;
pathvariable s;
parameter t;
t = s;

f1 = (((t*(-3282137096069714/3024842185047415+I*-2821143723555940/1673836210268841))*((x^2)-(87875689673604064165221985854203548465865180691292/8911565280764980293934931900449430513350337560581+I*-92031624450269693309676773076457207663154971209561/36829431348433428313705797321460662044567237237590)))+((1-t)*((x+2)*(y-3))));
f2 = (((t*(-3282137096069714/3024842185047415+I*-2821143723555940/1673836210268841))*((y^3)-(9215126146405988386300422552813438491596469014004/18831809439874092151531390861220941995712612447011+I*-34979570316540871529966189550041755413443953059471/3298415588464117388268211317293113094514010909093)))+((1-t)*(((x^2)-1)*(y-5))));

END;

with start

6

3.16492 -0.394775
1.92002 -1.06952

-3.16492 0.394775
1.92002 -1.06952

3.16492 -0.394775
-0.0337788 2.19755

-3.16492 0.394775
-0.0337788 2.19755

3.16492 -0.394775
-1.88625 -1.12803

-3.16492 0.394775
-1.88625 -1.12803
ofloveandhate commented 6 years ago

here's the output from that bertini1 run:

Path number 0:
Starting with:
time: <1.0000000000e+00 0.0000000000e+00>
Point: <3.164920000000000e+00 -3.947750000000000e-01> <1.920020000000000e+00 -1.069520000000000e+00> 
H(Point, time):
     <-1.614532456762844e-05 -1.868294738443188e-05> <1.326721199580235e-04 -7.008519638671181e-05> 

numSteps = 12
numSteps = 5
numSteps = 1
numSteps = 1
numSteps = 1
numSteps = 1
numSteps = 1

Ending with
time: <0.0000000000e+00 0.0000000000e+00>
Point: <1.000000000000000e+00 -5.421010862427522e-18> <3.000000000000000e+00 -9.215718466126788e-19> 
Orig f(Point, time):
     <-4.995850990994722e-36 -2.764715539838036e-18> <-9.991701981989444e-36 2.168404344971009e-17> 
||H(Point, time)||: 2.168404344971009e-17

_____________________________________________________

Path number 1:
Starting with:
time: <1.0000000000e+00 0.0000000000e+00>
Point: <-3.164920000000000e+00 3.947750000000000e-01> <1.920020000000000e+00 -1.069520000000000e+00> 
H(Point, time):
     <-1.614532456762844e-05 -1.868294738443188e-05> <1.326721199580235e-04 -7.008519638671181e-05> 

numSteps = 16
numSteps = 7
numSteps = 7
numSteps = 6
numSteps = 7
numSteps = 6
numSteps = 6
numSteps = 6
numSteps = 7
Path was truncated for approaching infinity (inf-norm of path approximation exceeded 1.000000e+04).

Ending with
time: <1.5258789063e-06 0.0000000000e+00>
Point: <-2.000000009006967e+00 -1.760313185738094e-08> <8.669053014425082e+02 -4.742912382841274e+02> 
Orig f(Point, time):
     <1.365738102579624e-13 -7.498016117225056e-14> <0.000000000000000e+00 4.547473508864641e-13> 
||H(Point, time)||: 4.547473508864641e-13

_____________________________________________________

Path number 2:
Starting with:
time: <1.0000000000e+00 0.0000000000e+00>
Point: <3.164920000000000e+00 -3.947750000000000e-01> <-3.377880000000000e-02 2.197550000000000e+00> 
H(Point, time):
     <-1.614532456762844e-05 -1.868294738443188e-05> <3.113657795789085e-05 -1.887219571865998e-05> 

numSteps = 12
numSteps = 7
numSteps = 7
numSteps = 10
Path was truncated for approaching infinity (inf-norm of path approximation exceeded 1.000000e+04).

Ending with
time: <1.5625000000e-03 0.0000000000e+00>
Point: <3.471275621333332e+02 -5.360718072313713e+02> <4.999999040980838e+00 6.292002869164383e-08> 
Orig f(Point, time):
     <0.000000000000000e+00 2.273736754432321e-13> <1.688055251136689e-11 3.764732969813167e-11> 
||H(Point, time)||: 4.125862923666808e-11

_____________________________________________________

Path number 3:
Starting with:
time: <1.0000000000e+00 0.0000000000e+00>
Point: <-3.164920000000000e+00 3.947750000000000e-01> <-3.377880000000000e-02 2.197550000000000e+00> 
H(Point, time):
     <-1.614532456762844e-05 -1.868294738443188e-05> <3.113657795789085e-05 -1.887219571865998e-05> 

numSteps = 19
numSteps = 3
numSteps = 1
numSteps = 1
numSteps = 1
numSteps = 1
numSteps = 1
numSteps = 1

Ending with
time: <0.0000000000e+00 0.0000000000e+00>
Point: <-2.000000000000000e+00 8.809142651444724e-20> <5.000000000000000e+00 1.517883041479706e-18> 
Orig f(Point, time):
     <-1.337124824060352e-37 1.761828530288945e-19> <5.348499296241408e-37 4.553649124439119e-18> 
||H(Point, time)||: 4.553649124439119e-18

_____________________________________________________

Path number 4:
Starting with:
time: <1.0000000000e+00 0.0000000000e+00>
Point: <3.164920000000000e+00 -3.947750000000000e-01> <-1.886250000000000e+00 -1.128030000000000e+00> 
H(Point, time):
     <-1.614532456762844e-05 -1.868294738443188e-05> <-8.632843637591733e-05 9.118292170298419e-05> 

numSteps = 12
numSteps = 8
numSteps = 1
numSteps = 1
numSteps = 1
numSteps = 1
numSteps = 1

Ending with
time: <0.0000000000e+00 0.0000000000e+00>
Point: <-9.999999999999999e-01 -1.164975234335675e-16> <3.000000000000000e+00 1.488067481736355e-16> 
Orig f(Point, time):
     <1.733561763243107e-32 1.488067481736355e-16> <4.440892098500626e-16 -4.659900937342697e-16> 
||H(Point, time)||: 6.437095569926909e-16

_____________________________________________________

Path number 5:
Starting with:
time: <1.0000000000e+00 0.0000000000e+00>
Point: <-3.164920000000000e+00 3.947750000000000e-01> <-1.886250000000000e+00 -1.128030000000000e+00> 
H(Point, time):
     <-1.614532456762844e-05 -1.868294738443188e-05> <-8.632843637591733e-05 9.118292170298419e-05> 

numSteps = 19
numSteps = 3
numSteps = 9
numSteps = 7
numSteps = 7
numSteps = 7
numSteps = 7
numSteps = 7
numSteps = 7
Path was truncated for approaching infinity (inf-norm of path approximation exceeded 1.000000e+04).

Ending with
time: <1.5258789063e-06 0.0000000000e+00>
Point: <-1.999999990987825e+00 1.738463333038082e-08> <-8.719053395560105e+02 4.742911402670249e+02> 
Orig f(Point, time):
     <-1.453505149356590e-15 7.879540932492074e-16> <0.000000000000000e+00 0.000000000000000e+00> 
||H(Point, time)||: 1.653344753000506e-15

_____________________________________________________
Number of failures:  3
Number of successes:  3
Number of paths:  6
Parse Time = 0.006216s
Track Time = 0.008688s
ofloveandhate commented 6 years ago

so, something in bertini2 is ... off. indeed, things should have gone to infinity in your posed problem. why didn't they?

ofloveandhate commented 6 years ago

it's clear from the log that something isn't matching up.

initialized logging
time advanced (0.0125,0)
time advanced (0.00625,0)
time advanced (0.003125,0)
time advanced (0.0015625,0)
made it to the endgame operating zone at time (0.0015625,0)
advanced around the circle, to                      (-1.99981,0.000603115)
                     (-1.73099,-31.2334) at time (-0.00078125,0.00135316)
advanced around the circle, to                      (-2.00022,-0.00051469)
                     (-28.6927,-16.2704) at time (-0.00078125,-0.00135316)
advanced around the circle, to                      (-1.99971,0.000479687)
                     (-29.401,14.9169) at time (0.0015625,0)
advanced around the circle, to                      (-2.00038,-0.00050003)
                     (-3.17086,31.2494) at time (-0.00078125,0.00135316)
advanced around the circle, to                      (-1.99957,0.000625377)
                     (23.6305,16.3623) at time (-0.00078125,-0.00135316)
advanced around the circle, to                       (-2.00027,-0.000715385)
                      (24.3678,-15.0248) at time (0.0015625,0)
closed a loop, cycle number 2
refined a sample, huzzah
refined a sample, huzzah
refined a sample, huzzah
refined a sample, huzzah
refined a sample, huzzah
refined a sample, huzzah
refined a sample, huzzah
approximated the target root.  approximation                       (-1.99999,-3.65423e-06)
                      (-2.49953,2.873e-06) with error 5.8914
time advanced (0.00078125,0)
advanced around the circle, to                      (-1.99992,0.000211999)
                     (-1.43558,-43.9695) at time (-0.000390625,0.000676582)
advanced around the circle, to                       (-2.00008,-0.000187862)
                      (-39.6969,-22.9071) at time (-0.000390625,-0.000676582)
advanced around the circle, to                     (-1.9999,0.000177907)
                    (-40.7297,21.0346) at time (0.00078125,0)
advanced around the circle, to                       (-2.00013,-0.000185417)
                      (-3.51337,43.9776) at time (-0.000390625,0.000676582)
advanced around the circle, to                      (-1.99987,0.000216688)
                     (34.6644,22.9512) at time (-0.000390625,-0.000676582)
advanced around the circle, to                      (-2.0001,-0.000236057)
                     (35.7115,-21.0867) at time (0.00078125,0)
refined a sample, huzzah
refined a sample, huzzah
refined a sample, huzzah
refined a sample, huzzah
refined a sample, huzzah
refined a sample, huzzah
refined a sample, huzzah
approximated the target root.  approximation                     (-2,-4.57248e-07)
                    (-2.49994,3.5399e-07) with error 0.000411964
time advanced (0.000390625,0)
advanced around the circle, to                      (-1.99997,7.43171e-05)
                     (-1.00342,-62.0337) at time (-0.000195312,0.000338291)
advanced around the circle, to                       (-2.00003,-6.79303e-05)
                      (-55.2194,-32.3191) at time (-0.000195312,-0.000338291)
advanced around the circle, to                      (-1.99996,6.52006e-05)
                     (-56.6997,29.6988) at time (0.000390625,0)
advanced around the circle, to                       (-2.00004,-6.75644e-05)
                      (-3.97053,62.0378) at time (-0.000195312,0.000338291)
advanced around the circle, to                      (-1.99996,7.52657e-05)
                     (50.2028,32.3406) at time (-0.000195312,-0.000338291)
advanced around the circle, to                       (-2.00004,-7.96316e-05)
                      (51.6903,-29.7244) at time (0.000390625,0)
refined a sample, huzzah
refined a sample, huzzah
refined a sample, huzzah
refined a sample, huzzah
refined a sample, huzzah
refined a sample, huzzah
refined a sample, huzzah
approximated the target root.  approximation                     (-2,-5.71634e-08)
                    (-2.49999,4.4168e-08) with error 5.1595e-05
time advanced (0.000195312,0)
advanced around the circle, to                     (-1.99999,2.6057e-05)
                    (-0.38534,-87.6212) at time (-9.76562e-05,0.000169146)
advanced around the circle, to                    (-2.00001,-2.44e-05)
                   (-77.1406,-45.6496) at time (-9.76562e-05,-0.000169146)
advanced around the circle, to                      (-1.99999,2.36709e-05)
                     (-79.247,41.963) at time (0.000195312,0)
advanced around the circle, to                      (-2.00001,-2.4355e-05)
                     (-4.6015,87.6233) at time (-9.76562e-05,0.000169146)
advanced around the circle, to                     (-1.99999,2.6249e-05)
                    (72.1322,45.6603) at time (-9.76562e-05,-0.000169146)
advanced around the circle, to                       (-2.00001,-2.72648e-05)
                      (74.2422,-41.9757) at time (0.000195312,0)
refined a sample, huzzah
refined a sample, huzzah
refined a sample, huzzah
refined a sample, huzzah
refined a sample, huzzah
refined a sample, huzzah
refined a sample, huzzah
approximated the target root.  approximation                  (-2,-7.14554e-09)
                 (-2.5,5.51974e-09) with error 6.45094e-06
time advanced (9.76562e-05,0)
advanced around the circle, to                   (-2,9.1476e-06)
                  (0.491619,-123.838) at time (-4.88281e-05,8.45728e-05)
advanced around the circle, to                  (-2,-8.72309e-06)
                 (-108.119,-64.517) at time (-4.88281e-05,-8.45728e-05)
advanced around the circle, to                  (-2,8.53201e-06)
                 (-111.106,59.3163) at time (9.76562e-05,0)
advanced around the circle, to                 (-2,-8.72034e-06)
                (-5.485,123.839) at time (-4.88281e-05,8.45728e-05)
advanced around the circle, to                      (-1.99999,9.18719e-06)
                     (103.115,64.5223) at time (-4.88281e-05,-8.45728e-05)
advanced around the circle, to                  (-2,-9.42873e-06)
                 (106.104,-59.3226) at time (9.76562e-05,0)
refined a sample, huzzah
refined a sample, huzzah
refined a sample, huzzah
refined a sample, huzzah
refined a sample, huzzah
refined a sample, huzzah
refined a sample, huzzah
approximated the target root.  approximation                  (-2,-8.93194e-10)
                 (-2.5,6.89948e-10) with error 8.06392e-07
time advanced (4.88281e-05,0)
advanced around the circle, to                  (-2,3.21613e-06)
                 (1.73273,-175.078) at time (-2.44141e-05,4.22864e-05)
advanced around the circle, to                   (-2,-3.10824e-06)
                  (-151.911,-91.2108) at time (-2.44141e-05,-4.22864e-05)
advanced around the circle, to                 (-2,3.05884e-06)
                (-156.142,83.865) at time (4.88281e-05,0)
advanced around the circle, to                  (-2,-3.10909e-06)
                 (-6.72941,175.079) at time (-2.44141e-05,4.22864e-05)
advanced around the circle, to                 (-2,3.22449e-06)
                (146.909,91.2135) at time (-2.44141e-05,-4.22864e-05)
advanced around the circle, to                  (-2,-3.2828e-06)
                 (151.141,-83.8681) at time (4.88281e-05,0)
refined a sample, huzzah
refined a sample, huzzah
refined a sample, huzzah
refined a sample, huzzah
refined a sample, huzzah
refined a sample, huzzah
refined a sample, huzzah
approximated the target root.  approximation                  (-2,-1.11649e-10)
                 (-2.5,8.62432e-11) with error 1.00799e-07
time advanced (2.44141e-05,0)
advanced around the circle, to                  (-2,1.13225e-06)
                 (3.48797,-247.559) at time (-1.2207e-05,2.11432e-05)
advanced around the circle, to                  (-2,-1.10498e-06)
                 (-213.831,-128.97) at time (-1.2207e-05,-2.11432e-05)
advanced around the circle, to                  (-2,1.09233e-06)
                 (-219.818,118.588) at time (2.44141e-05,0)
advanced around the circle, to                  (-2,-1.10546e-06)
                 (-8.48631,247.559) at time (-1.2207e-05,2.11432e-05)
advanced around the circle, to                (-2,1.13407e-06)
               (208.83,128.971) at time (-1.2207e-05,-2.11432e-05)
advanced around the circle, to                  (-2,-1.14829e-06)
                 (214.817,-118.589) at time (2.44141e-05,0)
refined a sample, huzzah
refined a sample, huzzah
refined a sample, huzzah
refined a sample, huzzah
refined a sample, huzzah
refined a sample, huzzah
refined a sample, huzzah
approximated the target root.  approximation                  (-2,-1.39562e-11)
                 (-2.5,1.07804e-11) with error 1.25999e-08
time advanced (1.2207e-05,0)
advanced around the circle, to                  (-2,3.9905e-07)
                 (5.96998,-350.073) at time (-6.10352e-06,1.05716e-05)
advanced around the circle, to                  (-2,-3.9218e-07)
                 (-301.39,-182.376) at time (-6.10352e-06,-1.05716e-05)
advanced around the circle, to                  (-2,3.88963e-07)
                 (-309.859,167.697) at time (1.2207e-05,0)
advanced around the circle, to                  (-2,-3.9235e-07)
                 (-10.9691,350.073) at time (-6.10352e-06,1.05716e-05)
advanced around the circle, to                 (-2,3.99456e-07)
                (296.389,182.376) at time (-6.10352e-06,-1.05716e-05)
advanced around the circle, to                  (-2,-4.0295e-07)
                 (304.859,-167.698) at time (1.2207e-05,0)
refined a sample, huzzah
refined a sample, huzzah
refined a sample, huzzah
refined a sample, huzzah
refined a sample, huzzah
refined a sample, huzzah
refined a sample, huzzah
approximated the target root.  approximation                  (-2,-1.74452e-12)
                 (-2.5,1.34755e-12) with error 1.57499e-09
time advanced (6.10352e-06,0)
advanced around the circle, to                  (-2,1.40761e-07)
                 (9.47973,-495.059) at time (-3.05176e-06,5.2858e-06)
advanced around the circle, to                  (-2,-1.39034e-07)
                 (-425.21,-257.907) at time (-3.05176e-06,-5.2858e-06)
advanced around the circle, to                  (-2,1.3822e-07)
                 (-437.189,237.152) at time (6.10352e-06,0)
advanced around the circle, to                  (-2,-1.39085e-07)
                 (-14.4793,495.059) at time (-3.05176e-06,5.2858e-06)
advanced around the circle, to                (-2,1.40854e-07)
               (420.21,257.907) at time (-3.05176e-06,-5.2858e-06)
advanced around the circle, to                  (-2,-1.41717e-07)
                 (432.189,-237.152) at time (6.10352e-06,0)
refined a sample, huzzah
refined a sample, huzzah
refined a sample, huzzah
refined a sample, huzzah
refined a sample, huzzah
refined a sample, huzzah
refined a sample, huzzah
approximated the target root.  approximation                  (-2,-2.18065e-13)
                 (-2.5,1.68443e-13) with error 1.96874e-10
time advanced (3.05176e-06,0)
advanced around the circle, to                  (-2,4.96837e-08)
                 (14.4429,-700.105) at time (-1.52588e-06,2.6429e-06)
advanced around the circle, to                   (-2,-4.92504e-08)
                  (-600.313,-364.728) at time (-1.52588e-06,-2.6429e-06)
advanced around the circle, to                  (-2,4.90452e-08)
                 (-617.256,335.377) at time (3.05176e-06,0)
advanced around the circle, to                  (-2,-4.92647e-08)
                 (-19.4427,700.105) at time (-1.52588e-06,2.6429e-06)
advanced around the circle, to                 (-2,4.97054e-08)
                (595.313,364.728) at time (-1.52588e-06,-2.6429e-06)
advanced around the circle, to                  (-2,-4.99192e-08)
                 (612.256,-335.378) at time (3.05176e-06,0)
refined a sample, huzzah
refined a sample, huzzah
refined a sample, huzzah
refined a sample, huzzah
refined a sample, huzzah
refined a sample, huzzah
refined a sample, huzzah
approximated the target root.  approximation                  (-2,-2.72581e-14)
                 (-2.5,2.10549e-14) with error 2.46092e-11
time advanced (1.52588e-06,0)
advanced around the circle, to                  (-2,1.75448e-08)
                 (21.4617,-990.088) at time (-7.62939e-07,1.32145e-06)
advanced around the circle, to                   (-2,-1.74362e-08)
                  (-847.944,-515.797) at time (-7.62939e-07,-1.32145e-06)
advanced around the circle, to                  (-2,1.73846e-08)
                 (-871.905,474.291) at time (1.52588e-06,0)
advanced around the circle, to                  (-2,-1.74401e-08)
                 (-26.4616,990.088) at time (-7.62939e-07,1.32145e-06)
advanced around the circle, to                 (-2,1.755e-08)
                (842.944,515.797) at time (-7.62939e-07,-1.32145e-06)
advanced around the circle, to                  (-2,-1.76031e-08)
                 (866.905,-474.291) at time (1.52588e-06,0)
refined a sample, huzzah
refined a sample, huzzah
refined a sample, huzzah
refined a sample, huzzah
refined a sample, huzzah
refined a sample, huzzah
refined a sample, huzzah
approximated the target root.  approximation                  (-2,-3.40727e-15)
                 (-2.5,5.14692e-15) with error 3.07477e-12
converged at time (1.52588e-06,0) with result                  (-2,-3.40727e-15)
                 (-2.5,5.14692e-15) and residual 3.07477e-12

i had to make a mod to the logging code to get the entire thing to print.... auto_flush.

see how the paths are going to infinity but the approximations are the incorrect "solutions" we see? and perhaps one more step and it would've truncated.

so, is there a bug in the endgame? the paths are going to infinity, but the cauchy integral in the cauchy endgame computes a real point...

ofloveandhate commented 6 years ago

i asked jon via email.

jbcolli2 commented 6 years ago

So are you saying the b2 worked when you homogenized, or that it did not?

When I ran your homogenized b2 code above, I did not get the correct answers after dehomogenization. Here is what I got, does this line up with what you see?

path 0 -- code Success
VectorXmp([(0.264328,-0.184401),(0.264328,-0.184401),(0.792984,-0.553202)])
VectorXmp([(1,3.03614e-12),(3,6.03154e-13)])
path 1 -- code Success
VectorXmp([(-2.82797e-15,2.58538e-13),(2.18908e-15,-5.46431e-13),(1.36082,-1.48942)])
VectorXmp([(-2.11338,0.0146497),(-5.81782e+12,-5.19988e+12)])
path 2 -- code Success
VectorXmp([(-3.02894e-14,-4.28182e-14),(1.04008,-0.241537),(-1.51447e-13,-2.14091e-13)])
VectorXmp([(-7.69256e+12,1.88488e+13),(5,-5.7744e-09)])
path 3 -- code Success
VectorXmp([(0.127779,-0.501778),(-0.255557,1.00356),(0.638893,-2.50889)])
VectorXmp([(-2,-2.85985e-14),(5,-1.17349e-12)])
path 4 -- code Success
VectorXmp([(0.307073,-0.576268),(-0.307073,0.576268),(0.92122,-1.7288)])
VectorXmp([(-1,1.27686e-13),(3,-1.68469e-13)])
path 5 -- code Success
VectorXmp([(-2.82796e-15,2.58538e-13),(2.18907e-15,-5.46431e-13),(1.36082,-1.48942)])
VectorXmp([(-2.11338,0.0146497),(-5.81782e+12,-5.19988e+12)])
jbcolli2 commented 6 years ago

Also... when I run the homogenized code in IPython, it works fine the first time, but the second time I run it in the same session I get the following error:

Assertion failed: ((bertini::Precision(x(0))==DoublePrecision() ||
 bertini::Precision(x(0)) == Precision()) && "precision of input vector must
 match current working precision of patch during rescaling"), 
function RescalePointToFitInPlace, file ./include/bertini2/system/patch.hpp, line 392.
Abort trap: 6
ofloveandhate commented 6 years ago

in reply to

when I run the homogenized code in IPython, it works fine the first time, but the second time I run it in the same session I get the following error:

what is "it"?

ofloveandhate commented 6 years ago

So are you saying the b2 worked when you homogenized, or that it did not?

b2 works with the system homogenized (and in fact with it not homogenized, more to come below). remember, there's no post processor at this level of code; classification of points as infinite, real, singular are all not done with this code -- you have to do it yourself. to me, there are clearly 3 infinite solutions [indices 1, 2, 5], and the real points (1,3), (-2,5), and (-1,3) [at indices 0,3,4 respectively] there are basics of post-processing implemented into bertini2's core, but none are exposed into python. they could use a lot of work, which should be discussed in a separate issue.

ofloveandhate commented 6 years ago

so, is there a bug in the endgame? the paths are going to infinity, but the cauchy integral in the cauchy endgame computes a real point...

response from Jon Hauenstein:

Using affine coordinates, the Cauchy endgame does indeed converge to (-2,-2.5). Here is part of main_data from Bertini:


Solution 2 (path number 1) Estimated condition number: 5.599142945272167e+01 Function residual: 2.250000000000364e+01 Latest Newton residual: 2.497907700353809e-12 T value at final sample point: 9.765625000000000e-10 Maximum precision utilized: 52 T value of first precision increase: 0.000000000000000e+00 Accuracy estimate, internal coordinates (difference of last two endpoint estimates): 1.515942929346056e-12 Accuracy estimate, user's coordinates (after dehomogenization, if applicable): 1.515942929346056e-12 Cycle number: 2 -2.000000000000000e+00 -8.931924931019219e-25 -2.500000000001213e+00 6.063298011819521e-13 Paths with the same endpoint, to the prescribed tolerance: 5 Multiplicity: 2


The reason for this is that Cauchy integral theorem computes the constant term of the path (x(t),y(t)). When the path is analytic, the constant term is indeed the endpoint. In this case, the path is not analytic in affine space (since diverges to infinity) so the constant term computed by Cauchy integral is not the endpoint.

Note 1: The power series endgame in affine coordinates fails to converge due to the nonanalyticity (as expected).

Note 2: In projective space, the corresponding path is analytic and thus the endpoint is computed correctly using either PSEG or CauchyEG.

Note 3: In affine coordinates, one of these paths is of the form:

x(t) = -2 + O(t^(1/2))
y(t) = b0*t^(1/2) - 2.5 + O(t^(1/2)) where b0 \approx -1.07+0.59*I.

so Cauchy's integral theorem should indeed compute -2.5.

Thanks, Jon

jbcolli2 commented 6 years ago

Ok, I see your point about the homogenization and the post processing. The SuccessCodes seem to properly classify infinite points in affine coordinates, but not projective coordinates.

I apologize about the unreferenced it :-). "It" is the endgame tutorial. The endgame tutorial runs correctly and give the results I showed above the first time it is run in IPython. However, if I run the endgame tutorial a second time in the same IPython kernel, I obtain the error message posted above.

I have used the %reset command in IPython to clear all variables between runs, however the same error message still appears. Should this be discussed in a new issue?

ofloveandhate commented 6 years ago

yes, new issue, with complete example code that exhibits the problem without need to re-run anything, please.

ofloveandhate commented 6 years ago

good observation, the success code is just the success of the tracker or endgame or whatever. it's not a classification of an endpoint

ofloveandhate commented 6 years ago

thank you, Jeb!