What, exactly, do you want to illustrate? Just a single tangent line to the curve with a point moving along the curve? (or that but with the point moving along the tangent?) Or do you want a moving tangent line as you move points along the curve?
Whichever you want, there are some problems with your code. Before using Manipulate
, it's a good idea to try the graphics you want in a static mode, with a fixed value for the control variable(s).
makes no sense to me: on the left-hand side you seem to have two arguments, the first being a
; but what is the second argument? you have 1/2 _
, with a space between the fraction and the pattern symbol _
; what is that supposed to mean? Moreover, you have an x
on the right-hand side but no x
as an argument.
your Plot
code
Plot[ {y[x, 1/2], f[x]}, {x, -2, 4}, {1/2, -2, 4} (* options *)]
makes no sense: you seem to want to plot two functions of variable x
, namely, y[x, 1/2]
and f[x]
, but then after the domain list {x, -2, 4}
(which is fine) you have the mysterious list {1/2, -2, 4}
.
Once you straighten all that out, you can try to put it inside the Manipulate
.
I also suggest that you not directly use f'[a]
but rather compute ahead of time, once and for all, the derivative functions, say:
fp[x_] = f'[x]
And then use that in the right-hand side
f[a] + fp[a] (x - 1/2)
(or whatever it is that you really are trying to get there).
Note also that there is no earthly reason to include the explicit *
symbol for multiplication in f[a] + f'[a] * (x - 1/2)
or similar symbolic expression; explicit multiplication signs are needed in Mathematica only between actual numbers.