This question already has an answer here:

Can Anyone help me out graph both function and its tangent line on the same xy axes, please?

f[x_] := a*x^3 + b*x^2 +c*x; 
tanLine[g_, x0_] := (D[g[x],x]/. x-> x0)*(x-x0)+g[x0];
Manipulate[Plot[{a*x^3 + b*x^2 +c*x,tanLine[f[x],1]}, 
{x, 0,5}, PlotStyle -> {Red, Blue}],{{a,-1},-2,3,Appearance -> "Labeled"},{{b,3},-5,5,Appearance -> "Labeled"},{{c,0},-10,20,Appearance -> "Labeled"}]

Any help would be appreciated. CS


marked as duplicate by m_goldberg plotting Feb 21 at 22:34

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • $\begingroup$ There are mainly scoping issues. Try tanLine[x_, {x0_, a_, b_, c_}] = (D[f[x], x] /. x -> x0)*(x - x0) + f[x0]; and Manipulate[Plot[{a*x^3 + b*x^2 + c*x, tanLine[x, {1, a, b, c}]} ... $\endgroup$ – march Feb 21 at 21:12