Date: 20 May 2013

%x

%x

%x

%x

%x

x

%x

%x

%x

%x

%x

%x

n_e = 0 (slider from 0 to 5, step 1)
Eorig1_sub = (-1.6936572199730096, 0.23076923076923075)
Eorig2_sub = (-0.5330634278002699, -0.28994082840236685)
Eorig3_sub = (-1.3967611336032388, -0.3727810650887574)
Eorig4_sub = (2.6923076923076925, 0.42011834319526625)
dx = 1
Eorig5_sub = (0.6410256410256411, -0.2662721893491124)
threshold: 0.01
ymin: -1
ymax: 1
threshold_y: ((threshold * (ymax - ymin)) * 5)
xmin = -5
xmax = 5
threshold_x: (threshold * (xmax - xmin))
Eorig1 = DynamicCoordinates(Eorig1_sub, Max[xmin, Min[xmax, If[(abs(y(Eorig1_sub))  <  threshold_y) ∧ (abs((round(x(Eorig1_sub) / dx) * dx) - x(Eorig1_sub))  <  threshold_x), (round(x(Eorig1_sub) / dx) * dx), x(Eorig1_sub)]]], If[abs(y(Eorig1_sub))  <  threshold_y, 0, y(Eorig1_sub)])
Eorig2 = DynamicCoordinates(Eorig2_sub, Max[xmin, Min[xmax, If[(abs(y(Eorig2_sub))  <  threshold_y) ∧ (abs((round(x(Eorig2_sub) / dx) * dx) - x(Eorig2_sub))  <  threshold_x), (round(x(Eorig2_sub) / dx) * dx), x(Eorig2_sub)]]], If[abs(y(Eorig2_sub))  <  threshold_y, 0, y(Eorig2_sub)])
Eorig3 = DynamicCoordinates(Eorig3_sub, Max[xmin, Min[xmax, If[(abs(y(Eorig3_sub))  <  threshold_y) ∧ (abs((round(x(Eorig3_sub) / dx) * dx) - x(Eorig3_sub))  <  threshold_x), (round(x(Eorig3_sub) / dx) * dx), x(Eorig3_sub)]]], If[abs(y(Eorig3_sub))  <  threshold_y, 0, y(Eorig3_sub)])
Eorig4 = DynamicCoordinates(Eorig4_sub, Max[xmin, Min[xmax, If[(abs(y(Eorig4_sub))  <  threshold_y) ∧ (abs((round(x(Eorig4_sub) / dx) * dx) - x(Eorig4_sub))  <  threshold_x), (round(x(Eorig4_sub) / dx) * dx), x(Eorig4_sub)]]], If[abs(y(Eorig4_sub))  <  threshold_y, 0, y(Eorig4_sub)])
Eorig5 = DynamicCoordinates(Eorig5_sub, Max[xmin, Min[xmax, If[(abs(y(Eorig5_sub))  <  threshold_y) ∧ (abs((round(x(Eorig5_sub) / dx) * dx) - x(Eorig5_sub))  <  threshold_x), (round(x(Eorig5_sub) / dx) * dx), x(Eorig5_sub)]]], If[abs(y(Eorig5_sub))  <  threshold_y, 0, y(Eorig5_sub)])
x03: 3
x02: -0.5
x01: 1
S11_sub = (1.7476383265856952, 0.3136094674556213)
P62_sub = (2.341430499325236, 0.9171597633136095)
P61_sub = (2.6653171390013495, -0.7396449704142012)
P52_sub = (-0.11470985155195682, -0.6923076923076923)
P51_sub = (0.16869095816464239, 0.7514792899408284)
P42_sub = (4.0283400809716605, 0.5857988165680473)
P41_sub = (3.1781376518218627, -0.514792899408284)
P32_sub = (-4.163292847503374, -0.6804733727810651)
P31_sub = (-4.662618083670716, -0.1242603550295858)
P22_sub = (1.3967611336032388, 0.5621301775147929)
P21_sub = (2.678812415654521, -0.6923076923076923)
P12_sub = (-1.7476383265856952, 0.3609467455621302)
P11_sub = (-2.746288798920378, -0.33727810650887574)
eorigs = First({If[y(Eorig1) ≟ 0, x(Eorig1)], If[y(Eorig2) ≟ 0, x(Eorig2)], If[y(Eorig3) ≟ 0, x(Eorig3)], If[y(Eorig4) ≟ 0, x(Eorig4)], If[y(Eorig5) ≟ 0, x(Eorig5)]}, n_e)
es = Join({RemoveUndefined[Sort[Sequence[Element[eorigs, i], i, 1, n_e]]], {xmax + 1}})
e4: 4
e2: 2
e3: 3
e5: 5
e1: 1
EO1: (Element[es, 1], 0)
EO2: (Element[es, 2], 0)
EO3: (Element[es, 3], 0)
EO4: (Element[es, 4], 0)
EO5: (Element[es, 5], 0)
Eorig1stable = 1
Eorig2stable = 1
Eorig3stable = 1
Eorig4stable = 1
Eorig5stable = 1
eorigsstable: {Eorig1stable, Eorig2stable, Eorig3stable, Eorig4stable, Eorig5stable}
showne = true
xlabeldisplay: "" + (LaTeX[xlabel]) + ""
e1stable_set: 1
e2stable_set: 1
e3stable_set: 1
e4stable_set: 1
e5stable_set: 1
n_v = 0 (slider from 0 to 6, step 1)
P11 = DynamicCoordinates(P11_sub, Max[xmin, Min[xmax, x(P11_sub)]], Max[ymin, Min[ymax, If[abs(y(P11_sub))  <  threshold_y, 0, y(P11_sub)]]])
P12 = DynamicCoordinates(P12_sub, Max[xmin, Min[xmax, x(P12_sub)]], Max[ymin, Min[ymax, If[abs(y(P12_sub))  <  threshold_y, 0, y(P12_sub)]]])
v1 = Vector(P11, P12)
P21 = DynamicCoordinates(P21_sub, Max[xmin, Min[xmax, x(P21_sub)]], Max[ymin, Min[ymax, If[abs(y(P21_sub))  <  threshold_y, 0, y(P21_sub)]]])
P22 = DynamicCoordinates(P22_sub, Max[xmin, Min[xmax, x(P22_sub)]], Max[ymin, Min[ymax, If[abs(y(P22_sub))  <  threshold_y, 0, y(P22_sub)]]])
v2 = Vector(P21, P22)
P31 = DynamicCoordinates(P31_sub, Max[xmin, Min[xmax, x(P31_sub)]], Max[ymin, Min[ymax, If[abs(y(P31_sub))  <  threshold_y, 0, y(P31_sub)]]])
P32 = DynamicCoordinates(P32_sub, Max[xmin, Min[xmax, x(P32_sub)]], Max[ymin, Min[ymax, If[abs(y(P32_sub))  <  threshold_y, 0, y(P32_sub)]]])
v3 = Vector(P31, P32)
P41 = DynamicCoordinates(P41_sub, Max[xmin, Min[xmax, x(P41_sub)]], Max[ymin, Min[ymax, If[abs(y(P41_sub))  <  threshold_y, 0, y(P41_sub)]]])
P42 = DynamicCoordinates(P42_sub, Max[xmin, Min[xmax, x(P42_sub)]], Max[ymin, Min[ymax, If[abs(y(P42_sub))  <  threshold_y, 0, y(P42_sub)]]])
v4 = Vector(P41, P42)
P51 = DynamicCoordinates(P51_sub, Max[xmin, Min[xmax, x(P51_sub)]], Max[ymin, Min[ymax, If[abs(y(P51_sub))  <  threshold_y, 0, y(P51_sub)]]])
P52 = DynamicCoordinates(P52_sub, Max[xmin, Min[xmax, x(P52_sub)]], Max[ymin, Min[ymax, If[abs(y(P52_sub))  <  threshold_y, 0, y(P52_sub)]]])
v5 = Vector(P51, P52)
P61 = DynamicCoordinates(P61_sub, Max[xmin, Min[xmax, x(P61_sub)]], Max[ymin, Min[ymax, If[abs(y(P61_sub))  <  threshold_y, 0, y(P61_sub)]]])
P62 = DynamicCoordinates(P62_sub, Max[xmin, Min[xmax, x(P62_sub)]], Max[ymin, Min[ymax, If[abs(y(P62_sub))  <  threshold_y, 0, y(P62_sub)]]])
v6 = Vector(P61, P62)
vectors = First({v1, v2, v3, v4, v5, v6}, n_v)
P1s = First({P11, P21, P31, P41, P51, P61}, n_v)
P2s = First({P12, P22, P32, P42, P52, P62}, n_v)
seg1vectorinds = RemoveUndefined(Sequence[If[y(Element[P1s, i]) ≟ 0 ∧ (x(Element[P1s, i])  <  Element[es, 1]) ∧ y(Element[P2s, i]) ≟ 0 ∧ (x(Element[P2s, i])  <  Element[es, 1]), i], i, 1, n_v])
seg2vectorinds = RemoveUndefined(Sequence[If[y(Element[P1s, i]) ≟ 0 ∧ (x(Element[P1s, i]) > Element[es, 1]) ∧ (x(Element[P1s, i])  <  Element[es, 2]) ∧ y(Element[P2s, i]) ≟ 0 ∧ (x(Element[P2s, i]) > Element[es, 1]) ∧ (x(Element[P2s, i])  <  Element[es, 2]), i], i, 1, n_v])
seg3vectorinds = RemoveUndefined(Sequence[If[y(Element[P1s, i]) ≟ 0 ∧ (x(Element[P1s, i]) > Element[es, 2]) ∧ (x(Element[P1s, i])  <  Element[es, 3]) ∧ y(Element[P2s, i]) ≟ 0 ∧ (x(Element[P2s, i]) > Element[es, 2]) ∧ (x(Element[P2s, i])  <  Element[es, 3]), i], i, 1, n_v])
seg4vectorinds = RemoveUndefined(Sequence[If[y(Element[P1s, i]) ≟ 0 ∧ (x(Element[P1s, i]) > Element[es, 3]) ∧ (x(Element[P1s, i])  <  Element[es, 4]) ∧ y(Element[P2s, i]) ≟ 0 ∧ (x(Element[P2s, i]) > Element[es, 3]) ∧ (x(Element[P2s, i])  <  Element[es, 4]), i], i, 1, n_v])
seg5vectorinds = RemoveUndefined(Sequence[If[y(Element[P1s, i]) ≟ 0 ∧ (x(Element[P1s, i]) > Element[es, 4]) ∧ (x(Element[P1s, i])  <  Element[es, 5]) ∧ y(Element[P2s, i]) ≟ 0 ∧ (x(Element[P2s, i]) > Element[es, 4]) ∧ (x(Element[P2s, i])  <  Element[es, 5]), i], i, 1, n_v])
seg6vectorinds = RemoveUndefined(Sequence[If[y(Element[P1s, i]) ≟ 0 ∧ (x(Element[P1s, i]) > Element[es, 5]) ∧ y(Element[P2s, i]) ≟ 0 ∧ (x(Element[P2s, i]) > Element[es, 5]), i], i, 1, n_v])
vectordirs = Sequence(If[y(Element[P1s, i]) ≟ 0 ∧ y(Element[P2s, i]) ≟ 0, If[x(Element[P1s, i])  <  x(Element[P2s, i]), 1, If[x(Element[P1s, i]) > x(Element[P2s, i]), -1, 0]], 0], i, 1, n_v)
seg1dirs = Zip(Element[vectordirs, ind], ind, seg1vectorinds)
dir1 = If(Product[Append[Sequence[If[Element[seg1dirs, i] ≟ Element[seg1dirs, i + 1], 1, 0], i, 1, Length[seg1dirs] - 1], 1]] ≟ 1, Element[seg1dirs, 1])
seg2dirs = Zip(Element[vectordirs, ind], ind, seg2vectorinds)
dir2 = If(Product[Append[Sequence[If[Element[seg2dirs, i] ≟ Element[seg2dirs, i + 1], 1, 0], i, 1, Length[seg2dirs] - 1], 1]] ≟ 1, Element[seg2dirs, 1])
seg3dirs = Zip(Element[vectordirs, ind], ind, seg3vectorinds)
dir3 = If(Product[Append[Sequence[If[Element[seg3dirs, i] ≟ Element[seg3dirs, i + 1], 1, 0], i, 1, Length[seg3dirs] - 1], 1]] ≟ 1, Element[seg3dirs, 1])
seg4dirs = Zip(Element[vectordirs, ind], ind, seg4vectorinds)
dir4 = If(Product[Append[Sequence[If[Element[seg4dirs, i] ≟ Element[seg4dirs, i + 1], 1, 0], i, 1, Length[seg4dirs] - 1], 1]] ≟ 1, Element[seg4dirs, 1])
seg5dirs = Zip(Element[vectordirs, ind], ind, seg5vectorinds)
dir5 = If(Product[Append[Sequence[If[Element[seg5dirs, i] ≟ Element[seg5dirs, i + 1], 1, 0], i, 1, Length[seg5dirs] - 1], 1]] ≟ 1, Element[seg5dirs, 1])
seg6dirs = Zip(Element[vectordirs, ind], ind, seg6vectorinds)
dir6 = If(Product[Append[Sequence[If[Element[seg6dirs, i] ≟ Element[seg6dirs, i + 1], 1, 0], i, 1, Length[seg6dirs] - 1], 1]] ≟ 1, Element[seg6dirs, 1])
nostrayvectors: Sort[Union[Union[Union[Union[Union[seg1vectorinds, seg2vectorinds], seg3vectorinds], seg4vectorinds], seg5vectorinds], seg6vectorinds]] ≟ Sequence[i, i, 1, n_v]
n_s = 0 (slider from 0 to 3, step 1)
shownv: true
showns: true
S12_sub = (3.879892037786775, -0.57396449704142)
S22_sub = (-1.464237516869096, 0.2781065088757396)
S21_sub = (-0.46558704453441296, -0.5857988165680473)
S31_sub = (3.9878542510121457, 0.42011834319526625)
S32_sub = (3.097165991902834, -0.7278106508875739)
xinf1: -3
xinf2: 2
xinf3: 4
nsols: 3
S11 = DynamicCoordinates(S11_sub, Max[xmin, Min[xmax, If[abs(y(S11_sub))  <  threshold_y, If[abs(x(S11_sub) - x01)  <  threshold_x, x01, If[abs(x(S11_sub) - x02)  <  threshold_x, x02, If[abs(x(S11_sub) - x03)  <  threshold_x, x03, x(S11_sub)]]], x(S11_sub)]]], Max[ymin, Min[ymax, If[abs(y(S11_sub))  <  threshold_y, 0, y(S11_sub)]]])
S12 = DynamicCoordinates(S12_sub, Max[xmin, Min[xmax, If[abs(y(S12_sub))  <  threshold_y, If[abs(x(S12_sub) - xinf1)  <  threshold_x, xinf1, If[abs(x(S12_sub) - xinf2)  <  threshold_x, xinf2, If[abs(x(S12_sub) - xinf3)  <  threshold_x, xinf3, x(S12_sub)]]], x(S12_sub)]]], Max[ymin, Min[ymax, If[abs(y(S12_sub))  <  threshold_y, 0, y(S12_sub)]]])
S21 = DynamicCoordinates(S21_sub, Max[xmin, Min[xmax, If[abs(y(S21_sub))  <  threshold_y, If[abs(x(S21_sub) - x01)  <  threshold_x, x01, If[abs(x(S21_sub) - x02)  <  threshold_x, x02, If[abs(x(S21_sub) - x03)  <  threshold_x, x03, x(S21_sub)]]], x(S21_sub)]]], Max[ymin, Min[ymax, If[abs(y(S21_sub))  <  threshold_y, 0, y(S21_sub)]]])
S22 = DynamicCoordinates(S22_sub, Max[xmin, Min[xmax, If[abs(y(S22_sub))  <  threshold_y, If[abs(x(S22_sub) - xinf1)  <  threshold_x, xinf1, If[abs(x(S22_sub) - xinf2)  <  threshold_x, xinf2, If[abs(x(S22_sub) - xinf3)  <  threshold_x, xinf3, x(S22_sub)]]], x(S22_sub)]]], Max[ymin, Min[ymax, If[abs(y(S22_sub))  <  threshold_y, 0, y(S22_sub)]]])
S31 = DynamicCoordinates(S31_sub, Max[xmin, Min[xmax, If[abs(y(S31_sub))  <  threshold_y, If[abs(x(S31_sub) - x01)  <  threshold_x, x01, If[abs(x(S31_sub) - x02)  <  threshold_x, x02, If[abs(x(S31_sub) - x03)  <  threshold_x, x03, x(S31_sub)]]], x(S31_sub)]]], Max[ymin, Min[ymax, If[abs(y(S31_sub))  <  threshold_y, 0, y(S31_sub)]]])
S32 = DynamicCoordinates(S32_sub, Max[xmin, Min[xmax, If[abs(y(S32_sub))  <  threshold_y, If[abs(x(S32_sub) - xinf1)  <  threshold_x, xinf1, If[abs(x(S32_sub) - xinf2)  <  threshold_x, xinf2, If[abs(x(S32_sub) - xinf3)  <  threshold_x, xinf3, x(S32_sub)]]], x(S32_sub)]]], Max[ymin, Min[ymax, If[abs(y(S32_sub))  <  threshold_y, 0, y(S32_sub)]]])
s1 = Vector(S11, S12)
s2 = Vector(S21, S22)
s3 = Vector(S31, S32)
xs0s = Zip(If[abs(y(A))  <  threshold_y, x(A)], A, First[{S11, S21, S31}, n_s])
indx01 = IndexOf(true, Zip[abs(a - x01)  <  threshold_x, a, xs0s])
indx02 = IndexOf(true, Zip[abs(a - x02)  <  threshold_x, a, xs0s])
indx03 = IndexOf(true, Zip[abs(a - x03)  <  threshold_x, a, xs0s])
x01found = Defined(indx01)
x02found = Defined(indx02)
x03found = Defined(indx03)
xsinfs = Zip(If[abs(y(A))  <  threshold_y, x(A)], A, First[{S12, S22, S32}, n_s])
xinf1found: Element[xsinfs, indx01] ≟ xinf1
xinf2found: Element[xsinfs, indx02] ≟ xinf2
xinf3found: Element[xsinfs, indx03] ≟ xinf3
inde1 = IndexOf(true, Zip[abs(a - e1)  <  Min[threshold_x, dx / 2], a, eorigs])
inde2 = IndexOf(true, Zip[abs(a - e2)  <  Min[threshold_x, dx / 2], a, eorigs])
inde3 = IndexOf(true, Zip[abs(a - e3)  <  Min[threshold_x, dx / 2], a, eorigs])
inde4 = IndexOf(true, Zip[abs(a - e4)  <  Min[threshold_x, dx / 2], a, eorigs])
inde5 = IndexOf(true, Zip[abs(a - e5)  <  Min[threshold_x, dx / 2], a, eorigs])
e1found = Defined(inde1)
e2found = Defined(inde2)
e3found = Defined(inde3)
e4found = Defined(inde4)
e5found = Defined(inde5)
e1stable = Element(eorigsstable, inde1)
e2stable = Element(eorigsstable, inde2)
e3stable = Element(eorigsstable, inde3)
e4stable = Element(eorigsstable, inde4)
e5stable = Element(eorigsstable, inde5)