x=%y

x=%x

%y

show test point

%x

%y

n_v=%v

%y

%y

%y

%y

%y

%y

%y

%y

n_v=%v

%y

%y

%y

%y

%y

x

t

f

xmax2 = 19.16028660416406
Pb_sub = (5.6640354001018265, 5.607843137254901)
Pa_sub = (5.607843137254901, 0)
ymax2: 11
ymin2: -11
yscale2: ymax2 - ymin2
f(x) = ((((-(x - 7)) * (x - 3)) * (x + 8)) * exp(((-x^(2))) / 50) / 100)
threshold = 0.03
threshold_y2: (threshold * yscale2)
xmax1: 11
xmin1: -11
xscale1: xmax1 - xmin1
threshold_x1: (threshold * xscale1)
equilibria = RemoveUndefined({Roots[f, xmin1, xmax1]})
n_equilibria = Length(equilibria)
Pb_equilibria = Max(Sequence[If[abs(y(Pb_sub) - x(Element[equilibria, i])) < threshold_y2 / 2, i, 0], i, 1, n_equilibria])
Pb = DynamicCoordinates(Pb_sub, Min[xmax2, Max[0, x(Pb_sub)]], If[Pb_equilibria > 0, x(Element[equilibria, Pb_equilibria]), Min[ymax2, Max[ymin2, y(Pb_sub)]]])
Pa_equilibria = Max(Sequence[If[abs(x(Pa_sub) - x(Element[equilibria, i])) < threshold_x1 / 4, i, 0], i, 1, n_equilibria])
Pa = DynamicCoordinates(Pa_sub, If[Pa_equilibria > 0, x(Element[equilibria, Pa_equilibria]), Min[xmax1, Max[xmin1, x(Pa_sub)]]], 0)
vecmult2: 1.5
Pbvecend_sub: Pb + ((1, f(y(Pb))) / sqrt(1 + f(y(Pb))^(2)) * vecmult2)
nvecdirs: 10
dvecdir: π / nvecdirs
vecdirs: (vecmult2 * Sequence[(sin((i * dvecdir)), cos((i * dvecdir))), i, 0, nvecdirs])
x01: -2.5
SV1_sub = (0.302832629639779, -0.2682926829268293)
SV1_equilibria = Max(Sequence[If[abs(y(SV1_sub) - x(Element[equilibria, i])) < threshold_y2 / 2, i, 0], i, 1, n_equilibria])
SV1 = DynamicCoordinates(SV1_sub, 0, If[abs(y(SV1_sub) - x01) < threshold_y2 / 2, x01, If[SV1_equilibria > 0, x(Element[equilibria, SV1_equilibria]), Min[ymax2, Max[ymin2, y(SV1_sub)]]]])
DV1_sub = (-4.011764705882354, 0.38064516129032294)
Pbvec_equilibria = Max(Sequence[If[f(y(Pb)) > 0, If[x(Element[equilibria, i]) > y(Pb) ∧ x(Element[equilibria, i]) < y(Pbvecend_sub), i, 0], If[x(Element[equilibria, i]) < y(Pb) ∧ x(Element[equilibria, i]) > y(Pbvecend_sub), i, 0]], i, 1, n_equilibria])
vecmult1: 1
DV3h_sub = (-0.45294117647058885, 2.638709677419355)
ymin1: -2.8
ymax1: 3
yscale1: ymax1 - ymin1
threshold_y1: (threshold * yscale1)
DV3_sub = (-1.0784313725490202, 1.2967741935483872)
DV3_equilibria = Max(Sequence[If[abs(x(DV3_sub) - x(Element[equilibria, i])) < threshold_x1 / 4, i, 0], i, 1, n_equilibria])
DV3 = DynamicCoordinates(DV3_sub, If[abs(x(DV3_sub) - x01) < threshold_x1 / 2, x01, If[DV3_equilibria > 0, x(Element[equilibria, DV3_equilibria]), Min[xmax1, Max[xmin1, x(DV3_sub)]]]], If[abs(y(DV3_sub)) < threshold_y1 / 2, 0, Min[ymax1, Max[ymin1, y(DV3_sub)]]])
DV2h_sub = (2.4891944990176826, -0.005405405405405406)
DV2_sub = (1.499017681728881, -0.01098901098901099)
DV2_equilibria = Max(Sequence[If[abs(x(DV2_sub) - x(Element[equilibria, i])) < threshold_x1 / 4, i, 0], i, 1, n_equilibria])
DV2 = DynamicCoordinates(DV2_sub, If[abs(x(DV2_sub) - x01) < threshold_x1 / 2, x01, If[DV2_equilibria > 0, x(Element[equilibria, DV2_equilibria]), Min[xmax1, Max[xmin1, x(DV2_sub)]]]], If[abs(y(DV2_sub)) < threshold_y1 / 2, 0, Min[ymax1, Max[ymin1, y(DV2_sub)]]])
DV1h_sub = (1.4235294117647046, 1.2038709677419357)
DV1_equilibria = Max(Sequence[If[abs(x(DV1_sub) - x(Element[equilibria, i])) < threshold_x1 / 4, i, 0], i, 1, n_equilibria])
DV1 = DynamicCoordinates(DV1_sub, If[abs(x(DV1_sub) - x01) < threshold_x1 / 2, x01, If[DV1_equilibria > 0, x(Element[equilibria, DV1_equilibria]), Min[xmax1, Max[xmin1, x(DV1_sub)]]]], If[abs(y(DV1_sub)) < threshold_y1 / 2, 0, Min[ymax1, Max[ymin1, y(DV1_sub)]]])
SL2a_sub = (2.55203541958692, 0.005483805884353524)
SL1a_sub = (-8.75686274509804, 0.7922580645161293)
SL1a = DynamicCoordinates(SL1a_sub, Min[xmax1, Max[xmin1, x(SL1a_sub)]], If[abs(y(SL1a_sub)) < threshold_y1, 0, Min[ymax1, Max[ymin1, y(SL1a_sub)]]])
SL2a = DynamicCoordinates(SL2a_sub, Min[xmax1, Max[xmin1, x(SL2a_sub)]], If[abs(y(SL2a_sub)) < threshold_y1, 0, Min[ymax1, Max[ymin1, y(SL2a_sub)]]])
statelinea = Line(SL1a, SL2a)
step = 0 (slider from 0 to 6, step 1)
Pavec_equilibria = Max(Sequence[If[f(x(Pa)) > 0, If[x(Element[equilibria, i]) > x(Pa) ∧ x(Element[equilibria, i]) < x(Pa) + (f(x(Pa)) * vecmult1), i, 0], If[x(Element[equilibria, i]) < x(Pa) ∧ x(Element[equilibria, i]) > x(Pa) + (f(x(Pa)) * vecmult1), i, 0]], i, 1, n_equilibria])
Paseg = Segment(Pa, (x(Pa), f(x(Pa))))
show_testpoint = false
DV1h = DynamicCoordinates(DV1h_sub, If[abs(x(DV1h_sub) - x(DV1)) < threshold_x1 / 2, x(DV1), Min[xmax1, Max[xmin1, x(DV1h_sub)]]], If[abs(y(DV1h_sub)) < threshold_y1 / 2, 0, Min[ymax1, Max[ymin1, y(DV1h_sub)]]])
vec1 = Vector(DV1, DV1h)
ICa_sub = (-2.5442043222003923, -0.10256410256410256)
ICa = DynamicCoordinates(ICa_sub, If[abs(x(ICa_sub) - x01) < threshold_x1 / 2, x01, Min[xmax1, Max[xmin1, x(ICa_sub)]]], If[abs(y(ICa_sub)) < threshold_y1, 0, Min[ymax1, Max[ymin1, y(ICa_sub)]]])
statelineafound: statelinea ≟ xAxis
ICashadow: ICa
initialconditionafound: step ≥ 2 ∧ ICa ≟ (x01, 0)
DV2h = DynamicCoordinates(DV2h_sub, If[abs(x(DV2h_sub) - x(DV2)) < threshold_x1 / 2, x(DV2), Min[xmax1, Max[xmin1, x(DV2h_sub)]]], If[abs(y(DV2h_sub)) < threshold_y1 / 2, 0, Min[ymax1, Max[ymin1, y(DV2h_sub)]]])
vec2 = Vector(DV2, DV2h)
DV3h = DynamicCoordinates(DV3h_sub, If[abs(x(DV3h_sub) - x(DV3)) < threshold_x1 / 2, x(DV3), Min[xmax1, Max[xmin1, x(DV3h_sub)]]], If[abs(y(DV3h_sub)) < threshold_y1 / 2, 0, Min[ymax1, Max[ymin1, y(DV3h_sub)]]])
vec3 = Vector(DV3, DV3h)
xmin2 = -3.4814506131771856
ICb_sub = (-0.010422260097617564, -2.6613418530351436)
xscale2: xmax2 - xmin2
threshold_x2: (threshold * xscale2)
ICb = DynamicCoordinates(ICb_sub, If[abs(x(ICb_sub)) < threshold_x2, 0, Min[xmax2, Max[xmin2, x(ICb_sub)]]], If[abs(y(ICb_sub) - x01) < threshold_y2 / 2, x01, Min[ymax2, Max[ymin2, y(ICb_sub)]]])
ICbshadow: ICb
initialconditionbfound: step ≥ 2 ∧ ICb ≟ (0, x01)
SL1b_sub = (-0.060554351374320116, -3.7254136050244377)
SL2b_sub = (-0.4776551752382698, 3.048780487804878)
SL1b = DynamicCoordinates(SL1b_sub, If[abs(x(SL1b_sub)) < threshold_x2, 0, Min[xmax2, Max[xmin2, x(SL1b_sub)]]], Min[ymax2, Max[ymin2, y(SL1b_sub)]])
SL2b = DynamicCoordinates(SL2b_sub, If[abs(x(SL2b_sub)) < threshold_x2, 0, Min[xmax2, Max[xmin2, x(SL2b_sub)]]], Min[ymax2, Max[ymin2, y(SL2b_sub)]])
Pbvec_end: Pb + ((1, f(y(Pb))) / sqrt(1 + f(y(Pb))^(2)) * If[Pbvec_equilibria > 0, ((x(Element[equilibria, Pbvec_equilibria]) - y(Pb)) * sqrt(1 + f(y(Pb))^(2)) / f(y(Pb))), vecmult2])
Pbvec = Vector(Pb, Pbvec_end)
statelineb = Line(SL2b, SL1b)
statelinebfound: statelineb ≟ yAxis
slopelabel: "slope = " + (f(y(Pb)))
SV1h = Point(SV1 + vecdirs)
svec1 = Vector(SV1, SV1h)
nvecshadows: ceil(xmax2 / vecmult2)
dvs: xmax2 / (nvecshadows + 1)
DV4_sub = (6.493887512663373, -0.012003359650970644)
DV4h_sub = (4.842571095293508, -0.012003359650970644)
DV4_equilibria = Max(Sequence[If[abs(x(DV4_sub) - x(Element[equilibria, i])) < threshold_x1 / 4, i, 0], i, 1, n_equilibria])
DV4 = DynamicCoordinates(DV4_sub, If[abs(x(DV4_sub) - x01) < threshold_x1 / 2, x01, If[DV4_equilibria > 0, x(Element[equilibria, DV4_equilibria]), Min[xmax1, Max[xmin1, x(DV4_sub)]]]], If[abs(y(DV4_sub)) < threshold_y1 / 2, 0, Min[ymax1, Max[ymin1, y(DV4_sub)]]])
DV4h = DynamicCoordinates(DV4h_sub, If[abs(x(DV4h_sub) - x(DV4)) < threshold_x1 / 2, x(DV4), Min[xmax1, Max[xmin1, x(DV4h_sub)]]], If[abs(y(DV4h_sub)) < threshold_y1 / 2, 0, Min[ymax1, Max[ymin1, y(DV4h_sub)]]])
vec4 = Vector(DV4, DV4h)
DV5_sub = (4.496327330361116, 0.005483805884354764)
DV5h_sub = (3.5641325786200633, -0.029490525186296548)
DV5_equilibria = Max(Sequence[If[abs(x(DV5_sub) - x(Element[equilibria, i])) < threshold_x1 / 4, i, 0], i, 1, n_equilibria])
DV5 = DynamicCoordinates(DV5_sub, If[abs(x(DV5_sub) - x01) < threshold_x1 / 2, x01, If[DV5_equilibria > 0, x(Element[equilibria, DV5_equilibria]), Min[xmax1, Max[xmin1, x(DV5_sub)]]]], If[abs(y(DV5_sub)) < threshold_y1 / 2, 0, Min[ymax1, Max[ymin1, y(DV5_sub)]]])
DV5h = DynamicCoordinates(DV5h_sub, If[abs(x(DV5h_sub) - x(DV5)) < threshold_x1 / 2, x(DV5), Min[xmax1, Max[xmin1, x(DV5h_sub)]]], If[abs(y(DV5h_sub)) < threshold_y1 / 2, 0, Min[ymax1, Max[ymin1, y(DV5h_sub)]]])
vec5 = Vector(DV5, DV5h)
DV6_sub = (-5.43222003929273, -0.01098901098901099)
DV6h_sub = (-6.532416502946954, -0.01098901098901099)
DV6_equilibria = Max(Sequence[If[abs(x(DV6_sub) - x(Element[equilibria, i])) < threshold_x1 / 4, i, 0], i, 1, n_equilibria])
DV6 = DynamicCoordinates(DV6_sub, If[abs(x(DV6_sub) - x01) < threshold_x1 / 2, x01, If[DV6_equilibria > 0, x(Element[equilibria, DV6_equilibria]), Min[xmax1, Max[xmin1, x(DV6_sub)]]]], If[abs(y(DV6_sub)) < threshold_y1 / 2, 0, Min[ymax1, Max[ymin1, y(DV6_sub)]]])
DV6h = DynamicCoordinates(DV6h_sub, If[abs(x(DV6h_sub) - x(DV6)) < threshold_x1 / 2, x(DV6), Min[xmax1, Max[xmin1, x(DV6h_sub)]]], If[abs(y(DV6h_sub)) < threshold_y1 / 2, 0, Min[ymax1, Max[ymin1, y(DV6h_sub)]]])
vec6 = Vector(DV6, DV6h)
DV7_sub = (-3.4243614931237714, 0.4358974358974359)
DV7h_sub = (-3.8919449901768166, 1.0769230769230769)
DV7_equilibria = Max(Sequence[If[abs(x(DV7_sub) - x(Element[equilibria, i])) < threshold_x1 / 4, i, 0], i, 1, n_equilibria])
DV7 = DynamicCoordinates(DV7_sub, If[abs(x(DV7_sub) - x01) < threshold_x1 / 2, x01, If[DV7_equilibria > 0, x(Element[equilibria, DV7_equilibria]), Min[xmax1, Max[xmin1, x(DV7_sub)]]]], If[abs(y(DV7_sub)) < threshold_y1 / 2, 0, Min[ymax1, Max[ymin1, y(DV7_sub)]]])
DV7h = DynamicCoordinates(DV7h_sub, If[abs(x(DV7h_sub) - x(DV7)) < threshold_x1 / 2, x(DV7), Min[xmax1, Max[xmin1, x(DV7h_sub)]]], If[abs(y(DV7h_sub)) < threshold_y1 / 2, 0, Min[ymax1, Max[ymin1, y(DV7h_sub)]]])
vec7 = Vector(DV7, DV7h)
DV8_sub = (-2.0491159135559913, 1.282051282051282)
DV8h_sub = (-0.4813359528487222, 1.4871794871794872)
DV8_equilibria = Max(Sequence[If[abs(x(DV8_sub) - x(Element[equilibria, i])) < threshold_x1 / 4, i, 0], i, 1, n_equilibria])
DV8 = DynamicCoordinates(DV8_sub, If[abs(x(DV8_sub) - x01) < threshold_x1 / 2, x01, If[DV8_equilibria > 0, x(Element[equilibria, DV8_equilibria]), Min[xmax1, Max[xmin1, x(DV8_sub)]]]], If[abs(y(DV8_sub)) < threshold_y1 / 2, 0, Min[ymax1, Max[ymin1, y(DV8_sub)]]])
DV8h = DynamicCoordinates(DV8h_sub, If[abs(x(DV8h_sub) - x(DV8)) < threshold_x1 / 2, x(DV8), Min[xmax1, Max[xmin1, x(DV8h_sub)]]], If[abs(y(DV8h_sub)) < threshold_y1 / 2, 0, Min[ymax1, Max[ymin1, y(DV8h_sub)]]])
vec8 = Vector(DV8, DV8h)
DV9_sub = (-2.984282907662082, 0.02564102564102564)
DV9h_sub = (-2.9292730844793704, 0)
DV9_equilibria = Max(Sequence[If[abs(x(DV9_sub) - x(Element[equilibria, i])) < threshold_x1 / 4, i, 0], i, 1, n_equilibria])
DV9 = DynamicCoordinates(DV9_sub, If[abs(x(DV9_sub) - x01) < threshold_x1 / 2, x01, If[DV9_equilibria > 0, x(Element[equilibria, DV9_equilibria]), Min[xmax1, Max[xmin1, x(DV9_sub)]]]], If[abs(y(DV9_sub)) < threshold_y1 / 2, 0, Min[ymax1, Max[ymin1, y(DV9_sub)]]])
DV9h = DynamicCoordinates(DV9h_sub, If[abs(x(DV9h_sub) - x(DV9)) < threshold_x1 / 2, x(DV9), Min[xmax1, Max[xmin1, x(DV9h_sub)]]], If[abs(y(DV9h_sub)) < threshold_y1 / 2, 0, Min[ymax1, Max[ymin1, y(DV9h_sub)]]])
vec9 = Vector(DV9, DV9h)
nv1 = 0 (slider from 0 to 9, step 1)
DV1eq: DV1
DV2eq: DV2
DV3eq: DV3
DV4eq: DV4
DV5eq: DV5
DV6eq: DV6
DV7eq: DV7
DV8eq: DV8
DV9eq: DV9
Pavec = Vector(Pa, If[Pavec_equilibria > 0, Element[equilibria, Pavec_equilibria], (x(Pa) + (f(x(Pa)) * vecmult1), 0)])
dvd: π / 16
svec1shadows = Sequence(Vector[SV1 + ((vecmult2 * i), 0), SV1h + ((vecmult2 * i), 0)], i, 1, nvecshadows)
SV1eq = Ray((0, y(SV1)), (1, y(SV1)))
SV2_sub = (0.4003936052495351, -2.658536585365854)
SV2_equilibria = Max(Sequence[If[abs(y(SV2_sub) - x(Element[equilibria, i])) < threshold_y2 / 2, i, 0], i, 1, n_equilibria])
SV2 = DynamicCoordinates(SV2_sub, 0, If[abs(y(SV2_sub) - x01) < threshold_y2 / 2, x01, If[SV2_equilibria > 0, x(Element[equilibria, SV2_equilibria]), Min[ymax2, Max[ymin2, y(SV2_sub)]]]])
SV2h = Point(SV2 + vecdirs)
SV2eq = Ray((0, y(SV2)), (1, y(SV2)))
svec2 = Vector(SV2, SV2h)
svec2shadows = Sequence(Vector[SV2 + ((vecmult2 * i), 0), SV2h + ((vecmult2 * i), 0)], i, 1, nvecshadows)
SV3_sub = (0.35161311744465706, 1.926829268292683)
SV3_equilibria = Max(Sequence[If[abs(y(SV3_sub) - x(Element[equilibria, i])) < threshold_y2 / 2, i, 0], i, 1, n_equilibria])
SV3 = DynamicCoordinates(SV3_sub, 0, If[abs(y(SV3_sub) - x01) < threshold_y2 / 2, x01, If[SV3_equilibria > 0, x(Element[equilibria, SV3_equilibria]), Min[ymax2, Max[ymin2, y(SV3_sub)]]]])
SV3h = Point(SV3 + vecdirs)
SV3eq = Ray((0, y(SV3)), (1, y(SV3)))
svec3 = Vector(SV3, SV3h)
svec3shadows = Sequence(Vector[SV3 + ((vecmult2 * i), 0), SV3h + ((vecmult2 * i), 0)], i, 1, nvecshadows)
SV4_sub = (0.058930190615388775, -3)
SV4_equilibria = Max(Sequence[If[abs(y(SV4_sub) - x(Element[equilibria, i])) < threshold_y2 / 2, i, 0], i, 1, n_equilibria])
SV4 = DynamicCoordinates(SV4_sub, 0, If[abs(y(SV4_sub) - x01) < threshold_y2 / 2, x01, If[SV4_equilibria > 0, x(Element[equilibria, SV4_equilibria]), Min[ymax2, Max[ymin2, y(SV4_sub)]]]])
SV4h = Point(SV4 + vecdirs)
SV4eq = Ray((0, y(SV4)), (1, y(SV4)))
svec4 = Vector(SV4, SV4h)
svec4shadows = Sequence(Vector[SV4 + ((vecmult2 * i), 0), SV4h + ((vecmult2 * i), 0)], i, 1, nvecshadows)
SV5_sub = (-0.08741127279924538, 4.560975609756098)
SV5_equilibria = Max(Sequence[If[abs(y(SV5_sub) - x(Element[equilibria, i])) < threshold_y2 / 2, i, 0], i, 1, n_equilibria])
SV5 = DynamicCoordinates(SV5_sub, 0, If[abs(y(SV5_sub) - x01) < threshold_y2 / 2, x01, If[SV5_equilibria > 0, x(Element[equilibria, SV5_equilibria]), Min[ymax2, Max[ymin2, y(SV5_sub)]]]])
SV5h = Point(SV5 + vecdirs)
SV5eq = Ray((0, y(SV5)), (1, y(SV5)))
svec5 = Vector(SV5, SV5h)
svec5shadows = Sequence(Vector[SV5 + ((vecmult2 * i), 0), SV5h + ((vecmult2 * i), 0)], i, 1, nvecshadows)
SV6_sub = (0.20527165403002293, -5)
SV6_equilibria = Max(Sequence[If[abs(y(SV6_sub) - x(Element[equilibria, i])) < threshold_y2 / 2, i, 0], i, 1, n_equilibria])
SV6 = DynamicCoordinates(SV6_sub, 0, If[abs(y(SV6_sub) - x01) < threshold_y2 / 2, x01, If[SV6_equilibria > 0, x(Element[equilibria, SV6_equilibria]), Min[ymax2, Max[ymin2, y(SV6_sub)]]]])
SV6h = Point(SV6 + vecdirs)
SV6eq = Ray((0, y(SV6)), (1, y(SV6)))
svec6 = Vector(SV6, SV6h)
svec6shadows = Sequence(Vector[SV6 + ((vecmult2 * i), 0), SV6h + ((vecmult2 * i), 0)], i, 1, nvecshadows)
SV7_sub = (0.38007005571195696, 5.941448852436136)
SV7_equilibria = Max(Sequence[If[abs(y(SV7_sub) - x(Element[equilibria, i])) < threshold_y2 / 2, i, 0], i, 1, n_equilibria])
SV7 = DynamicCoordinates(SV7_sub, 0, If[abs(y(SV7_sub) - x01) < threshold_y2 / 2, x01, If[SV7_equilibria > 0, x(Element[equilibria, SV7_equilibria]), Min[ymax2, Max[ymin2, y(SV7_sub)]]]])
SV7h = Point(SV7 + vecdirs)
SV7eq = Ray((0, y(SV7)), (1, y(SV7)))
svec7 = Vector(SV7, SV7h)
svec7shadows = Sequence(Vector[SV7 + ((vecmult2 * i), 0), SV7h + ((vecmult2 * i), 0)], i, 1, nvecshadows)
SV8_sub = (0.8394179954934375, 2.951219512195122)
SV8_equilibria = Max(Sequence[If[abs(y(SV8_sub) - x(Element[equilibria, i])) < threshold_y2 / 2, i, 0], i, 1, n_equilibria])
SV8 = DynamicCoordinates(SV8_sub, 0, If[abs(y(SV8_sub) - x01) < threshold_y2 / 2, x01, If[SV8_equilibria > 0, x(Element[equilibria, SV8_equilibria]), Min[ymax2, Max[ymin2, y(SV8_sub)]]]])
SV8h = Point(SV8 + vecdirs)
SV8eq = Ray((0, y(SV8)), (1, y(SV8)))
svec8 = Vector(SV8, SV8h)
svec8shadows = Sequence(Vector[SV8 + ((vecmult2 * i), 0), SV8h + ((vecmult2 * i), 0)], i, 1, nvecshadows)
SV9_sub = (1.1926532898568456, -4.4309371363545)
SV9_equilibria = Max(Sequence[If[abs(y(SV9_sub) - x(Element[equilibria, i])) < threshold_y2 / 2, i, 0], i, 1, n_equilibria])
SV9 = DynamicCoordinates(SV9_sub, 0, If[abs(y(SV9_sub) - x01) < threshold_y2 / 2, x01, If[SV9_equilibria > 0, x(Element[equilibria, SV9_equilibria]), Min[ymax2, Max[ymin2, y(SV9_sub)]]]])
SV9h = Point(SV9 + vecdirs)
SV9eq = Ray((0, y(SV9)), (1, y(SV9)))
svec9 = Vector(SV9, SV9h)
svec9shadows = Sequence(Vector[SV9 + ((vecmult2 * i), 0), SV9h + ((vecmult2 * i), 0)], i, 1, nvecshadows)
nv2 = 0 (slider from 0 to 9, step 1)
dy2: 0.5
x0options = Sequence((0, i), i, (ceil(ymin2 / dy2) * dy2) + dy2, ymax2 - dy2, dy2)
x0c1point = Point(x0options)
x0c2point = Point(x0options)
x0c3point = Point(x0options)
n_c = 3 (slider from 0 to 3, step 1)
x0corigs = First({y(x0c1point), y(x0c2point), y(x0c3point)}, n_c)
x0c1 = If(n_c > 0, y(x0c1point))
x0c2 = If(n_c > 1, y(x0c2point))
x0c3 = If(n_c > 2, y(x0c3point))
speedc1 = 2
speedc2 = 3
speedc3 = 1
dx2: 2
s1c1options: {(dx2, x0c1 + dy2), (dx2, x0c1 - dy2)}
s1c1point = Point(s1c1options)
s1c1val: y(s1c1point) - x0c1
s1c2options: {(dx2, x0c2 + dy2), (dx2, x0c2 - dy2)}
s1c2point = Point(s1c2options)
s1c2val: y(s1c2point) - x0c2
s1c3options: {(dx2, x0c3 + dy2), (dx2, x0c3 - dy2)}
s1c3point = Point(s1c3options)
s1c3val: y(s1c3point) - x0c3
s23options = Sequence(((floor((0.98 * xmax2 / dx2)) * dx2), i), i, (ceil(ymin2 / dy2) * dy2) + dy2, ymax2 - dy2, dy2)
s23c1point = Point(s23options)
s23c2point = Point(s23options)
s23c3point = Point(s23options)
s23c1val: y(s23c1point)
s23c2val: y(s23c2point)
s23c3val: y(s23c3point)
xinfc1 = If(speedc1 ≟ 1, If[s1c1val > 0, Max[ymax2, xmax1], Min[ymin2, xmin1]], s23c1val)
xinfc2 = If(speedc2 ≟ 1, If[s1c2val > 0, Max[ymax2, xmax1], Min[ymin2, xmin1]], s23c2val)
xinfc3 = If(speedc3 ≟ 1, If[s1c3val > 0, Max[ymax2, xmax1], Min[ymin2, xmin1]], s23c3val)
xinfcorigs = First({xinfc1, xinfc2, xinfc3}, n_c)
sortindices = Sequence((Element[x0corigs, i] / dy2 * (ymax2 - ymin2)) + Element[xinfcorigs, i], i, 1, n_c)
speedprofilec1 = If(xinfc1 ≟ x0c1, 3, speedc1)
speedprofilec2 = If(xinfc2 ≟ x0c2, 3, speedc2)
speedprofilec3 = If(xinfc3 ≟ x0c3, 3, speedc3)
flogistic(x) = (1 / (1 + ℯ^((-2 * (x / ((1.5 * dx2)) - 2)))) - 1 / (1 + ℯ^(4))) / (1 - 1 / (1 + ℯ^(4)))
fexpgrow(x) = ℯ^((x * log(2) / dx2)) - 1
s1c1curve(x) = If[0 ≤ x, (fexpgrow(x) * s1c1val) + x0c1]
s1c3curve(x) = If[0 ≤ x, (fexpgrow(x) * s1c3val) + x0c3]
s1c2curve(x) = If[0 ≤ x, (fexpgrow(x) * s1c2val) + x0c2]
s2c1curve(x) = If[0 ≤ x, ((s23c1val - x0c1) * flogistic(x)) + x0c1]
s2c2curve(x) = If[0 ≤ x, ((s23c2val - x0c2) * flogistic(x)) + x0c2]
s2c3curve(x) = If[0 ≤ x, ((s23c3val - x0c3) * flogistic(x)) + x0c3]
fexpdecay(x) = ℯ^(((-x)) / dx2)
s3c1curve(x) = If[0 ≤ x, ((x0c1 - s23c1val) * fexpdecay(x)) + s23c1val]
s3c2curve(x) = If[0 ≤ x, ((x0c2 - s23c2val) * fexpdecay(x)) + s23c2val]
s3c3curve(x) = If[0 ≤ x, ((x0c3 - s23c3val) * fexpdecay(x)) + s23c3val]
c1phaseline = Vector((x0c1, 0), (Min[xmax1, Max[xmin1, xinfc1]], 0))
c2phaseline = Vector((x0c2, 0), (Min[xmax1, Max[xmin1, xinfc2]], 0))
c3phaseline = Vector((x0c3, 0), (Min[xmax1, Max[xmin1, xinfc3]], 0))
t = 0 (slider from 0 to xmax2, step 0.05)
c1curve = If(speedc1 ≟ 1, s1c1curve, If[speedc1 ≟ 2, s2c1curve, s3c1curve])
c2curve = If(speedc2 ≟ 1, s1c2curve, If[speedc2 ≟ 2, s2c2curve, s3c2curve])
c3curve = If(speedc3 ≟ 1, s1c3curve, If[speedc3 ≟ 2, s2c3curve, s3c3curve])
Pc1t: (t, c1curve(t))
Pc2t: (t, c2curve(t))
Pc3t: (t, c3curve(t))
Pc1tphase: (c1curve(t), 0)
Pc2tphase: (c2curve(t), 0)
Pc3tphase: (c3curve(t), 0)
tline: x = t
vec8valid: step ≥ 3 ∧ nv1 ≥ 8 ∧ y(DV8) ≟ 0 ∧ y(DV8h) ≟ 0 ∧ If[DV8_equilibria > 0, x(DV8h) ≟ x(DV8), If[f(x(DV8)) > 0, x(DV8h) > x(DV8) ∧ Max[Sequence[If[x(Element[equilibria, i]) > x(DV8) ∧ x(Element[equilibria, i]) < x(DV8h), 1, 0], i, 1, n_equilibria]] ≟ 0, x(DV8h) < x(DV8) ∧ Max[Sequence[If[x(Element[equilibria, i]) < x(DV8) ∧ x(Element[equilibria, i]) > x(DV8h), 1, 0], i, 1, n_equilibria]] ≟ 0]]
vec9valid: step ≥ 3 ∧ nv1 ≥ 9 ∧ y(DV9) ≟ 0 ∧ y(DV9h) ≟ 0 ∧ If[DV9_equilibria > 0, x(DV9h) ≟ x(DV9), If[f(x(DV9)) > 0, x(DV9h) > x(DV9) ∧ Max[Sequence[If[x(Element[equilibria, i]) > x(DV9) ∧ x(Element[equilibria, i]) < x(DV9h), 1, 0], i, 1, n_equilibria]] ≟ 0, x(DV9h) < x(DV9) ∧ Max[Sequence[If[x(Element[equilibria, i]) < x(DV9) ∧ x(Element[equilibria, i]) > x(DV9h), 1, 0], i, 1, n_equilibria]] ≟ 0]]
xDVhs = First({If[y(DV1h) ≟ 0, x(DV1h)], If[y(DV2h) ≟ 0, x(DV2h)], If[y(DV3h) ≟ 0, x(DV3h)], If[y(DV4h) ≟ 0, x(DV4h)], If[y(DV5h) ≟ 0, x(DV5h)], If[y(DV6h) ≟ 0, x(DV6h)], If[y(DV7h) ≟ 0, x(DV7h)], If[y(DV8h) ≟ 0, x(DV8h)], If[y(DV9h) ≟ 0, x(DV9h)]}, nv1)
xDVs = First({If[y(DV1) ≟ 0, x(DV1)], If[y(DV2) ≟ 0, x(DV2)], If[y(DV3) ≟ 0, x(DV3)], If[y(DV4) ≟ 0, x(DV4)], If[y(DV5) ≟ 0, x(DV5)], If[y(DV6) ≟ 0, x(DV6)], If[y(DV7) ≟ 0, x(DV7)], If[y(DV8) ≟ 0, x(DV8)], If[y(DV9) ≟ 0, x(DV9)]}, nv1)
xequilibria = Zip(x(A), A, equilibria)
xDVsort = Sort(Sequence[(Element[xDVs, i], Element[xDVhs, i]), i, 1, nv1])
foundallequilibria1 = Zip(If[step ≥ 3, Max[Sequence[If[Element[xDVs, i] ≟ a ∧ Element[xDVhs, i] ≟ a, 1, 0], i, 1, nv1]], 0], a, xequilibria)
noDVoverlap = Sequence(If[step ≥ 3, If[Max[x(Element[xDVsort, i]), y(Element[xDVsort, i])] < Min[x(Element[xDVsort, i + 1]), y(Element[xDVsort, i + 1])], 1, 0], 0], i, 1, nv1 - 1)
proportionalDVlengths = Sequence(If[step ≥ 3, If[abs(atan(f(x(Element[xDVsort, i])))) > abs(atan(f(x(Element[xDVsort, i + 1])))) + dvecdir, If[abs(x(Element[xDVsort, i]) - y(Element[xDVsort, i])) > (1.1 * abs(x(Element[xDVsort, i + 1]) - y(Element[xDVsort, i + 1]))), 1, 0], If[abs(atan(f(x(Element[xDVsort, i])))) + dvecdir < abs(atan(f(x(Element[xDVsort, i + 1])))), If[(abs(x(Element[xDVsort, i]) - y(Element[xDVsort, i])) * 1.1) < abs(x(Element[xDVsort, i + 1]) - y(Element[xDVsort, i + 1])), 1, 0], If[Defined[Element[xDVsort, i]], 1, 0]]], 0], i, 1, nv1 - 1)
ySVs = First({y(SV1), y(SV2), y(SV3), y(SV4), y(SV5), y(SV6), y(SV7), y(SV8), y(SV9)}, nv2)
ySVhs = First({y(SV1h), y(SV2h), y(SV3h), y(SV4h), y(SV5h), y(SV6h), y(SV7h), y(SV8h), y(SV9h)}, nv2)
foundallequilibria2 = Zip(If[step ≥ 4, Max[Sequence[If[Element[ySVs, i] ≟ a ∧ Element[ySVhs, i] ≟ a, 1, 0], i, 1, nv2]], 0], a, xequilibria)
ySVsort = Sort(Sequence[(Element[ySVs, i], Element[ySVhs, i]), i, 1, nv2])
noSVoverlap = Sequence(If[step ≥ 4, If[Max[x(Element[ySVsort, i]), y(Element[ySVsort, i])] < Min[x(Element[ySVsort, i + 1]), y(Element[ySVsort, i + 1])], 1, 0], 0], i, 1, nv2 - 1)
proportionalSVangles = Sequence(If[step ≥ 4, If[abs(atan(f(x(Element[ySVsort, i])))) > abs(atan(f(x(Element[ySVsort, i + 1])))) + dvecdir, If[abs(x(Element[ySVsort, i]) - y(Element[ySVsort, i])) > 0.001 + abs(x(Element[ySVsort, i + 1]) - y(Element[ySVsort, i + 1])), 1, 0], If[abs(atan(f(x(Element[ySVsort, i])))) + dvecdir < abs(atan(f(x(Element[ySVsort, i + 1])))), If[abs(x(Element[ySVsort, i]) - y(Element[ySVsort, i])) + 0.001 < abs(x(Element[ySVsort, i + 1]) - y(Element[ySVsort, i + 1])), 1, 0], If[Defined[Element[ySVsort, i]], 1, 0]]], 0], i, 1, nv2 - 1)
svec1valid: step ≥ 4 ∧ nv2 ≥ 1 ∧ If[SV1_equilibria > 0, y(SV1h) ≟ y(SV1), If[f(y(SV1)) > 0, y(SV1h) > y(SV1) ∧ Max[Sequence[If[x(Element[equilibria, i]) > y(SV1) ∧ x(Element[equilibria, i]) < y(SV1h), 1, 0], i, 1, n_equilibria]] ≟ 0, y(SV1h) < y(SV1) ∧ Max[Sequence[If[x(Element[equilibria, i]) < y(SV1) ∧ x(Element[equilibria, i]) > y(SV1h), 1, 0], i, 1, n_equilibria]] ≟ 0]]
svec2valid: step ≥ 4 ∧ nv2 ≥ 2 ∧ If[SV2_equilibria > 0, y(SV2h) ≟ y(SV2), If[f(y(SV2)) > 0, y(SV2h) > y(SV2) ∧ Max[Sequence[If[x(Element[equilibria, i]) > y(SV2) ∧ x(Element[equilibria, i]) < y(SV2h), 1, 0], i, 1, n_equilibria]] ≟ 0, y(SV2h) < y(SV2) ∧ Max[Sequence[If[x(Element[equilibria, i]) < y(SV2) ∧ x(Element[equilibria, i]) > y(SV2h), 1, 0], i, 1, n_equilibria]] ≟ 0]]
svec3valid: step ≥ 4 ∧ nv2 ≥ 3 ∧ If[SV3_equilibria > 0, y(SV3h) ≟ y(SV3), If[f(y(SV3)) > 0, y(SV3h) > y(SV3) ∧ Max[Sequence[If[x(Element[equilibria, i]) > y(SV3) ∧ x(Element[equilibria, i]) < y(SV3h), 1, 0], i, 1, n_equilibria]] ≟ 0, y(SV3h) < y(SV3) ∧ Max[Sequence[If[x(Element[equilibria, i]) < y(SV3) ∧ x(Element[equilibria, i]) > y(SV3h), 1, 0], i, 1, n_equilibria]] ≟ 0]]
svec4valid: step ≥ 4 ∧ nv2 ≥ 4 ∧ If[SV4_equilibria > 0, y(SV4h) ≟ y(SV4), If[f(y(SV4)) > 0, y(SV4h) > y(SV4) ∧ Max[Sequence[If[x(Element[equilibria, i]) > y(SV4) ∧ x(Element[equilibria, i]) < y(SV4h), 1, 0], i, 1, n_equilibria]] ≟ 0, y(SV4h) < y(SV4) ∧ Max[Sequence[If[x(Element[equilibria, i]) < y(SV4) ∧ x(Element[equilibria, i]) > y(SV4h), 1, 0], i, 1, n_equilibria]] ≟ 0]]
svec5valid: step ≥ 4 ∧ nv2 ≥ 5 ∧ If[SV5_equilibria > 0, y(SV5h) ≟ y(SV5), If[f(y(SV5)) > 0, y(SV5h) > y(SV5) ∧ Max[Sequence[If[x(Element[equilibria, i]) > y(SV5) ∧ x(Element[equilibria, i]) < y(SV5h), 1, 0], i, 1, n_equilibria]] ≟ 0, y(SV5h) < y(SV5) ∧ Max[Sequence[If[x(Element[equilibria, i]) < y(SV5) ∧ x(Element[equilibria, i]) > y(SV5h), 1, 0], i, 1, n_equilibria]] ≟ 0]]
svec6valid: step ≥ 4 ∧ nv2 ≥ 6 ∧ If[SV6_equilibria > 0, y(SV6h) ≟ y(SV6), If[f(y(SV6)) > 0, y(SV6h) > y(SV6) ∧ Max[Sequence[If[x(Element[equilibria, i]) > y(SV6) ∧ x(Element[equilibria, i]) < y(SV6h), 1, 0], i, 1, n_equilibria]] ≟ 0, y(SV6h) < y(SV6) ∧ Max[Sequence[If[x(Element[equilibria, i]) < y(SV6) ∧ x(Element[equilibria, i]) > y(SV6h), 1, 0], i, 1, n_equilibria]] ≟ 0]]
svec7valid: step ≥ 4 ∧ nv2 ≥ 7 ∧ If[SV7_equilibria > 0, y(SV7h) ≟ y(SV7), If[f(y(SV7)) > 0, y(SV7h) > y(SV7) ∧ Max[Sequence[If[x(Element[equilibria, i]) > y(SV7) ∧ x(Element[equilibria, i]) < y(SV7h), 1, 0], i, 1, n_equilibria]] ≟ 0, y(SV7h) < y(SV7) ∧ Max[Sequence[If[x(Element[equilibria, i]) < y(SV7) ∧ x(Element[equilibria, i]) > y(SV7h), 1, 0], i, 1, n_equilibria]] ≟ 0]]
svec8valid: step ≥ 4 ∧ nv2 ≥ 8 ∧ If[SV8_equilibria > 0, y(SV8h) ≟ y(SV8), If[f(y(SV8)) > 0, y(SV8h) > y(SV8) ∧ Max[Sequence[If[x(Element[equilibria, i]) > y(SV8) ∧ x(Element[equilibria, i]) < y(SV8h), 1, 0], i, 1, n_equilibria]] ≟ 0, y(SV8h) < y(SV8) ∧ Max[Sequence[If[x(Element[equilibria, i]) < y(SV8) ∧ x(Element[equilibria, i]) > y(SV8h), 1, 0], i, 1, n_equilibria]] ≟ 0]]
svec9valid: step ≥ 4 ∧ nv2 ≥ 9 ∧ If[SV9_equilibria > 0, y(SV9h) ≟ y(SV9), If[f(y(SV9)) > 0, y(SV9h) > y(SV9) ∧ Max[Sequence[If[x(Element[equilibria, i]) > y(SV9) ∧ x(Element[equilibria, i]) < y(SV9h), 1, 0], i, 1, n_equilibria]] ≟ 0, y(SV9h) < y(SV9) ∧ Max[Sequence[If[x(Element[equilibria, i]) < y(SV9) ∧ x(Element[equilibria, i]) > y(SV9h), 1, 0], i, 1, n_equilibria]] ≟ 0]]
speedcorigs = First({speedprofilec1, speedprofilec2, speedprofilec3}, n_c)
speedcs = If(step ≥ 5 ∧ n_c > 0, Sort[speedcorigs, sortindices], {})
xinfcs = If(step ≥ 5 ∧ n_c > 0, Sort[xinfcorigs, sortindices], {})
x0cs = If(step ≥ 5 ∧ n_c > 0, Sort[x0corigs, sortindices], {})
xlabel1displayed: "" + (LaTeX[statevar]) + ""
ylabel2displayed: "" + (LaTeX[statevar]) + ""
ylabel1displayed: "" + (LaTeX[funlabel]) + ""
validvectors2 = First({If[svec1valid, 1, 0], If[svec2valid, 1, 0], If[svec3valid, 1, 0], If[svec4valid, 1, 0], If[svec5valid, 1, 0], If[svec6valid, 1, 0], If[svec7valid, 1, 0], If[svec8valid, 1, 0], If[svec9valid, 1, 0]}, nv2)
vec6valid: step ≥ 3 ∧ nv1 ≥ 6 ∧ y(DV6) ≟ 0 ∧ y(DV6h) ≟ 0 ∧ If[DV6_equilibria > 0, x(DV6h) ≟ x(DV6), If[f(x(DV6)) > 0, x(DV6h) > x(DV6) ∧ Max[Sequence[If[x(Element[equilibria, i]) > x(DV6) ∧ x(Element[equilibria, i]) < x(DV6h), 1, 0], i, 1, n_equilibria]] ≟ 0, x(DV6h) < x(DV6) ∧ Max[Sequence[If[x(Element[equilibria, i]) < x(DV6) ∧ x(Element[equilibria, i]) > x(DV6h), 1, 0], i, 1, n_equilibria]] ≟ 0]]
vec7valid: step ≥ 3 ∧ nv1 ≥ 7 ∧ y(DV7) ≟ 0 ∧ y(DV7h) ≟ 0 ∧ If[DV7_equilibria > 0, x(DV7h) ≟ x(DV7), If[f(x(DV7)) > 0, x(DV7h) > x(DV7) ∧ Max[Sequence[If[x(Element[equilibria, i]) > x(DV7) ∧ x(Element[equilibria, i]) < x(DV7h), 1, 0], i, 1, n_equilibria]] ≟ 0, x(DV7h) < x(DV7) ∧ Max[Sequence[If[x(Element[equilibria, i]) < x(DV7) ∧ x(Element[equilibria, i]) > x(DV7h), 1, 0], i, 1, n_equilibria]] ≟ 0]]
vec5valid: step ≥ 3 ∧ nv1 ≥ 5 ∧ y(DV5) ≟ 0 ∧ y(DV5h) ≟ 0 ∧ If[DV5_equilibria > 0, x(DV5h) ≟ x(DV5), If[f(x(DV5)) > 0, x(DV5h) > x(DV5) ∧ Max[Sequence[If[x(Element[equilibria, i]) > x(DV5) ∧ x(Element[equilibria, i]) < x(DV5h), 1, 0], i, 1, n_equilibria]] ≟ 0, x(DV5h) < x(DV5) ∧ Max[Sequence[If[x(Element[equilibria, i]) < x(DV5) ∧ x(Element[equilibria, i]) > x(DV5h), 1, 0], i, 1, n_equilibria]] ≟ 0]]
vec4valid: step ≥ 3 ∧ nv1 ≥ 4 ∧ y(DV4) ≟ 0 ∧ y(DV4h) ≟ 0 ∧ If[DV4_equilibria > 0, x(DV4h) ≟ x(DV4), If[f(x(DV4)) > 0, x(DV4h) > x(DV4) ∧ Max[Sequence[If[x(Element[equilibria, i]) > x(DV4) ∧ x(Element[equilibria, i]) < x(DV4h), 1, 0], i, 1, n_equilibria]] ≟ 0, x(DV4h) < x(DV4) ∧ Max[Sequence[If[x(Element[equilibria, i]) < x(DV4) ∧ x(Element[equilibria, i]) > x(DV4h), 1, 0], i, 1, n_equilibria]] ≟ 0]]
vec3valid: step ≥ 3 ∧ nv1 ≥ 3 ∧ y(DV3) ≟ 0 ∧ y(DV3h) ≟ 0 ∧ If[DV3_equilibria > 0, x(DV3h) ≟ x(DV3), If[f(x(DV3)) > 0, x(DV3h) > x(DV3) ∧ Max[Sequence[If[x(Element[equilibria, i]) > x(DV3) ∧ x(Element[equilibria, i]) < x(DV3h), 1, 0], i, 1, n_equilibria]] ≟ 0, x(DV3h) < x(DV3) ∧ Max[Sequence[If[x(Element[equilibria, i]) < x(DV3) ∧ x(Element[equilibria, i]) > x(DV3h), 1, 0], i, 1, n_equilibria]] ≟ 0]]
vec2valid: step ≥ 3 ∧ nv1 ≥ 2 ∧ y(DV2) ≟ 0 ∧ y(DV2h) ≟ 0 ∧ If[DV2_equilibria > 0, x(DV2h) ≟ x(DV2), If[f(x(DV2)) > 0, x(DV2h) > x(DV2) ∧ Max[Sequence[If[x(Element[equilibria, i]) > x(DV2) ∧ x(Element[equilibria, i]) < x(DV2h), 1, 0], i, 1, n_equilibria]] ≟ 0, x(DV2h) < x(DV2) ∧ Max[Sequence[If[x(Element[equilibria, i]) < x(DV2) ∧ x(Element[equilibria, i]) > x(DV2h), 1, 0], i, 1, n_equilibria]] ≟ 0]]
vec1valid: step ≥ 3 ∧ nv1 ≥ 1 ∧ y(DV1) ≟ 0 ∧ y(DV1h) ≟ 0 ∧ If[DV1_equilibria > 0, x(DV1h) ≟ x(DV1), If[f(x(DV1)) > 0, x(DV1h) > x(DV1) ∧ Max[Sequence[If[x(Element[equilibria, i]) > x(DV1) ∧ x(Element[equilibria, i]) < x(DV1h), 1, 0], i, 1, n_equilibria]] ≟ 0, x(DV1h) < x(DV1) ∧ Max[Sequence[If[x(Element[equilibria, i]) < x(DV1) ∧ x(Element[equilibria, i]) > x(DV1h), 1, 0], i, 1, n_equilibria]] ≟ 0]]
validvectors1 = First({If[vec1valid, 1, 0], If[vec2valid, 1, 0], If[vec3valid, 1, 0], If[vec4valid, 1, 0], If[vec5valid, 1, 0], If[vec6valid, 1, 0], If[vec7valid, 1, 0], If[vec8valid, 1, 0], If[vec9valid, 1, 0]}, nv1)
x02: 5
x03: -3.5
nics: 3
x0s = First({x01, x02, x03}, nics)
xinf1: 3
xinf2: 3
xinf3: -5.5
xinfs = First({xinf1, xinf2, xinf3}, nics)
speedprofile1: 2
speedprofile2: 3
speedprofile3: 1
speedprofiles = First({speedprofile1, speedprofile2, speedprofile3}, nics)
c1ind = If(step ≥ 5 ∧ n_c ≥ 1, If[abs(x0c1 - x01) < threshold_y2 / 2, 1, If[abs(x0c1 - x02) < threshold_y2 / 2, 2, If[abs(x0c1 - x03) < threshold_y2 / 2, 3, 0]]], 0)
c2ind = If(step ≥ 5 ∧ n_c ≥ 2, If[abs(x0c2 - x01) < threshold_y2 / 2, If[c1ind ≟ 1, 0, 1], If[abs(x0c2 - x02) < threshold_y2 / 2, If[c1ind ≟ 2, 0, 2], If[abs(x0c2 - x03) < threshold_y2 / 2, If[c1ind ≟ 3, 0, 3], 0]]], 0)
c3ind = If(step ≥ 5 ∧ n_c ≥ 3, If[abs(x0c3 - x01) < threshold_y2 / 2, If[c1ind ≟ 1 ∨ c2ind ≟ 1, 0, 1], If[abs(x0c3 - x02) < threshold_y2 / 2, If[c1ind ≟ 2 ∨ c2ind ≟ 2, 0, 2], If[abs(x0c3 - x03) < threshold_y2 / 2, If[c1ind ≟ 3 ∨ c2ind ≟ 3, 0, 3], 0]]], 0)
xinfc1correct: step ≥ 5 ∧ n_c ≥ 1 ∧ c1ind ≥ 1 ∧ abs(xinfc1 - Element[xinfs, c1ind]) < threshold_y2 / 2
xinfc2correct: step ≥ 5 ∧ n_c ≥ 2 ∧ c2ind ≥ 1 ∧ abs(xinfc2 - Element[xinfs, c2ind]) < threshold_y2 / 2
xinfc3correct: step ≥ 5 ∧ n_c ≥ 3 ∧ c3ind ≥ 1 ∧ abs(xinfc3 - Element[xinfs, c3ind]) < threshold_y2 / 2
speedprofilec3correct: step ≥ 5 ∧ n_c ≥ 3 ∧ c3ind ≥ 1 ∧ speedprofilec3 ≟ Element[speedprofiles, c3ind]
speedprofilec2correct: step ≥ 5 ∧ n_c ≥ 2 ∧ c2ind ≥ 1 ∧ speedprofilec2 ≟ Element[speedprofiles, c2ind]
speedprofilec1correct: step ≥ 5 ∧ n_c ≥ 1 ∧ c1ind ≥ 1 ∧ speedprofilec1 ≟ Element[speedprofiles, c1ind]
Palabel: statevar + "=" + (x(Pa))
Pblabel: "" + statevar + "=" + (y(Pb)) + ""
flabel: "f(" + statevar + ") = " + (f(x(Pa))) + ""