this is my code:
f[x_] := 1 - 2 x + x^2;
tangent[f_, a_] := f[a] + f'[a] (x - a)
slope[x_] := f'[x]
sol = x /. Solve[tangent[f, 2] == tangent[f, 3], x] // N
sol[[1]]
f[2.5] // N
Plot[{f[x], tangent[f, 2], tangent[f, 3]}, {x, 0, 4}, Epilog -> {Red, PointSize[0.02], Point[{2.5, 2.25}]}]
Manipulate[Plot[{f[x], tangent[f, t], tangent[f, t + 0.1]}, {x, 0, 4},
Epilog -> {Red, PointSize[0.02], Point[{2.5, 2.25}]}], {{t, 4,"time"}, 0, 4, 0.05}]
The red point dont' move together the lines.
I fixed my code, but my notebook flash now.
Manipulate[ Module[{x}, f[x_] := 1 - 2 x + x^2;
tangent[f_, a_] := f[a] + f'[a] (x - a);
slope[x_] := f'[x] ;
sol = x /. NSolve[tangent[f, t] == tangent[f, t + 1], x];
resul = sol /. sol -> sol[[1]];
Plot[{f[x], tangent[f, t], tangent[f, t + 1]}, {x, 0, 4},
Epilog -> {Red, PointSize[0.02], Point[{resul, f[resul]}]}]]
, {{t, 4, "tiempo"}, 0, 4, 0.05}]
Point[{2.5, 2.25}]
specifies a constant location, so it wouldn't move with the lines. You probably want to start there. $\endgroup$NSolve[...]
instead ofSolve[...] // N
. $\endgroup$