Adjust slider to change function

Show average slope

Show local slope

Click and drag point A

k = 0.05
d = 10
e = 2.718281828459045
gauss(x) = d * e^(-k * x^(2))
poly(x) = (8 * x - x^(2) + 0.15 * x^(3) - 0.025 * x^(5) + 0.0010 * x^(8)) * e^(-x)
a = 0.5
sat(x) = d * (1 - e^(-a * x))
decay(x) = d * e^(-a * x / 2)
xp(x) = e^(a * x / 2)
index = 1 (slider from 1 to 5, step 1)
f = If(x ≥ 0, If[index ≟ 1, decay, If[index ≟ 2, xp, If[index ≟ 3, sat, If[index ≟ 4, gauss, poly]]]])
O: (0, f(0))
A = Point(f)
c = 1
b = 3
q(x) = a * x^(2) + b * x + c
t = Tangent(A, f)
s = Slope(t)
text1: "Instantaneous slope = " + s
avgslope: (y(A) - y(O)) / x(A)
text2: "Average slope = " + avgslope
g = false
h = false
avgs = If(x > 0, f(0) + avgslope * x)
B = (13.61591896034409, 11.595690212702738)
C: (x(B), y(B) + avgslope)
D: (x(B) - 0.5, y(B))
E: (x(B) + 0.5, y(B))
i = Segment(D, E)
F: (x(B) + 1, y(B))
G: (x(F) - 0.5, y(F))
H: (x(F) + 0.5, y(F))
j = Segment(G, H)
I: (x(F), y(F) + s)
u = Segment(B, C)
v = Segment(F, I)