Date: 20 May 2013

%x

%x

%x

%x

%x

x

Eorig5_sub = (1.7071524966261808, 0.01775147928994083)
xmax = 5
xmin = -5
dx = 1
eorig5_sub: (round(x(Eorig5_sub) / dx) * dx)
Eorig5 = DynamicCoordinates(Eorig5_sub, If[eorig5_sub  <  xmin, xmin, If[eorig5_sub > xmax, xmax, eorig5_sub]], 0)
Eorig4_sub = (0, 0)
eorig4_sub: (round(x(Eorig4_sub) / dx) * dx)
Eorig4 = DynamicCoordinates(Eorig4_sub, If[eorig4_sub  <  xmin, xmin, If[eorig4_sub > xmax, xmax, eorig4_sub]], 0)
Eorig3_sub = (-1, 0)
eorig3_sub: (round(x(Eorig3_sub) / dx) * dx)
Eorig3 = DynamicCoordinates(Eorig3_sub, If[eorig3_sub  <  xmin, xmin, If[eorig3_sub > xmax, xmax, eorig3_sub]], 0)
Eorig2_sub = (-2.2469635627530367, -0.13609467455621302)
eorig2_sub: (round(x(Eorig2_sub) / dx) * dx)
Eorig2 = DynamicCoordinates(Eorig2_sub, If[eorig2_sub  <  xmin, xmin, If[eorig2_sub > xmax, xmax, eorig2_sub]], 0)
Eorig1_sub = (1.1808367071524968, 0.05325443786982249)
eorig1_sub: (round(x(Eorig1_sub) / dx) * dx)
Eorig1 = DynamicCoordinates(Eorig1_sub, If[eorig1_sub  <  xmin, xmin, If[eorig1_sub > xmax, xmax, eorig1_sub]], 0)
q(x) = (round(x / dx) * dx)
eorig1: x(Eorig1)
eorig2: x(Eorig2)
eorig3: x(Eorig3)
eorig4: x(Eorig4)
eorig5: x(Eorig5)
eorigs: {eorig1, eorig2, eorig3, eorig4, eorig5}
n_e = 0 (slider from 0 to 5, step 1)
es = RemoveUndefined(Join[{Sort[Sequence[Element[eorigs, i], i, 1, n_e]], Sequence[xmax + 1, i, n_e + 1, 5]}])
eon = Element(es, n_e)
e4 = Element(es, 4)
e2 = Element(es, 2)
e1 = Element(es, 1)
e3 = Element(es, 3)
e5 = Element(es, 5)
fseg1 = 0
fseg2 = 0
fseg3 = 0
fseg4 = 0
fseg5 = 0
fseg6 = 0
f = If(n_e ≟ 0, (5 * fseg1) + (1.0E-4 * x), If[x  <  e1, (((fseg1 * 10) * ((2 * xmin) - e1 - x)) * (x - e1) / (e1 - xmin)^(2)), If[x  <  e2, (((fseg2 * 10) * (e1 - x)) * (x - e2) / (e2 - e1)^(2)), If[x  <  e3, (((fseg3 * 10) * (e2 - x)) * (x - e3) / (e3 - e2)^(2)), If[x  <  e4, (((fseg4 * 10) * (e3 - x)) * (x - e4) / (e4 - e3)^(2)), If[x  <  e5, (((fseg5 * 10) * (e4 - x)) * (x - e5) / (e5 - e4)^(2)), If[x ≥ eon, (((fseg6 * 10) * (eon - x)) * (x - (2 * xmax) + eon) / (xmax - eon)^(2)), fseg6]]]]]])
ymin = -1
ymax = 1
nvecs = 20
dvec: (xmax - xmin) / nvecs
vecfmags = Sequence(If[abs(f(xx))  <  ymax - ymin, sqrt(abs(f(xx))), abs(f(xx) - ymax + ymin)^(1 / 4) + sqrt(ymax - ymin)], xx, xmin, xmax, dvec)
fmag = 0.2
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)
seg2 = Segment(EO1, EO2)
seg3 = Segment(EO2, EO3)
seg4 = Segment(EO3, EO4)
seg5 = Segment(EO4, EO5)
Eorig1stable = 1
vecxs = Sequence(xx, xx, xmin, xmax, dvec)
vecdirs = Sequence(If[(f(xx) > 0) ∧ (f(xx - dvec / 2) > 0), -1, If[(f(xx)  <  0) ∧ (f(xx + dvec / 2)  <  0), 1, 0]], xx, xmin, xmax, dvec)
veclen: (dvec * 0.5)
vecwidths: ((vecfmags * sqrt(ymax - ymin)) * 0.07)
vectorfield = Zip(Polygon[(a, 0), (a + ((b * veclen) * (1 + Min[(2 * c), 1])), c), (a + ((b * veclen / 2) * (1 + Min[(2 * c), 1])), 0), (a + ((b * veclen) * (1 + Min[(2 * c), 1])), (-c))], a, vecxs, b, vecdirs, c, vecwidths)
Eorig2stable = 1
Eorig3stable = 1
Eorig4stable = 1
Eorig5stable = 1
eorigsstable: {Eorig1stable, Eorig2stable, Eorig3stable, Eorig4stable, Eorig5stable}
dirseg1: fseg1
dirseg2 = If(n_e  <  1, 0, fseg2)
dirseg3 = If(n_e  <  2, 0, fseg3)
dirseg4 = If(n_e  <  3, 0, fseg4)
dirseg5 = If(n_e  <  4, 0, fseg5)
dirseg6 = If(n_e  <  5, 0, fseg6)
showne = true
xlabeldisplay: "" + (LaTeX[xlabel]) + ""
e5stable = If(n_e ≥ 5, Element[eorigsstable, IndexOf[e5, eorigs]], -1)
e4stable = If(n_e ≥ 4, Element[eorigsstable, IndexOf[e4, eorigs]], -1)
e3stable = If(n_e ≥ 3, Element[eorigsstable, IndexOf[e3, eorigs]], -1)
e2stable = If(n_e ≥ 2, Element[eorigsstable, IndexOf[e2, eorigs]], -1)
e1stable = If(n_e ≥ 1, Element[eorigsstable, IndexOf[e1, eorigs]], -1)
seg6 = Segment(EO5, (xmax + 1, 0))
seg1 = Segment((xmin, 0), If[n_e ≟ 0, (xmax, 0), EO1])
e1_set:2
e2_set:-2
e3_set:-1
e4_set:0
e5_set:1
e1stable_set:1
e2stable_set:1
e3stable_set:1
e4stable_set:1
e5stable_set:1