%y

%y

%y

%y

%y

%y

%y

%y

%y

%y

y

%y

%y

%y

ymin = -5
ymax = 5
dy = 1
y0options = Sequence((0, i), i, (ceil(ymin / dy) * dy) + dy, ymax - dy, dy)
y0c5point = Point(y0options)
y0c3point = Point(y0options)
y0c2point = Point(y0options)
y0c1point = Point(y0options)
y0c4point = Point(y0options)
n_c = 0 (slider from 0 to 5, step 1)
y0corigs = First({y(y0c1point), y(y0c2point), y(y0c3point), y(y0c4point), y(y0c5point)}, n_c)
y0c5 = If(n_c > 4, y(y0c5point))
y0c3 = If(n_c > 2, y(y0c3point))
y0c2 = If(n_c > 1, y(y0c2point))
y0c1 = If(n_c > 0, y(y0c1point))
y0c4 = If(n_c > 3, y(y0c4point))
speedc5 = 2
speedc4 = 1
speedc3 = 1
speedc2 = 1
speedc1 = 1
tmax = 9
dt = 1
s1c5options: {(dt, y0c5 + dy), (dt, y0c5 - dy)}
s1c5point = Point(s1c5options)
s1c5val: y(s1c5point) - y0c5
s1c3coptions: {(dt, y0c3 + dy), (dt, y0c3 - dy)}
s1c3point = Point(s1c3coptions)
s1c3val: y(s1c3point) - y0c3
s1c2options: {(dt, y0c2 + dy), (dt, y0c2 - dy)}
s1c2point = Point(s1c2options)
s1c2val: y(s1c2point) - y0c2
s1c1options: {(dt, y0c1 + dy), (dt, y0c1 - dy)}
s1c1point = Point(s1c1options)
s1c1val: y(s1c1point) - y0c1
s1c4options: {(dt, y0c4 + dy), (dt, y0c4 - dy)}
s1c4point = Point(s1c4options)
s1c4val: y(s1c4point) - y0c4
s23options = Sequence(((floor((0.98 * tmax / dt)) * dt), i), i, (ceil(ymin / dy) * dy) + dy, ymax - dy, dy)
s23c5point = Point(s23options)
s23c5val: y(s23c5point)
yinfc5 = If(speedc5 ≟ 1, If[s1c5val > 0, ymax, ymin], s23c5val)
s23c4point = Point(s23options)
s23c4val: y(s23c4point)
yinfc4 = If(speedc4 ≟ 1, If[s1c4val > 0, ymax, ymin], s23c4val)
s23c3point = Point(s23options)
s23c3val: y(s23c3point)
yinfc3 = If(speedc3 ≟ 1, If[s1c3val > 0, ymax, ymin], s23c3val)
s23c2point = Point(s23options)
s23c2val: y(s23c2point)
yinfc2 = If(speedc2 ≟ 1, If[s1c2val > 0, ymax, ymin], s23c2val)
s23c1point = Point(s23options)
s23c1val: y(s23c1point)
yinfc1 = If(speedc1 ≟ 1, If[s1c1val > 0, ymax, ymin], s23c1val)
yinfcorigs = First({yinfc1, yinfc2, yinfc3, yinfc4, yinfc5}, n_c)
sortindices = Sequence((Element[y0corigs, i] / dy * (ymax - ymin)) + Element[yinfcorigs, i], i, 1, n_c)
speedprofilec4 = If(yinfc4 ≟ y0c4, 3, speedc4)
speedprofilec1 = If(yinfc1 ≟ y0c1, 3, speedc1)
speedprofilec2 = If(yinfc2 ≟ y0c2, 3, speedc2)
speedprofilec3 = If(yinfc3 ≟ y0c3, 3, speedc3)
speedprofilec5 = If(yinfc5 ≟ y0c5, 3, speedc5)
tmin: (-0.1 * tmax)
s1c1curve = Function(((ℯ^((x * log(2))) - 1) * s1c1val) + y0c1, 0, tmax)
s3c1curve = Function(((y0c1 - s23c1val) * ℯ^((-x))) + s23c1val, 0, tmax)
ylabeldisplay: "" + (LaTeX[ylabel]) + ""
grid = Sequence(Segment[(0, i), (tmax, i)], i, (ceil(ymin / dy) * dy) + dy, ymax - dy, dy)
pointsdt: (0.06 * (tmax - tmin))
pointsdy: (0.1 * (ymax - ymin))
flogistic(x) = (1 / (1 + ℯ^((-2 * (x - (2 * dt))))) - 1 / (1 + ℯ^((4 * dt)))) / (1 - 1 / (1 + ℯ^((4 * dt))))
s2c1curve = Function(((s23c1val - y0c1) * flogistic(x)) + y0c1, 0, tmax)
fexp(x) = ℯ^((x * log(2))) - 1
s1c2curve = Function((fexp(x) * s1c2val) + y0c2, 0, tmax)
s1c3curve = Function((fexp(x) * s1c3val) + y0c3, 0, tmax)
s2c2curve = Function(((s23c2val - y0c2) * flogistic(x)) + y0c2, 0, tmax)
s2c3curve = Function(((s23c3val - y0c3) * flogistic(x)) + y0c3, 0, tmax)
s3c2curve = Function(((y0c2 - s23c2val) * ℯ^((-x))) + s23c2val, 0, tmax)
s3c3curve = Function(((y0c3 - s23c3val) * ℯ^((-x))) + s23c3val, 0, tmax)
n_e = 0 (slider from 0 to 3, step 1)
y0e1point = Point(y0options)
y0e2point = Point(y0options)
y0e3point = Point(y0options)
e1ray = Ray(y0e1point, y0e1point + (1, 0))
e2ray = Ray(y0e2point, y0e2point + (1, 0))
e3ray = Ray(y0e3point, y0e3point + (1, 0))
eorig1stable: true
eorig2stable: true
eorig3stable: true
eorigs = First({y(y0e1point), y(y0e2point), y(y0e3point)}, n_e)
es = Sort(eorigs)
eorigstables = First({eorig1stable, eorig2stable, eorig3stable}, n_e)
estables = Sequence(Element[eorigstables, IndexOf[Element[es, i], eorigs]], i, 1, n_e)
s1c4curve = Function((fexp(x) * s1c4val) + y0c4, 0, tmax)
s2c4curve = Function(((s23c4val - y0c4) * flogistic(x)) + y0c4, 0, tmax)
y0cs = If(n_c > 0, Sort[y0corigs, sortindices], {})
s3c4curve = Function(((y0c4 - s23c4val) * ℯ^((-x))) + s23c4val, 0, tmax)
speedcorigs = First({speedprofilec1, speedprofilec2, speedprofilec3, speedprofilec4, speedprofilec5}, n_c)
speedcs = If(n_c > 0, Sort[speedcorigs, sortindices], {})
yinfcs = If(n_c > 0, Sort[yinfcorigs, sortindices], {})
s1c5curve = Function((fexp(x) * s1c5val) + y0c5, 0, tmax)
s2c5curve = Function(((s23c5val - y0c5) * flogistic(x)) + y0c5, 0, tmax)
s3c5curve = Function(((y0c5 - s23c5val) * ℯ^((-x))) + s23c5val, 0, tmax)
speedsort1 = If(n_c ≥ 1, Element[speedcs, 1])
speedsort2 = If(n_c ≥ 2, Element[speedcs, 2])
speedsort3 = If(n_c ≥ 3, Element[speedcs, 3])
speedsort4 = If(n_c ≥ 4, Element[speedcs, 4])
speedsort5 = If(n_c ≥ 5, Element[speedcs, 5])
yinfsort1 = If(n_c ≥ 1, Element[yinfcs, 1])
yinfsort2 = If(n_c ≥ 2, Element[yinfcs, 2])
yinfsort3 = If(n_c ≥ 3, Element[yinfcs, 3])
yinfsort4 = If(n_c ≥ 4, Element[yinfcs, 4])
yinfsort5 = If(n_c ≥ 5, Element[yinfcs, 5])
establesort1 = If(n_e ≥ 1, If[Element[estables, 1], 1, 0], -1)
establesort2 = If(n_e ≥ 2, If[Element[estables, 2], 1, 0], -1)
establesort3 = If(n_e ≥ 3, If[Element[estables, 3], 1, 0], -1)
showlabels = false
show_ne = true
y0sort1 = If(n_c ≥ 1, Element[y0cs, 1])
y0sort2 = If(n_c ≥ 2, Element[y0cs, 2])
y0sort3 = If(n_c ≥ 3, Element[y0cs, 3])
y0sort4 = If(n_c ≥ 4, Element[y0cs, 4])
y0sort5 = If(n_c ≥ 5, Element[y0cs, 5])
speedprofile1: 1
speedprofile2: 1
speedprofile3: 1
speedprofile4: 1
speedprofile5: 1
y01: -3
y02: 3
y03: 2
y04: -2
y05: 1
threshold: dy / 2
c1ind = If(n_c ≥ 1, If[abs(y0c1 - y01) < threshold / 2, 1, If[abs(y0c1 - y02) < threshold / 2, 2, If[abs(y0c1 - y03) < threshold / 2, 3, If[abs(y0c1 - y04) < threshold / 2, 4, If[abs(y0c1 - y05) < threshold / 2, 5, 0]]]]], 0)
c2ind = If(n_c ≥ 2, If[abs(y0c2 - y01) < threshold / 2, If[c1ind ≟ 1, 0, 1], If[abs(y0c2 - y02) < threshold / 2, If[c1ind ≟ 2, 0, 2], If[abs(y0c2 - y03) < threshold / 2, If[c1ind ≟ 3, 0, 3], If[abs(y0c2 - y04) < threshold / 2, If[c1ind ≟ 4, 0, 4], If[abs(y0c2 - y05) < threshold / 2, If[c1ind ≟ 5, 0, 5], 0]]]]], 0)
c3ind = If(n_c ≥ 3, If[abs(y0c3 - y01) < threshold / 2, If[c1ind ≟ 1 ∨ c2ind ≟ 1, 0, 1], If[abs(y0c3 - y02) < threshold / 2, If[c1ind ≟ 2 ∨ c2ind ≟ 2, 0, 2], If[abs(y0c3 - y03) < threshold / 2, If[c1ind ≟ 3 ∨ c2ind ≟ 3, 0, 3], If[abs(y0c3 - y04) < threshold / 2, If[c1ind ≟ 4 ∨ c2ind ≟ 4, 0, 4], If[abs(y0c3 - y05) < threshold / 2, If[c1ind ≟ 5 ∨ c2ind ≟ 5, 0, 5], 0]]]]], 0)
c4ind = If(n_c ≥ 4, If[abs(y0c4 - y01) < threshold / 2, If[c1ind ≟ 1 ∨ c2ind ≟ 1 ∨ c3ind ≟ 1, 0, 1], If[abs(y0c4 - y02) < threshold / 2, If[c1ind ≟ 2 ∨ c2ind ≟ 2 ∨ c3ind ≟ 2, 0, 2], If[abs(y0c4 - y03) < threshold / 2, If[c1ind ≟ 3 ∨ c2ind ≟ 3 ∨ c3ind ≟ 3, 0, 3], If[abs(y0c4 - y04) < threshold / 2, If[c1ind ≟ 4 ∨ c2ind ≟ 4 ∨ c3ind ≟ 4, 0, 4], If[abs(y0c4 - y05) < threshold / 2, If[c1ind ≟ 5 ∨ c2ind ≟ 5 ∨ c3ind ≟ 5, 0, 5], 0]]]]], 0)
c5ind = If(n_c ≥ 5, If[abs(y0c5 - y01) < threshold / 2, If[c1ind ≟ 1 ∨ c2ind ≟ 1 ∨ c3ind ≟ 1 ∨ c4ind ≟ 1, 0, 1], If[abs(y0c5 - y02) < threshold / 2, If[c1ind ≟ 2 ∨ c2ind ≟ 2 ∨ c3ind ≟ 2 ∨ c4ind ≟ 2, 0, 2], If[abs(y0c5 - y03) < threshold / 2, If[c1ind ≟ 3 ∨ c2ind ≟ 3 ∨ c3ind ≟ 3 ∨ c4ind ≟ 3, 0, 3], If[abs(y0c5 - y04) < threshold / 2, If[c1ind ≟ 4 ∨ c2ind ≟ 4 ∨ c3ind ≟ 4 ∨ c4ind ≟ 4, 0, 4], If[abs(y0c5 - y05) < threshold / 2, If[c1ind ≟ 5 ∨ c2ind ≟ 5 ∨ c3ind ≟ 5 ∨ c4ind ≟ 5, 0, 5], 0]]]]], 0)
yinf1: -2
yinf2: -1
yinf3: 4
yinf4: -3
yinf5: 3
nics: 5
speedprofiles = First({speedprofile1, speedprofile2, speedprofile3, speedprofile4, speedprofile5}, nics)
yinfs = First({yinf1, yinf2, yinf3, yinf4, yinf5}, nics)
speedprofile1correct: n_c ≥ 1 ∧ c1ind ≥ 1 ∧ speedprofilec1 ≟ Element[speedprofiles, c1ind]
speedprofile2correct: n_c ≥ 2 ∧ c2ind ≥ 1 ∧ speedprofilec2 ≟ Element[speedprofiles, c2ind]
speedprofile3correct: n_c ≥ 3 ∧ c3ind ≥ 1 ∧ speedprofilec3 ≟ Element[speedprofiles, c3ind]
speedprofile4correct: n_c ≥ 4 ∧ c4ind ≥ 1 ∧ speedprofilec4 ≟ Element[speedprofiles, c4ind]
speedprofile5correct: n_c ≥ 5 ∧ c5ind ≥ 1 ∧ speedprofilec5 ≟ Element[speedprofiles, c5ind]
yinf1correct: n_c ≥ 1 ∧ c1ind ≥ 1 ∧ abs(yinfc1 - Element[yinfs, c1ind]) < threshold / 2
yinf2correct: n_c ≥ 2 ∧ c2ind ≥ 1 ∧ abs(yinfc2 - Element[yinfs, c2ind]) < threshold / 2
yinf3correct: n_c ≥ 3 ∧ c3ind ≥ 1 ∧ abs(yinfc3 - Element[yinfs, c3ind]) < threshold / 2
yinf4correct: n_c ≥ 4 ∧ c4ind ≥ 1 ∧ abs(yinfc4 - Element[yinfs, c4ind]) < threshold / 2
yinf5correct: n_c ≥ 5 ∧ c5ind ≥ 1 ∧ abs(yinfc5 - Element[yinfs, c5ind]) < threshold / 2