Date: 11 November 2012

X_0

dx/dt=f(x)=

vector field

t_0=

t_f=

x_0=

xmin=

xmax=

equilibria

ymin=

ymax=

X_0

function

f(x) = x^(2) - 4
x0 = 0.9951923076923077
n = 2000
t0 = 0
tfinal = 10
dt: (tfinal - t0) / n
fiter(x) = If[x + (dt * f(x)) > 10000000000, 10000000000,If[x + (dt * f(x))  <  -10000000000, -10000000000,x + (dt * f(x))]]
A = Point(xAxis)
inputBox1 = Textfield(f)
xmin = -3
xmax = 3
nvecs = 20
dvec: (xmax - xmin) / nvecs
t = 0 (slider from t0 to tfinal, step dt)
fvals = IterationList(fiter, x0, n)
tind: ceil((t - t0) / dt) + 1
xt = Element(fvals, tind)
B: (xt, 0)
b = Segment(A, B)
ftcurvesub = PolyLine(Sequence[(t0 + (i * dt), Element[fvals, i + 1]), i, 0, tind])
C: (t0 + ((tind - 1) * dt), Element[fvals, tind])
showvf = false
inputBox2 = Textfield(t0)
inputBox3 = Textfield(tfinal)
inputBox4 = Textfield(x0)
tmin: t0 - ((tfinal - t0) * 0.1)
tmax: tfinal + ((tfinal - t0) * 0.1)
centery = 0
height = 3
inputBox5 = Textfield(xmin)
inputBox6 = Textfield(xmax)
showe = false
ymin = -5
ymax = 5
inputBox7 = Textfield(ymin)
inputBox8 = Textfield(ymax)
c: x = t0
D = Point(c)
showf = true
maxf: y(Max[abs(f(x)), xmin, xmax])
c_1 = 0
c_2 = 0
c_3 = 0
c_4 = 0
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)
zerolist: {Roots[f, xmin, xmax]}
alpha = 1
mu = 2
f' = Derivative(f)
unstablezeros = RemoveUndefined(Zip[If[f'(x(a)) ≥ 0, a], a, zerolist])
unstablezerolines = Zip(y = a, a, x(unstablezeros))
stablezeros = RemoveUndefined(Zip[If[f'(x(a))  <  0, a], a, zerolist])
stablezerolines = Zip(y = a, a, x(stablezeros))