b

a

x

Δy/Δx

δx

δx

mostra Df

f(b)-f(a)

Δy/Δx

c = 1
f(x) = sin(x) + c
n = 4 (slider from 1 to 100, step 1)
B = Point(xAxis)
b: x(B)
A = Point(xAxis)
X = Point(Segment[A, B])
a: x(A)
k_X = If(X ≟ B, n - 1.0, floor((x(X) - a) * n / (b - a)))
campione = Sequence((a + k * (b - a) / n, f(a + k * (b - a) / n)), k, 0.0, n)
suddivisione = Sequence((a + k * (b - a) / n, 0.0), k, 0.0, n)
P_X: (a + k_X * (b - a) / n, f(a + k_X * (b - a) / n))
poligonale = Sequence(Segment[Element[campione, k], Element[campione, k + 1.0]], k, 1.0, n)
Q_X: (a + (k_X + 1.0) * (b - a) / n, f(a + (k_X + 1.0) * (b - a) / n))
P: (x(X), y(P_X) + (x(X) - x(P_X)) * (y(Q_X) - y(P_X)) / (x(Q_X) - x(P_X)))
pendenze = Sequence((a + k * (b - a) / n, (f(a + (k + 1.0) * (b - a) / n) - f(a + k * (b - a) / n)) * n / (b - a)), k, 0.0, n - 1.0)
pendenze' = Sequence((a + (k + 1.0) * (b - a) / n, (f(a + (k + 1.0) * (b - a) / n) - f(a + k * (b - a) / n)) * n / (b - a)), k, 0.0, n - 1.0)
pendenze_x = Sequence(Segment[Element[pendenze, k], Element[pendenze', k]], k, 1.0, n)
pendenze'_y = Sequence(Segment[(a + k * (b - a) / n, 0.0), Element[pendenze', k]], k, 1.0, n)
pendenze_y = Sequence(Segment[(a + (k - 1.0) * (b - a) / n, 0.0), Element[pendenze, k]], k, 1.0, n)
Y = Segment(X, P)
P': (0.0, y(Element[pendenze, k_X + 1.0]))
d = Segment((-1.0, 0.0), P')
riporto = Segment(P', Element[pendenze, k_X + 1.0])
Δy = Vector((x(Q_X), y(P_X)), Q_X)
Δx = Vector(P_X, (x(Q_X), y(P_X)))
p = Vector((x(P_X), 0.0), Element[pendenze, k_X + 1.0])
δy = Segment((x(X), y(P_X)), (x(X), y(P)))
ρ, e, m, g, h = Polygon((x(P_X), 0.0), X, (x(X), y(p)), (x(P_X), y(p)))
testo2: "δy = " + δy
testo3: "ρ = " + ρ
area_{plurirettangolo} = Sum(Sequence[y(Element[pendenze, k]) * (b - a) / n, k, 1.0, n])
testo4: "area_{plurirettangolo} =" + area_{plurirettangolo}
δx = Segment(P_X, (x(X), y(P_X)))
l = false
X_k: (x(P_X), 0.0)
testo5: "x_" + k_X
Df = Derivative(f(x))
k = Segment((a, f(a)), (b, f(a)))
i = Segment(A, (a, f(a)))
incrementi_x = Sequence(Vector[Vector[(a + k * (b - a) / n, f(a + k * (b - a) / n)), (a + (k + 1.0) * (b - a) / n, f(a + k * (b - a) / n))]], k, 0.0, n - 1.0)
incrementi_y = Sequence(Vector[Vector[(a + k * (b - a) / n, f(a + (k - 1.0) * (b - a) / n)), (a + k * (b - a) / n, f(a + k * (b - a) / n))]], k, 1.0, n)
j = Segment(B, (b, f(b)))
ordinate = Sequence(Segment[(a + k * (b - a) / n, 0.0), (a + k * (b - a) / n, f(a + k * (b - a) / n))], k, 0.0, n)
u = Vector((b, f(a)), (b, f(b)))
testo1: "f(b)-f(a) = " + (f(b) - f(a))
O = Intersect(xAxis, yAxis)
v = Vector(O, P')