Re: Manipulate (from Wolfram Demonstrations)

*To*: mathgroup at smc.vnet.net*Subject*: [mg76869] Re: Manipulate (from Wolfram Demonstrations)*From*: David Bailey <dave at Remove_Thisdbailey.co.uk>*Date*: Tue, 29 May 2007 04:53:12 -0400 (EDT)*References*: <f3bhf0$3cr$1@smc.vnet.net>

Bruce Colletti wrote: > Re Mathematica 6.0 under WinXP. > > The code below (from Wolfram Demonstrations site) plots a tangent at the point set by the slider. > > Point[{xi,p}] baffles me: Point requires two numbers, but p is a function...I don't see how it evaluates to a number AT THIS location in the Manipulate statement. > > What is the mechanism that makes p evaluate to a number? Is it somehow referring to Plot's {x,-2,2} ? > > Thankx. > > Bruce > > Manipulate[ > With[{p = a x^3 + b x^2 + c x, dx = .8}, > With[{pp = D[p, x]}, > Plot[p, {x, -2, 2}, Ticks -> None, PlotRange -> All, > Epilog -> ({Orange, PointSize[.02], Point[{xi, p}], > Thickness[.005], > Line[{{xi - dx, p - dx pp}, {xi + dx, p + dx pp}}]} /. > x -> xi)]]], {{xi, 0, Subscript[x, 0]}, -2, > 2}, Delimiter, {{a, -2, "a"}, -2, 2}, {{b, -2, "b"}, -2, > 2}, {{c, -2, "c"}, -2, 2}, ControllerLinking -> True] > Technically, p is not a function here, but an expression involving the variable x. Thus the Plot command contains an expression that depends on x, and is analogous to the archetypal Plot[Sin[x],{x,0,10}] David Bailey http://www.dbaileyconsultancy.co.uk