Adding a textfield to the function that I implemented to represent the tangent or derivative of a function, but I've added so mark errors.
f[x_] = -x^3 + 12 x - 3; (*Se define la función*)
xmin = -6;
xmax = 6 ; (* se define el mínimo y el máximo de la función*)
ainicia = -3 ;(* inicio del punto de tangencia*)
amin = -4.3;
amax = 5; (* se define el punto de tangencia mínimo y máximo*)
hinicia = -1;(*inicio del punto de intersección de la línea secante*)
hmin = -1.3;
hmax = 8.5;
Manipulate[
DynamicModule[{f = Sin[x^2]},
Column[{InputField[Dynamic[f]], Dynamic[Plot[f, {x, -5, 5}]]}]]
If[h == 0, h = .001];
Grid[
{{Plot[{f[x], If[t1, f[a] + (D[f[t], t] /. t -> a)*(x - a)],
f[a] + ((f[a + h] - f[a])/h)*(x - a)}, {x, xmin, xmax},
PlotStyle -> {{Thickness[0.005], Black}, {Thickness[0.004],
Blue}, {Thickness[0.004], Red}},
PlotRange -> {15*xmin, (8*xmax) + 2}, ImageSize -> {475, 325},
PlotLabel -> Style[Row[{Style["f(x)", Italic], "=",
ToString[-x^3 + x^2 + 12 x - 3, TraditionalForm]}], 20],
AxesLabel -> {Style["x", 16, Italic], Style["y", 16, Italic]},
Prolog -> {{PointSize[0.02], If[t1, Blue, Red], Point[{a, f[a]}]},
{PointSize[0.02], Red, Point[{a + h, f[a + h]}]}}]},
{Row[
{If[t1,
Style[Text[
"Pendiente-tangente =" <> ToString[D[f[t], t] /. t -> a]],
Blue, 20]],
Style[
Text["Pendiente-secante =" <> ToString[(f[a + h] - f[a])/h]],
Red, 20]}, " "]}}],
{{a, ainicia, "x0"}, amin, amax},
{{h, hinicia, "h"}, hmin, hmax},
{{t1, False, "Linea Tangente"}, {True, False}},
TrackedSymbols -> {a, h, t1}, SaveDefinitions -> True]
I do not like putting the textfield to enter the function, which is shown in the graph and is the same for the tangent.
f
$\endgroup$