Date: 11 November 2012

X_0

dx/dt=f(x)=

vector field

t_0=

t_f=

xmin=

xmax=

equilibria

ymin=

ymax=

X_0

function

f(x) = x^(2) - 4
x0a = -2.6595744680851063
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))]]
X0la = 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_a = IterationList(fiter, x0a, n)
tind: ceil((t - t0) / dt) + 1
xt_a = Element(fvals_a, tind)
Xfla: (xt_a, 0)
fline_a = Segment(X0la, Xfla)
ftcurves_a = PolyLine(Sequence[(t0 + (i * dt), Element[fvals_a, i + 1]), i, 0, tind])
Xfra: (t0 + ((tind - 1) * dt), Element[fvals_a, tind])
showvf = false
inputBox2 = Textfield(t0)
inputBox3 = Textfield(tfinal)
zerolist: {Roots[f, xmin, xmax]}
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
X0ra = 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)
x0b = -1.5390070921985815
x0c = -0.5602836879432624
x0d = 0.46099290780141844
x0e = 1.5673758865248226
x0f = 2.24822695035461
X0lb = Point(xAxis)
X0lc = Point(xAxis)
X0ld = Point(xAxis)
X0le = Point(xAxis)
X0lf = Point(xAxis)
X0rb = Point(yAxis)
X0rc = Point(yAxis)
X0rd = Point(yAxis)
X0re = Point(yAxis)
X0rf = Point(yAxis)
fvals_b = IterationList(fiter, x0b, n)
fvals_c = IterationList(fiter, x0c, n)
fvals_d = IterationList(fiter, x0d, n)
fvals_e = IterationList(fiter, x0e, n)
fvals_f = IterationList(fiter, x0f, n)
ftcurves_b = PolyLine(Sequence[(t0 + (i * dt), Element[fvals_b, i + 1]), i, 0, tind])
ftcurves_c = PolyLine(Sequence[(t0 + (i * dt), Element[fvals_c, i + 1]), i, 0, tind])
ftcurves_d = PolyLine(Sequence[(t0 + (i * dt), Element[fvals_d, i + 1]), i, 0, tind])
ftcurves_e = PolyLine(Sequence[(t0 + (i * dt), Element[fvals_e, i + 1]), i, 0, tind])
ftcurves_f = PolyLine(Sequence[(t0 + (i * dt), Element[fvals_f, i + 1]), i, 0, tind])
xt_b = Element(fvals_b, tind)
xt_c = Element(fvals_c, tind)
xt_d = Element(fvals_d, tind)
xt_e = Element(fvals_e, tind)
xt_f = Element(fvals_f, tind)
Xflb: (xt_b, 0)
Xflc: (xt_c, 0)
Xfld: (xt_d, 0)
Xfle: (xt_e, 0)
Xflf: (xt_f, 0)
Xfrb: (t0 + ((tind - 1) * dt), Element[fvals_b, tind])
Xfrc: (t0 + ((tind - 1) * dt), Element[fvals_c, tind])
Xfrd: (t0 + ((tind - 1) * dt), Element[fvals_d, tind])
Xfre: (t0 + ((tind - 1) * dt), Element[fvals_e, tind])
Xfrf: (t0 + ((tind - 1) * dt), Element[fvals_f, tind])
fline_b = Segment(X0lb, Xflb)
fline_c = Segment(X0lc, Xflc)
fline_d = Segment(X0ld, Xfld)
fline_e = Segment(X0le, Xfle)
fline_f = Segment(X0lf, Xflf)
zerolines = Zip(y = a, a, x(zerolist))