I have made this program to plot a tangent line to a graph, but the thing I don't know how to fix is that the tangent line is at a fixed length, when I move the slider it expands and shortens. I want the line to be like a segment.
Tangent[f_, x_] := Module[{},
Manipulate[
Show[
Plot [f'[p] (x - p) + f[p], {x, p - 1, p + 1},
PlotStyle -> {Thick, Orange},
PlotRange -> {{-10, 10}, {-70, 70}}],
Plot[f[x], {x, -10, 10}, PlotRange -> {{-10, 10}, {-70, 70}},
PlotStyle -> {color}]
], {p, -10, 10,
0.2}, {color, {Purple -> "Purple", Blue -> "Blue"}}]
]
f[x_]:=x^2 Sin[x];
Tangent[f,x]