MathGroup Archive 2007

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Manipulate (from Wolfram Demonstrations)

  • To: mathgroup at smc.vnet.net
  • Subject: [mg76813] Re: Manipulate (from Wolfram Demonstrations)
  • From: David Reiss <dbreiss at gmail.com>
  • Date: Mon, 28 May 2007 00:51:49 -0400 (EDT)
  • References: <f3bhf0$3cr$1@smc.vnet.net>


 Yes the code is slightly confusing.  The x being used in the Epilog
is not the same as the x in the itterator of the Plot.  Rather it is
used in the substitution within the right hand side of the Epilog
rule, being replaced by xi within the expression for p in that:

Epilog -> ({Orange, PointSize[.02], Point[{xi, p}], Thickness[.005],
    Line[{{xi - dx, p - dx pp}, {xi + dx, p + dx pp}}]} /. x -> xi)


and the xi is taken from the value in the slider (that is responsible
for the parameter xi but, in the Manipulate, is labeled by
Subscript[x, 0].  So, in effect the x is the expression for p is used
in two different ways in the Plot.  Once for the plot of the p curve
and a different way for the substitution x->xi.

--David

http://scientificarts.com/worklife
**[Version 2.0 -- now Mathematica 6 compatible!]**



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]



  • Prev by Date: Re: Mathematica 6.0 easier for me ... (small review)
  • Next by Date: Re: Re: Mathematica V6. ComplexMap
  • Previous by thread: Re: Manipulate (from Wolfram Demonstrations)
  • Next by thread: Re: Re: Manipulate (from Wolfram Demonstrations)