f(t)

y(t)

∫f(t)dt

dy/dt=f(t)=

t_0=

t_f=

+

-

↑

↓

+

-

↑

↓

exact

y(t_0)=

Δt=

p = 1
f(t) = t^(2) - 10
t0 = 0
tfinal = 10
n = 10
dt = 1
fvals = Sequence(f(t0 + (i + p) * dt), i, 0, n)
cumsum: Sequence[Sum[fvals, i], i, 0, n] * dt
K = (0.4917127071823204, 0)
y0 = 50
feest = Sequence((t0 + dt * i, y0 + Element[cumsum, i + 1]), i, 0, n)
feconnect = PolyLine(feest)
L = Intersect(OrthogonalLine[(tfinal, 0), xAxis], feconnect)
C = Intersect(OrthogonalLine[(Max[t0, Min[tfinal, x(K)]], 0), xAxis], feconnect)
B = DynamicCoordinates(K, x(C), y(C))
t0plus: t0 + (tfinal - t0) * 0.001
fpoints = Sequence((t0 + (i + p) * dt, f(t0 + (i + p) * dt)), i, 0, n)
flines = Sequence(Segment[Element[fpoints, i] - p * (dt, 0), Element[fpoints, i] + (1 - p) * (dt, 0)], i, 1, n)
D = (0.4917127071823204, -11.288200188736896)
G = Element(First[RemoveUndefined[Sequence[Intersect[Element[flines, i], OrthogonalLine[(Max[t0, Min[tfinal, x(D)]], 0), xAxis]], i, 1, n]]], 1)
fint0 = Integral(f)
fint = Function(fint0(t) - fint0(t0) + y0, t0, tfinal)
g: x = t0
h: x = tfinal
inputBoxf = Textfield(f)
inputBox4 = Textfield(t0)
inputBox5 = Textfield(tfinal)
maxn = 5000
centery1 = 48.81040573120117
centery2 = 186.20582751272076
height1 = 74.50580596923828
height2 = 227.3736754432321
miny1: centery1 - height1
miny2: centery2 - height2
maxy2: centery2 + height2
maxy1: centery1 + height1
minx: t0 - (tfinal - t0) * 0.1
A = DynamicCoordinates(D, x(G), y(G))
E: (If[x(A) < t0 + dt * (n - 1), floor((x(A) - t0) / dt) * dt + t0, t0 + dt * (n - 1)], y(A))
highlightseg1 = Segment(E, E + (dt, 0))
F = Intersect(OrthogonalLine[E, xAxis], feconnect)
highlightseg2 = Segment(F, F + dt * (1, y(E)))
c: x(E)
fc: y(E)
yc: y(F)
exact = false
ycp1: yc + fc * dt
yfinalexact: fint(tfinal)
fcdx: fc * dt
cp1: c + dt
ycp1exact: fint(cp1)
ycp1errror: abs(ycp1 - ycp1exact)
maxx: tfinal + (tfinal - t0) * 0.1
d: x(B)
yd: y(B)
fd: f(d)
ydexact: fint(d)
yderror: abs(yd - ydexact)
J = Point(g)
inputBox1 = Textfield(y0)
cpdt: c + p * dt
k: y = y(A)
l: y = y(B) + y(A) * (x - x(B))
inputBox2 = Textfield(dt)
text2: "$n_{\text{iter}}= " + (LaTeX[n]) + "$"
text1: "$ y(" + (LaTeX[t0]) + ") $"
text3: "$y(" + (LaTeX[c]) + ")\approx" + (LaTeX[yc]) + ", f(" + (LaTeX[cpdt]) + ")= " + (LaTeX[fc]) + "$
$\begin{align}y(" + (LaTeX[c]) + "+\Delta t)&\approx y(" + (LaTeX[c]) + ")+f(" + (LaTeX[c]) + ")\Delta t\\
&=" + (LaTeX[yc]) + "+ " + (LaTeX[fc]) + "\cdot " + (LaTeX[dt]) + "\\
&=" + (LaTeX[ycp1]) + "\end{align}$"
text5: "Exact: $y(" + (LaTeX[d]) + ")=" + (LaTeX[ydexact]) + "$
Error: $|" + (LaTeX[yd]) + "-" + (LaTeX[ydexact]) + "|=" + (LaTeX[yderror]) + "$"
details = true
text4: "Estimate: $y(" + (LaTeX[d]) + ")\approx " + (LaTeX[yd]) + "$"