Date: 11 November 2012

w_0

vector field

t_0=

t_f=

w_0=

equilibria

ymin=

ymax=

function

wmin=

wmax=

w_0

x0 = 0
n = 2000
t0 = 0
tfinal = 100
dt: (tfinal - t0) / n
r = 0.52 (slider from 0 to 1, step 0.01)
a = 3.6 (slider from 0.1 to 50, step 0.1)
f(w) = ((r * w) * (1 - w / a)) - w^(2) / (1 + w^(2))
fiter_sub(x) = x + (dt * f(x))
fiter(x) = If[fiter_sub(x) < -10000000000, -10000000000, If[fiter_sub(x) > 10000000000, 10000000000, fiter_sub(x)]]
b = Ray((0, 0), (1, 0))
xmax = 31
xmin = -4
nvecs = 20
dvec: (xmax - xmin) / nvecs
fvals = IterationList(fiter, x0, n)
t = 0 (slider from t0 to tfinal, step dt)
tind: ceil((t - t0) / dt) + 1
xt = Element(fvals, tind)
B: (xt, 0)
A = Point(b)
b_1 = Segment(A, B)
C: (t0 + ((tind - 1) * dt), Element[fvals, tind])
showvf = false
inputBox2 = Textfield(t0)
inputBox3 = Textfield(tfinal)
inputBox4 = Textfield(x0)
zerolist: {Roots[f, xmin, xmax]}
tmin: t0 - ((tfinal - t0) * 0.1)
tmax: tfinal + ((tfinal - t0) * 0.1)
showe = false
ymax = 0.5
ymin = -0.2
inputBox7 = Textfield(ymin)
inputBox8 = Textfield(ymax)
showf = true
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)
veclen: (dvec * 0.5)
vecwidths: ((vecfmags * sqrt(ymax - ymin)) * 0.04)
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)
vecxs = Sequence(xx, xx, xmin, xmax, dvec)
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)
text1: "$ \frac{dw}{dt}=" + (LaTeX[f]) + " $"
inputBox1 = Textfield(xmin)
inputBox5 = Textfield(xmax)
c = Ray((t0, 0), (t0, 1))
D = Point(c)
ftcurvesub = PolyLine(Sequence[(t0 + ((i - 1) * dt), Element[fvals, i]), i, 1, tind])
f' = Derivative(f)
stablezeros = RemoveUndefined(Zip[If[f'(x(a)) < 0, a], a, zerolist])
unstablezeros = RemoveUndefined(Zip[If[f'(x(a)) ≥ 0, a], a, zerolist])
stablezerolines = Zip(y = a, a, x(stablezeros))
unstablezerolines = Zip(y = a, a, x(unstablezeros))
text2: "w(" + (LaTeX[t]) + ") = " + (LaTeX[xt]) + ""
Evalues: x(zerolist)
Einfo: "Visible equilibria: " + Evalues + ""