Locator question
- To: mathgroup at smc.vnet.net
- Subject: [mg79272] Locator question
- From: Mike <mjp.1 at comcast.net>
- Date: Mon, 23 Jul 2007 03:40:52 -0400 (EDT)
All, I'm trying to get the locator to track a point along a given curve: bothfandtan[g_, p_] := Module[{f = g, eqline = (D[g, x] /. x -> p[[1]]) (x - p[[1]]) + p[[2]]}, Show[{Plot[f, {x, 0, 2 \[Pi]}], Plot[eqline, {x, 0, 2 \[Pi]}]}]] Manipulate[ Show[bothfandtan[g, p], PlotLabel -> Style["slope of f(x)= " <> ToString[NumberForm[D[g, x] /. x -> p[[1]], {6, 4}]]]], {{g, Sin[x], "function"}, {Sin[x] -> TraditionalForm[Sin[x]], Cos[x] -> TraditionalForm[Cos[x]], x^2 -> TraditionalForm[x^2]}}, {{p, {0, 0}}, Locator}, SaveDefinitions -> True] I've tried a number of possibilities, but I can't seem to get this to work. Mathematica's help section on this isn't very helpful. Thanks for the help... Mike